525 ircTimestamp(), sender, ircFilter(msg))) |
525 ircTimestamp(), sender, ircFilter(msg))) |
526 if Preferences.getIrc("ShowNotifications"): |
526 if Preferences.getIrc("ShowNotifications"): |
527 if Preferences.getIrc("NotifyMessage"): |
527 if Preferences.getIrc("NotifyMessage"): |
528 self.__ui.showNotification( |
528 self.__ui.showNotification( |
529 UI.PixmapCache.getPixmap("irc48.png"), |
529 UI.PixmapCache.getPixmap("irc48.png"), |
530 self.trUtf8("Channel Message"), msg) |
530 self.tr("Channel Message"), msg) |
531 elif Preferences.getIrc("NotifyNick") and \ |
531 elif Preferences.getIrc("NotifyNick") and \ |
532 self.__userName.lower() in msg.lower(): |
532 self.__userName.lower() in msg.lower(): |
533 self.__ui.showNotification( |
533 self.__ui.showNotification( |
534 UI.PixmapCache.getPixmap("irc48.png"), |
534 UI.PixmapCache.getPixmap("irc48.png"), |
535 self.trUtf8("Nick mentioned"), msg) |
535 self.tr("Nick mentioned"), msg) |
536 |
536 |
537 def addUsers(self, users): |
537 def addUsers(self, users): |
538 """ |
538 """ |
539 Public method to add users to the channel. |
539 Public method to add users to the channel. |
540 |
540 |
553 @return flag indicating whether the message was handled (boolean) |
553 @return flag indicating whether the message was handled (boolean) |
554 """ |
554 """ |
555 if match.group(3).lower() == self.__name.lower(): |
555 if match.group(3).lower() == self.__name.lower(): |
556 if self.__userName != match.group(1): |
556 if self.__userName != match.group(1): |
557 IrcUserItem(match.group(1), self.usersList) |
557 IrcUserItem(match.group(1), self.usersList) |
558 msg = self.trUtf8( |
558 msg = self.tr( |
559 "{0} has joined the channel {1} ({2}).").format( |
559 "{0} has joined the channel {1} ({2}).").format( |
560 match.group(1), self.__name, match.group(2)) |
560 match.group(1), self.__name, match.group(2)) |
561 self.__addManagementMessage( |
561 self.__addManagementMessage( |
562 IrcChannelWidget.JoinIndicator, msg) |
562 IrcChannelWidget.JoinIndicator, msg) |
563 else: |
563 else: |
564 msg = self.trUtf8( |
564 msg = self.tr( |
565 "You have joined the channel {0} ({1}).").format( |
565 "You have joined the channel {0} ({1}).").format( |
566 self.__name, match.group(2)) |
566 self.__name, match.group(2)) |
567 self.__addManagementMessage( |
567 self.__addManagementMessage( |
568 IrcChannelWidget.JoinIndicator, msg) |
568 IrcChannelWidget.JoinIndicator, msg) |
569 if Preferences.getIrc("ShowNotifications") and \ |
569 if Preferences.getIrc("ShowNotifications") and \ |
570 Preferences.getIrc("NotifyJoinPart"): |
570 Preferences.getIrc("NotifyJoinPart"): |
571 self.__ui.showNotification( |
571 self.__ui.showNotification( |
572 UI.PixmapCache.getPixmap("irc48.png"), |
572 UI.PixmapCache.getPixmap("irc48.png"), |
573 self.trUtf8("Join Channel"), msg) |
573 self.tr("Join Channel"), msg) |
574 return True |
574 return True |
575 |
575 |
576 return False |
576 return False |
577 |
577 |
578 def __userPart(self, match): |
578 def __userPart(self, match): |
585 if match.group(2).lower() == self.__name.lower(): |
585 if match.group(2).lower() == self.__name.lower(): |
586 itm = self.__findUser(match.group(1)) |
586 itm = self.__findUser(match.group(1)) |
587 self.usersList.takeItem(self.usersList.row(itm)) |
587 self.usersList.takeItem(self.usersList.row(itm)) |
588 del itm |
588 del itm |
589 if match.lastindex == 2: |
589 if match.lastindex == 2: |
590 msg = self.trUtf8("{0} has left {1}.").format( |
590 msg = self.tr("{0} has left {1}.").format( |
591 match.group(1), self.__name) |
591 match.group(1), self.__name) |
592 nmsg = msg |
592 nmsg = msg |
593 self.__addManagementMessage( |
593 self.__addManagementMessage( |
594 IrcChannelWidget.LeaveIndicator, msg) |
594 IrcChannelWidget.LeaveIndicator, msg) |
595 else: |
595 else: |
596 msg = self.trUtf8("{0} has left {1}: {2}.").format( |
596 msg = self.tr("{0} has left {1}: {2}.").format( |
597 match.group(1), self.__name, ircFilter(match.group(3))) |
597 match.group(1), self.__name, ircFilter(match.group(3))) |
598 nmsg = self.trUtf8("{0} has left {1}: {2}.").format( |
598 nmsg = self.tr("{0} has left {1}: {2}.").format( |
599 match.group(1), self.__name, match.group(3)) |
599 match.group(1), self.__name, match.group(3)) |
600 self.__addManagementMessage( |
600 self.__addManagementMessage( |
601 IrcChannelWidget.LeaveIndicator, msg) |
601 IrcChannelWidget.LeaveIndicator, msg) |
602 if Preferences.getIrc("ShowNotifications") and \ |
602 if Preferences.getIrc("ShowNotifications") and \ |
603 Preferences.getIrc("NotifyJoinPart"): |
603 Preferences.getIrc("NotifyJoinPart"): |
604 self.__ui.showNotification( |
604 self.__ui.showNotification( |
605 UI.PixmapCache.getPixmap("irc48.png"), |
605 UI.PixmapCache.getPixmap("irc48.png"), |
606 self.trUtf8("Leave Channel"), nmsg) |
606 self.tr("Leave Channel"), nmsg) |
607 return True |
607 return True |
608 |
608 |
609 return False |
609 return False |
610 |
610 |
611 def __userQuit(self, match): |
611 def __userQuit(self, match): |
618 itm = self.__findUser(match.group(1)) |
618 itm = self.__findUser(match.group(1)) |
619 if itm: |
619 if itm: |
620 self.usersList.takeItem(self.usersList.row(itm)) |
620 self.usersList.takeItem(self.usersList.row(itm)) |
621 del itm |
621 del itm |
622 if match.lastindex == 1: |
622 if match.lastindex == 1: |
623 msg = self.trUtf8("{0} has quit {1}.").format( |
623 msg = self.tr("{0} has quit {1}.").format( |
624 match.group(1), self.__name) |
624 match.group(1), self.__name) |
625 self.__addManagementMessage( |
625 self.__addManagementMessage( |
626 IrcChannelWidget.MessageIndicator, msg) |
626 IrcChannelWidget.MessageIndicator, msg) |
627 else: |
627 else: |
628 msg = self.trUtf8("{0} has quit {1}: {2}.").format( |
628 msg = self.tr("{0} has quit {1}: {2}.").format( |
629 match.group(1), self.__name, ircFilter(match.group(2))) |
629 match.group(1), self.__name, ircFilter(match.group(2))) |
630 self.__addManagementMessage( |
630 self.__addManagementMessage( |
631 IrcChannelWidget.MessageIndicator, msg) |
631 IrcChannelWidget.MessageIndicator, msg) |
632 if Preferences.getIrc("ShowNotifications") and \ |
632 if Preferences.getIrc("ShowNotifications") and \ |
633 Preferences.getIrc("NotifyJoinPart"): |
633 Preferences.getIrc("NotifyJoinPart"): |
634 self.__ui.showNotification( |
634 self.__ui.showNotification( |
635 UI.PixmapCache.getPixmap("irc48.png"), |
635 UI.PixmapCache.getPixmap("irc48.png"), |
636 self.trUtf8("Quit"), msg) |
636 self.tr("Quit"), msg) |
637 |
637 |
638 # always return False for other channels and server to process |
638 # always return False for other channels and server to process |
639 return False |
639 return False |
640 |
640 |
641 def __userNickChange(self, match): |
641 def __userNickChange(self, match): |
649 if itm: |
649 if itm: |
650 itm.setName(match.group(2)) |
650 itm.setName(match.group(2)) |
651 if match.group(1) == self.__userName: |
651 if match.group(1) == self.__userName: |
652 self.__addManagementMessage( |
652 self.__addManagementMessage( |
653 IrcChannelWidget.MessageIndicator, |
653 IrcChannelWidget.MessageIndicator, |
654 self.trUtf8("You are now known as {0}.").format( |
654 self.tr("You are now known as {0}.").format( |
655 match.group(2))) |
655 match.group(2))) |
656 self.__userName = match.group(2) |
656 self.__userName = match.group(2) |
657 else: |
657 else: |
658 self.__addManagementMessage( |
658 self.__addManagementMessage( |
659 IrcChannelWidget.MessageIndicator, |
659 IrcChannelWidget.MessageIndicator, |
660 self.trUtf8("User {0} is now known as {1}.").format( |
660 self.tr("User {0} is now known as {1}.").format( |
661 match.group(1), match.group(2))) |
661 match.group(1), match.group(2))) |
662 |
662 |
663 # always return False for other channels and server to process |
663 # always return False for other channels and server to process |
664 return False |
664 return False |
665 |
665 |
766 for modeChar in modeString: |
766 for modeChar in modeString: |
767 if modeChar == "+": |
767 if modeChar == "+": |
768 continue |
768 continue |
769 elif modeChar == "k": |
769 elif modeChar == "k": |
770 parameter = modesParameters.pop(0) |
770 parameter = modesParameters.pop(0) |
771 modes.append(self.trUtf8( |
771 modes.append(self.tr( |
772 "password protected ({0})").format(parameter)) |
772 "password protected ({0})").format(parameter)) |
773 elif modeChar == "l": |
773 elif modeChar == "l": |
774 parameter = modesParameters.pop(0) |
774 parameter = modesParameters.pop(0) |
775 modes.append(self.trUtf8( |
775 modes.append(self.tr( |
776 "limited to %n user(s)", "", int(parameter))) |
776 "limited to %n user(s)", "", int(parameter))) |
777 elif modeChar in modesDict: |
777 elif modeChar in modesDict: |
778 modes.append(modesDict[modeChar]) |
778 modes.append(modesDict[modeChar]) |
779 else: |
779 else: |
780 modes.append(modeChar) |
780 modes.append(modeChar) |
781 |
781 |
782 self.__addManagementMessage( |
782 self.__addManagementMessage( |
783 IrcChannelWidget.MessageIndicator, |
783 IrcChannelWidget.MessageIndicator, |
784 self.trUtf8("Channel modes: {0}.").format(", ".join(modes))) |
784 self.tr("Channel modes: {0}.").format(", ".join(modes))) |
785 |
785 |
786 return True |
786 return True |
787 |
787 |
788 return False |
788 return False |
789 |
789 |
827 elif mode == "-": |
827 elif mode == "-": |
828 isPlus = False |
828 isPlus = False |
829 continue |
829 continue |
830 elif mode == "a": |
830 elif mode == "a": |
831 if isPlus: |
831 if isPlus: |
832 message = self.trUtf8( |
832 message = self.tr( |
833 "{0} sets the channel mode to 'anonymous'.")\ |
833 "{0} sets the channel mode to 'anonymous'.")\ |
834 .format(nick) |
834 .format(nick) |
835 else: |
835 else: |
836 message = self.trUtf8( |
836 message = self.tr( |
837 "{0} removes the 'anonymous' mode from the" |
837 "{0} removes the 'anonymous' mode from the" |
838 " channel.").format(nick) |
838 " channel.").format(nick) |
839 elif mode == "b": |
839 elif mode == "b": |
840 if isPlus: |
840 if isPlus: |
841 message = self.trUtf8( |
841 message = self.tr( |
842 "{0} sets a ban on {1}.").format( |
842 "{0} sets a ban on {1}.").format( |
843 nick, modesParameters.pop(0)) |
843 nick, modesParameters.pop(0)) |
844 else: |
844 else: |
845 message = self.trUtf8( |
845 message = self.tr( |
846 "{0} removes the ban on {1}.").format( |
846 "{0} removes the ban on {1}.").format( |
847 nick, modesParameters.pop(0)) |
847 nick, modesParameters.pop(0)) |
848 elif mode == "c": |
848 elif mode == "c": |
849 if isPlus: |
849 if isPlus: |
850 message = self.trUtf8( |
850 message = self.tr( |
851 "{0} sets the channel mode to 'no colors" |
851 "{0} sets the channel mode to 'no colors" |
852 " allowed'.").format(nick) |
852 " allowed'.").format(nick) |
853 else: |
853 else: |
854 message = self.trUtf8( |
854 message = self.tr( |
855 "{0} sets the channel mode to 'allow color" |
855 "{0} sets the channel mode to 'allow color" |
856 " codes'.").format(nick) |
856 " codes'.").format(nick) |
857 elif mode == "e": |
857 elif mode == "e": |
858 if isPlus: |
858 if isPlus: |
859 message = self.trUtf8( |
859 message = self.tr( |
860 "{0} sets a ban exception on {1}.").format( |
860 "{0} sets a ban exception on {1}.").format( |
861 nick, modesParameters.pop(0)) |
861 nick, modesParameters.pop(0)) |
862 else: |
862 else: |
863 message = self.trUtf8( |
863 message = self.tr( |
864 "{0} removes the ban exception on {1}.").format( |
864 "{0} removes the ban exception on {1}.").format( |
865 nick, modesParameters.pop(0)) |
865 nick, modesParameters.pop(0)) |
866 elif mode == "i": |
866 elif mode == "i": |
867 if isPlus: |
867 if isPlus: |
868 message = self.trUtf8( |
868 message = self.tr( |
869 "{0} sets the channel mode to 'invite only'.")\ |
869 "{0} sets the channel mode to 'invite only'.")\ |
870 .format(nick) |
870 .format(nick) |
871 else: |
871 else: |
872 message = self.trUtf8( |
872 message = self.tr( |
873 "{0} removes the 'invite only' mode from the" |
873 "{0} removes the 'invite only' mode from the" |
874 " channel.").format(nick) |
874 " channel.").format(nick) |
875 elif mode == "k": |
875 elif mode == "k": |
876 if isPlus: |
876 if isPlus: |
877 message = self.trUtf8( |
877 message = self.tr( |
878 "{0} sets the channel key to '{1}'.").format( |
878 "{0} sets the channel key to '{1}'.").format( |
879 nick, modesParameters.pop(0)) |
879 nick, modesParameters.pop(0)) |
880 else: |
880 else: |
881 message = self.trUtf8( |
881 message = self.tr( |
882 "{0} removes the channel key.").format(nick) |
882 "{0} removes the channel key.").format(nick) |
883 elif mode == "l": |
883 elif mode == "l": |
884 if isPlus: |
884 if isPlus: |
885 message = self.trUtf8( |
885 message = self.tr( |
886 "{0} sets the channel limit to %n nick(s).", "", |
886 "{0} sets the channel limit to %n nick(s).", "", |
887 int(modesParameters.pop(0))).format(nick) |
887 int(modesParameters.pop(0))).format(nick) |
888 else: |
888 else: |
889 message = self.trUtf8( |
889 message = self.tr( |
890 "{0} removes the channel limit.").format(nick) |
890 "{0} removes the channel limit.").format(nick) |
891 elif mode == "m": |
891 elif mode == "m": |
892 if isPlus: |
892 if isPlus: |
893 message = self.trUtf8( |
893 message = self.tr( |
894 "{0} sets the channel mode to 'moderated'.")\ |
894 "{0} sets the channel mode to 'moderated'.")\ |
895 .format(nick) |
895 .format(nick) |
896 else: |
896 else: |
897 message = self.trUtf8( |
897 message = self.tr( |
898 "{0} sets the channel mode to 'unmoderated'.")\ |
898 "{0} sets the channel mode to 'unmoderated'.")\ |
899 .format(nick) |
899 .format(nick) |
900 elif mode == "n": |
900 elif mode == "n": |
901 if isPlus: |
901 if isPlus: |
902 message = self.trUtf8( |
902 message = self.tr( |
903 "{0} sets the channel mode to 'no messages from" |
903 "{0} sets the channel mode to 'no messages from" |
904 " outside'.").format(nick) |
904 " outside'.").format(nick) |
905 else: |
905 else: |
906 message = self.trUtf8( |
906 message = self.tr( |
907 "{0} sets the channel mode to 'allow messages" |
907 "{0} sets the channel mode to 'allow messages" |
908 " from outside'.").format(nick) |
908 " from outside'.").format(nick) |
909 elif mode == "p": |
909 elif mode == "p": |
910 if isPlus: |
910 if isPlus: |
911 message = self.trUtf8( |
911 message = self.tr( |
912 "{0} sets the channel mode to 'private'.")\ |
912 "{0} sets the channel mode to 'private'.")\ |
913 .format(nick) |
913 .format(nick) |
914 else: |
914 else: |
915 message = self.trUtf8( |
915 message = self.tr( |
916 "{0} sets the channel mode to 'public'.")\ |
916 "{0} sets the channel mode to 'public'.")\ |
917 .format(nick) |
917 .format(nick) |
918 elif mode == "q": |
918 elif mode == "q": |
919 if isPlus: |
919 if isPlus: |
920 message = self.trUtf8( |
920 message = self.tr( |
921 "{0} sets the channel mode to 'quiet'.")\ |
921 "{0} sets the channel mode to 'quiet'.")\ |
922 .format(nick) |
922 .format(nick) |
923 else: |
923 else: |
924 message = self.trUtf8( |
924 message = self.tr( |
925 "{0} removes the 'quiet' mode from the channel.")\ |
925 "{0} removes the 'quiet' mode from the channel.")\ |
926 .format(nick) |
926 .format(nick) |
927 elif mode == "r": |
927 elif mode == "r": |
928 continue |
928 continue |
929 elif mode == "s": |
929 elif mode == "s": |
930 if isPlus: |
930 if isPlus: |
931 message = self.trUtf8( |
931 message = self.tr( |
932 "{0} sets the channel mode to 'secret'.")\ |
932 "{0} sets the channel mode to 'secret'.")\ |
933 .format(nick) |
933 .format(nick) |
934 else: |
934 else: |
935 message = self.trUtf8( |
935 message = self.tr( |
936 "{0} sets the channel mode to 'visible'.")\ |
936 "{0} sets the channel mode to 'visible'.")\ |
937 .format(nick) |
937 .format(nick) |
938 elif mode == "t": |
938 elif mode == "t": |
939 if isPlus: |
939 if isPlus: |
940 message = self.trUtf8( |
940 message = self.tr( |
941 "{0} switches on 'topic protection'.").format(nick) |
941 "{0} switches on 'topic protection'.").format(nick) |
942 else: |
942 else: |
943 message = self.trUtf8( |
943 message = self.tr( |
944 "{0} switches off 'topic protection'.")\ |
944 "{0} switches off 'topic protection'.")\ |
945 .format(nick) |
945 .format(nick) |
946 elif mode == "I": |
946 elif mode == "I": |
947 if isPlus: |
947 if isPlus: |
948 message = self.trUtf8( |
948 message = self.tr( |
949 "{0} sets invitation mask {1}.").format( |
949 "{0} sets invitation mask {1}.").format( |
950 nick, modesParameters.pop(0)) |
950 nick, modesParameters.pop(0)) |
951 else: |
951 else: |
952 message = self.trUtf8( |
952 message = self.tr( |
953 "{0} removes the invitation mask {1}.").format( |
953 "{0} removes the invitation mask {1}.").format( |
954 nick, modesParameters.pop(0)) |
954 nick, modesParameters.pop(0)) |
955 |
955 |
956 self.__addManagementMessage(self.trUtf8("Mode"), message) |
956 self.__addManagementMessage(self.tr("Mode"), message) |
957 |
957 |
958 return True |
958 return True |
959 |
959 |
960 return False |
960 return False |
961 |
961 |
1022 ctcpRequest, ctcpArg = ctcpCommand, "" |
1022 ctcpRequest, ctcpArg = ctcpCommand, "" |
1023 ctcpRequest = ctcpRequest.lower() |
1023 ctcpRequest = ctcpRequest.lower() |
1024 if ctcpRequest == "version": |
1024 if ctcpRequest == "version": |
1025 msg = "Eric IRC client {0}, {1}".format(Version, Copyright) |
1025 msg = "Eric IRC client {0}, {1}".format(Version, Copyright) |
1026 self.__addManagementMessage( |
1026 self.__addManagementMessage( |
1027 self.trUtf8("CTCP"), |
1027 self.tr("CTCP"), |
1028 self.trUtf8("Received Version request from {0}.").format( |
1028 self.tr("Received Version request from {0}.").format( |
1029 match.group(1))) |
1029 match.group(1))) |
1030 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg) |
1030 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg) |
1031 elif ctcpRequest == "ping": |
1031 elif ctcpRequest == "ping": |
1032 self.__addManagementMessage( |
1032 self.__addManagementMessage( |
1033 self.trUtf8("CTCP"), |
1033 self.tr("CTCP"), |
1034 self.trUtf8( |
1034 self.tr( |
1035 "Received CTCP-PING request from {0}," |
1035 "Received CTCP-PING request from {0}," |
1036 " sending answer.").format(match.group(1))) |
1036 " sending answer.").format(match.group(1))) |
1037 self.sendCtcpReply.emit( |
1037 self.sendCtcpReply.emit( |
1038 match.group(1), "PING {0}".format(ctcpArg)) |
1038 match.group(1), "PING {0}".format(ctcpArg)) |
1039 elif ctcpRequest == "clientinfo": |
1039 elif ctcpRequest == "clientinfo": |
1040 self.__addManagementMessage( |
1040 self.__addManagementMessage( |
1041 self.trUtf8("CTCP"), |
1041 self.tr("CTCP"), |
1042 self.trUtf8( |
1042 self.tr( |
1043 "Received CTCP-CLIENTINFO request from {0}," |
1043 "Received CTCP-CLIENTINFO request from {0}," |
1044 " sending answer.").format(match.group(1))) |
1044 " sending answer.").format(match.group(1))) |
1045 self.sendCtcpReply.emit( |
1045 self.sendCtcpReply.emit( |
1046 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION") |
1046 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION") |
1047 else: |
1047 else: |
1048 self.__addManagementMessage( |
1048 self.__addManagementMessage( |
1049 self.trUtf8("CTCP"), |
1049 self.tr("CTCP"), |
1050 self.trUtf8("Received unknown CTCP-{0} request from {1}.") |
1050 self.tr("Received unknown CTCP-{0} request from {1}.") |
1051 .format(ctcpRequest, match.group(1))) |
1051 .format(ctcpRequest, match.group(1))) |
1052 return True |
1052 return True |
1053 |
1053 |
1054 return False |
1054 return False |
1055 |
1055 |
1246 """ |
1246 """ |
1247 self.__messagesMenu = QMenu(self) |
1247 self.__messagesMenu = QMenu(self) |
1248 self.__copyMessagesAct = \ |
1248 self.__copyMessagesAct = \ |
1249 self.__messagesMenu.addAction( |
1249 self.__messagesMenu.addAction( |
1250 UI.PixmapCache.getIcon("editCopy.png"), |
1250 UI.PixmapCache.getIcon("editCopy.png"), |
1251 self.trUtf8("Copy"), self.__copyMessages) |
1251 self.tr("Copy"), self.__copyMessages) |
1252 self.__messagesMenu.addSeparator() |
1252 self.__messagesMenu.addSeparator() |
1253 self.__cutAllMessagesAct = \ |
1253 self.__cutAllMessagesAct = \ |
1254 self.__messagesMenu.addAction( |
1254 self.__messagesMenu.addAction( |
1255 UI.PixmapCache.getIcon("editCut.png"), |
1255 UI.PixmapCache.getIcon("editCut.png"), |
1256 self.trUtf8("Cut all"), self.__cutAllMessages) |
1256 self.tr("Cut all"), self.__cutAllMessages) |
1257 self.__copyAllMessagesAct = \ |
1257 self.__copyAllMessagesAct = \ |
1258 self.__messagesMenu.addAction( |
1258 self.__messagesMenu.addAction( |
1259 UI.PixmapCache.getIcon("editCopy.png"), |
1259 UI.PixmapCache.getIcon("editCopy.png"), |
1260 self.trUtf8("Copy all"), self.__copyAllMessages) |
1260 self.tr("Copy all"), self.__copyAllMessages) |
1261 self.__messagesMenu.addSeparator() |
1261 self.__messagesMenu.addSeparator() |
1262 self.__clearMessagesAct = \ |
1262 self.__clearMessagesAct = \ |
1263 self.__messagesMenu.addAction( |
1263 self.__messagesMenu.addAction( |
1264 UI.PixmapCache.getIcon("editDelete.png"), |
1264 UI.PixmapCache.getIcon("editDelete.png"), |
1265 self.trUtf8("Clear"), self.__clearMessages) |
1265 self.tr("Clear"), self.__clearMessages) |
1266 self.__messagesMenu.addSeparator() |
1266 self.__messagesMenu.addSeparator() |
1267 self.__saveMessagesAct = \ |
1267 self.__saveMessagesAct = \ |
1268 self.__messagesMenu.addAction( |
1268 self.__messagesMenu.addAction( |
1269 UI.PixmapCache.getIcon("fileSave.png"), |
1269 UI.PixmapCache.getIcon("fileSave.png"), |
1270 self.trUtf8("Save"), self.__saveMessages) |
1270 self.tr("Save"), self.__saveMessages) |
1271 self.__messagesMenu.addSeparator() |
1271 self.__messagesMenu.addSeparator() |
1272 self.__setMarkerMessagesAct = self.__messagesMenu.addAction( |
1272 self.__setMarkerMessagesAct = self.__messagesMenu.addAction( |
1273 self.trUtf8("Mark Current Position"), self.setMarkerLine) |
1273 self.tr("Mark Current Position"), self.setMarkerLine) |
1274 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction( |
1274 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction( |
1275 self.trUtf8("Remove Position Marker"), |
1275 self.tr("Remove Position Marker"), |
1276 self.unsetMarkerLine) |
1276 self.unsetMarkerLine) |
1277 |
1277 |
1278 self.on_messages_copyAvailable(False) |
1278 self.on_messages_copyAvailable(False) |
1279 |
1279 |
1280 @pyqtSlot(bool) |
1280 @pyqtSlot(bool) |
1320 """ |
1320 """ |
1321 Private slot to initialize the users list context menu. |
1321 Private slot to initialize the users list context menu. |
1322 """ |
1322 """ |
1323 self.__usersMenu = QMenu(self) |
1323 self.__usersMenu = QMenu(self) |
1324 self.__whoIsAct = self.__usersMenu.addAction( |
1324 self.__whoIsAct = self.__usersMenu.addAction( |
1325 self.trUtf8("Who Is"), self.__whoIs) |
1325 self.tr("Who Is"), self.__whoIs) |
1326 self.__usersMenu.addSeparator() |
1326 self.__usersMenu.addSeparator() |
1327 self.__privateChatAct = self.__usersMenu.addAction( |
1327 self.__privateChatAct = self.__usersMenu.addAction( |
1328 self.trUtf8("Private Chat"), self.__openPrivateChat) |
1328 self.tr("Private Chat"), self.__openPrivateChat) |
1329 self.__usersMenu.addSeparator() |
1329 self.__usersMenu.addSeparator() |
1330 self.__usersListRefreshAct = self.__usersMenu.addAction( |
1330 self.__usersListRefreshAct = self.__usersMenu.addAction( |
1331 self.trUtf8("Refresh"), self.__sendAutoWhoCommand) |
1331 self.tr("Refresh"), self.__sendAutoWhoCommand) |
1332 |
1332 |
1333 @pyqtSlot(QPoint) |
1333 @pyqtSlot(QPoint) |
1334 def on_usersList_customContextMenuRequested(self, pos): |
1334 def on_usersList_customContextMenuRequested(self, pos): |
1335 """ |
1335 """ |
1336 Private slot to show the context menu of the users list. |
1336 Private slot to show the context menu of the users list. |
1505 userChannels.append(channel) |
1505 userChannels.append(channel) |
1506 |
1506 |
1507 # show messages |
1507 # show messages |
1508 if userChannels: |
1508 if userChannels: |
1509 self.__addManagementMessage( |
1509 self.__addManagementMessage( |
1510 self.trUtf8("Whois"), |
1510 self.tr("Whois"), |
1511 self.trUtf8("{0} is a user on channels: {1}").format( |
1511 self.tr("{0} is a user on channels: {1}").format( |
1512 match.group(1), " ".join(userChannels))) |
1512 match.group(1), " ".join(userChannels))) |
1513 if voiceChannels: |
1513 if voiceChannels: |
1514 self.__addManagementMessage( |
1514 self.__addManagementMessage( |
1515 self.trUtf8("Whois"), |
1515 self.tr("Whois"), |
1516 self.trUtf8("{0} has voice on channels: {1}").format( |
1516 self.tr("{0} has voice on channels: {1}").format( |
1517 match.group(1), " ".join(voiceChannels))) |
1517 match.group(1), " ".join(voiceChannels))) |
1518 if halfopChannels: |
1518 if halfopChannels: |
1519 self.__addManagementMessage( |
1519 self.__addManagementMessage( |
1520 self.trUtf8("Whois"), |
1520 self.tr("Whois"), |
1521 self.trUtf8("{0} is a halfop on channels: {1}").format( |
1521 self.tr("{0} is a halfop on channels: {1}").format( |
1522 match.group(1), " ".join(halfopChannels))) |
1522 match.group(1), " ".join(halfopChannels))) |
1523 if opChannels: |
1523 if opChannels: |
1524 self.__addManagementMessage( |
1524 self.__addManagementMessage( |
1525 self.trUtf8("Whois"), |
1525 self.tr("Whois"), |
1526 self.trUtf8("{0} is an operator on channels: {1}").format( |
1526 self.tr("{0} is an operator on channels: {1}").format( |
1527 match.group(1), " ".join(opChannels))) |
1527 match.group(1), " ".join(opChannels))) |
1528 if ownerChannels: |
1528 if ownerChannels: |
1529 self.__addManagementMessage( |
1529 self.__addManagementMessage( |
1530 self.trUtf8("Whois"), |
1530 self.tr("Whois"), |
1531 self.trUtf8("{0} is owner of channels: {1}").format( |
1531 self.tr("{0} is owner of channels: {1}").format( |
1532 match.group(1), " ".join(ownerChannels))) |
1532 match.group(1), " ".join(ownerChannels))) |
1533 if adminChannels: |
1533 if adminChannels: |
1534 self.__addManagementMessage( |
1534 self.__addManagementMessage( |
1535 self.trUtf8("Whois"), |
1535 self.tr("Whois"), |
1536 self.trUtf8("{0} is admin on channels: {1}").format( |
1536 self.tr("{0} is admin on channels: {1}").format( |
1537 match.group(1), " ".join(adminChannels))) |
1537 match.group(1), " ".join(adminChannels))) |
1538 return True |
1538 return True |
1539 |
1539 |
1540 return False |
1540 return False |
1541 |
1541 |
1600 signonTimestamp = int(match.group(3)) |
1600 signonTimestamp = int(match.group(3)) |
1601 signonTime = QDateTime() |
1601 signonTime = QDateTime() |
1602 signonTime.setTime_t(signonTimestamp) |
1602 signonTime.setTime_t(signonTimestamp) |
1603 |
1603 |
1604 if days: |
1604 if days: |
1605 daysString = self.trUtf8("%n day(s)", "", days) |
1605 daysString = self.tr("%n day(s)", "", days) |
1606 hoursString = self.trUtf8("%n hour(s)", "", hours) |
1606 hoursString = self.tr("%n hour(s)", "", hours) |
1607 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1607 minutesString = self.tr("%n minute(s)", "", minutes) |
1608 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1608 secondsString = self.tr("%n second(s)", "", seconds) |
1609 self.__addManagementMessage( |
1609 self.__addManagementMessage( |
1610 self.trUtf8("Whois"), |
1610 self.tr("Whois"), |
1611 self.trUtf8( |
1611 self.tr( |
1612 "{0} has been idle for {1}, {2}, {3}, and {4}.", |
1612 "{0} has been idle for {1}, {2}, {3}, and {4}.", |
1613 "{0} = name of person, {1} = (x days)," |
1613 "{0} = name of person, {1} = (x days)," |
1614 " {2} = (x hours), {3} = (x minutes)," |
1614 " {2} = (x hours), {3} = (x minutes)," |
1615 " {4} = (x seconds)").format( |
1615 " {4} = (x seconds)").format( |
1616 match.group(1), daysString, hoursString, minutesString, |
1616 match.group(1), daysString, hoursString, minutesString, |
1617 secondsString)) |
1617 secondsString)) |
1618 elif hours: |
1618 elif hours: |
1619 hoursString = self.trUtf8("%n hour(s)", "", hours) |
1619 hoursString = self.tr("%n hour(s)", "", hours) |
1620 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1620 minutesString = self.tr("%n minute(s)", "", minutes) |
1621 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1621 secondsString = self.tr("%n second(s)", "", seconds) |
1622 self.__addManagementMessage( |
1622 self.__addManagementMessage( |
1623 self.trUtf8("Whois"), |
1623 self.tr("Whois"), |
1624 self.trUtf8( |
1624 self.tr( |
1625 "{0} has been idle for {1}, {2}, and {3}.", |
1625 "{0} has been idle for {1}, {2}, and {3}.", |
1626 "{0} = name of person, {1} = (x hours), " |
1626 "{0} = name of person, {1} = (x hours), " |
1627 "{2} = (x minutes), {3} = (x seconds)") |
1627 "{2} = (x minutes), {3} = (x seconds)") |
1628 .format(match.group(1), hoursString, minutesString, |
1628 .format(match.group(1), hoursString, minutesString, |
1629 secondsString)) |
1629 secondsString)) |
1630 elif minutes: |
1630 elif minutes: |
1631 minutesString = self.trUtf8("%n minute(s)", "", minutes) |
1631 minutesString = self.tr("%n minute(s)", "", minutes) |
1632 secondsString = self.trUtf8("%n second(s)", "", seconds) |
1632 secondsString = self.tr("%n second(s)", "", seconds) |
1633 self.__addManagementMessage( |
1633 self.__addManagementMessage( |
1634 self.trUtf8("Whois"), |
1634 self.tr("Whois"), |
1635 self.trUtf8( |
1635 self.tr( |
1636 "{0} has been idle for {1} and {2}.", |
1636 "{0} has been idle for {1} and {2}.", |
1637 "{0} = name of person, {1} = (x minutes), " |
1637 "{0} = name of person, {1} = (x minutes), " |
1638 "{3} = (x seconds)") |
1638 "{3} = (x seconds)") |
1639 .format(match.group(1), minutesString, secondsString)) |
1639 .format(match.group(1), minutesString, secondsString)) |
1640 else: |
1640 else: |
1641 self.__addManagementMessage( |
1641 self.__addManagementMessage( |
1642 self.trUtf8("Whois"), |
1642 self.tr("Whois"), |
1643 self.trUtf8( |
1643 self.tr( |
1644 "{0} has been idle for %n second(s).", "", |
1644 "{0} has been idle for %n second(s).", "", |
1645 seconds).format(match.group(1))) |
1645 seconds).format(match.group(1))) |
1646 |
1646 |
1647 if not signonTime.isNull(): |
1647 if not signonTime.isNull(): |
1648 self.__addManagementMessage( |
1648 self.__addManagementMessage( |
1649 self.trUtf8("Whois"), |
1649 self.tr("Whois"), |
1650 self.trUtf8("{0} has been online since {1}.").format( |
1650 self.tr("{0} has been online since {1}.").format( |
1651 match.group(1), |
1651 match.group(1), |
1652 signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) |
1652 signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) |
1653 return True |
1653 return True |
1654 |
1654 |
1655 return False |
1655 return False |