Network/IRC/IrcChannelWidget.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3190
a9a94491c4fd
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
357 Utilities.html_encode(msg))) 357 Utilities.html_encode(msg)))
358 if msg.startswith("/"): 358 if msg.startswith("/"):
359 if self.__private: 359 if self.__private:
360 E5MessageBox.information( 360 E5MessageBox.information(
361 self, 361 self,
362 self.trUtf8("Send Message"), 362 self.tr("Send Message"),
363 self.trUtf8( 363 self.tr(
364 """Messages starting with a '/' are not allowed""" 364 """Messages starting with a '/' are not allowed"""
365 """ in private chats.""")) 365 """ in private chats."""))
366 else: 366 else:
367 msgList = msg.split(None, 1) 367 msgList = msg.split(None, 1)
368 cmd = msgList[0][1:].upper() 368 cmd = msgList[0][1:].upper()
384 """ 384 """
385 Public method to leave the channel. 385 Public method to leave the channel.
386 """ 386 """
387 ok = E5MessageBox.yesNo( 387 ok = E5MessageBox.yesNo(
388 self, 388 self,
389 self.trUtf8("Leave IRC channel"), 389 self.tr("Leave IRC channel"),
390 self.trUtf8( 390 self.tr(
391 """Do you really want to leave the IRC channel <b>{0}</b>?""") 391 """Do you really want to leave the IRC channel <b>{0}</b>?""")
392 .format(self.__name)) 392 .format(self.__name))
393 if ok: 393 if ok:
394 if not self.__private: 394 if not self.__private:
395 self.sendData.emit( 395 self.sendData.emit(
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
692 @param match match object that matched the pattern 692 @param match match object that matched the pattern
693 @return flag indicating whether the message was handled (boolean) 693 @return flag indicating whether the message was handled (boolean)
694 """ 694 """
695 if match.group(1).lower() == self.__name.lower(): 695 if match.group(1).lower() == self.__name.lower():
696 self.__addManagementMessage( 696 self.__addManagementMessage(
697 self.trUtf8("Away"), 697 self.tr("Away"),
698 self.trUtf8("{0} is away: {1}").format( 698 self.tr("{0} is away: {1}").format(
699 match.group(2), match.group(3))) 699 match.group(2), match.group(3)))
700 return True 700 return True
701 701
702 return False 702 return False
703 703
710 """ 710 """
711 if match.group(1).lower() == self.__name.lower(): 711 if match.group(1).lower() == self.__name.lower():
712 self.topicLabel.setText(match.group(2)) 712 self.topicLabel.setText(match.group(2))
713 self.__addManagementMessage( 713 self.__addManagementMessage(
714 IrcChannelWidget.MessageIndicator, 714 IrcChannelWidget.MessageIndicator,
715 ircFilter(self.trUtf8('The channel topic is: "{0}".').format( 715 ircFilter(self.tr('The channel topic is: "{0}".').format(
716 match.group(2)))) 716 match.group(2))))
717 return True 717 return True
718 718
719 return False 719 return False
720 720
726 @return flag indicating whether the message was handled (boolean) 726 @return flag indicating whether the message was handled (boolean)
727 """ 727 """
728 if match.group(1).lower() == self.__name.lower(): 728 if match.group(1).lower() == self.__name.lower():
729 self.__addManagementMessage( 729 self.__addManagementMessage(
730 IrcChannelWidget.MessageIndicator, 730 IrcChannelWidget.MessageIndicator,
731 self.trUtf8("The topic was set by {0} on {1}.").format( 731 self.tr("The topic was set by {0} on {1}.").format(
732 match.group(2), QDateTime.fromTime_t(int(match.group(3))) 732 match.group(2), QDateTime.fromTime_t(int(match.group(3)))
733 .toString("yyyy-MM-dd hh:mm"))) 733 .toString("yyyy-MM-dd hh:mm")))
734 return True 734 return True
735 735
736 return False 736 return False
743 @return flag indicating whether the message was handled (boolean) 743 @return flag indicating whether the message was handled (boolean)
744 """ 744 """
745 if match.group(1).lower() == self.__name.lower(): 745 if match.group(1).lower() == self.__name.lower():
746 self.__addManagementMessage( 746 self.__addManagementMessage(
747 IrcChannelWidget.MessageIndicator, 747 IrcChannelWidget.MessageIndicator,
748 ircFilter(self.trUtf8("Channel URL: {0}").format( 748 ircFilter(self.tr("Channel URL: {0}").format(
749 match.group(2)))) 749 match.group(2))))
750 return True 750 return True
751 751
752 return False 752 return False
753 753
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
795 @return flag indicating whether the message was handled (boolean) 795 @return flag indicating whether the message was handled (boolean)
796 """ 796 """
797 if match.group(1).lower() == self.__name.lower(): 797 if match.group(1).lower() == self.__name.lower():
798 self.__addManagementMessage( 798 self.__addManagementMessage(
799 IrcChannelWidget.MessageIndicator, 799 IrcChannelWidget.MessageIndicator,
800 self.trUtf8("This channel was created on {0}.").format( 800 self.tr("This channel was created on {0}.").format(
801 QDateTime.fromTime_t(int(match.group(2))) 801 QDateTime.fromTime_t(int(match.group(2)))
802 .toString("yyyy-MM-dd hh:mm"))) 802 .toString("yyyy-MM-dd hh:mm")))
803 return True 803 return True
804 804
805 return False 805 return False
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
971 if itm: 971 if itm:
972 itm.changePrivilege(match.group(3)) 972 itm.changePrivilege(match.group(3))
973 self.__setEditTopicButton() 973 self.__setEditTopicButton()
974 self.__addManagementMessage( 974 self.__addManagementMessage(
975 IrcChannelWidget.MessageIndicator, 975 IrcChannelWidget.MessageIndicator,
976 self.trUtf8("{0} sets mode for {1}: {2}.").format( 976 self.tr("{0} sets mode for {1}: {2}.").format(
977 match.group(1), match.group(4), match.group(3))) 977 match.group(1), match.group(4), match.group(3)))
978 return True 978 return True
979 979
980 return False 980 return False
981 981
997 997
998 @param match match object that matched the pattern 998 @param match match object that matched the pattern
999 @return flag indicating whether the message was handled (boolean) 999 @return flag indicating whether the message was handled (boolean)
1000 """ 1000 """
1001 self.__addManagementMessage( 1001 self.__addManagementMessage(
1002 self.trUtf8("Help"), 1002 self.tr("Help"),
1003 "{0} {1}".format(match.group(1), ircFilter(match.group(2)))) 1003 "{0} {1}".format(match.group(1), ircFilter(match.group(2))))
1004 return True 1004 return True
1005 1005
1006 def __handleCtcp(self, match): 1006 def __handleCtcp(self, match):
1007 """ 1007 """
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
1131 self.unsetMarkerLine() 1131 self.unsetMarkerLine()
1132 self.__markerLine = \ 1132 self.__markerLine = \
1133 '<span style=" color:{0}; background-color:{1};">{2}</span>'\ 1133 '<span style=" color:{0}; background-color:{1};">{2}</span>'\
1134 .format(Preferences.getIrc("MarkerLineForegroundColour"), 1134 .format(Preferences.getIrc("MarkerLineForegroundColour"),
1135 Preferences.getIrc("MarkerLineBackgroundColour"), 1135 Preferences.getIrc("MarkerLineBackgroundColour"),
1136 self.trUtf8('--- New From Here ---')) 1136 self.tr('--- New From Here ---'))
1137 self.messages.append(self.__markerLine) 1137 self.messages.append(self.__markerLine)
1138 1138
1139 def unsetMarkerLine(self): 1139 def unsetMarkerLine(self):
1140 """ 1140 """
1141 Public method to remove the marker line. 1141 Public method to remove the marker line.
1196 htmlExtension = "htm" 1196 htmlExtension = "htm"
1197 else: 1197 else:
1198 htmlExtension = "html" 1198 htmlExtension = "html"
1199 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 1199 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
1200 self, 1200 self,
1201 self.trUtf8("Save Messages"), 1201 self.tr("Save Messages"),
1202 "", 1202 "",
1203 self.trUtf8( 1203 self.tr(
1204 "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)") 1204 "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)")
1205 .format(htmlExtension), 1205 .format(htmlExtension),
1206 None, 1206 None,
1207 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 1207 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
1208 if fname: 1208 if fname:
1213 fname += ex 1213 fname += ex
1214 ext = QFileInfo(fname).suffix() 1214 ext = QFileInfo(fname).suffix()
1215 if QFileInfo(fname).exists(): 1215 if QFileInfo(fname).exists():
1216 res = E5MessageBox.yesNo( 1216 res = E5MessageBox.yesNo(
1217 self, 1217 self,
1218 self.trUtf8("Save Messages"), 1218 self.tr("Save Messages"),
1219 self.trUtf8("<p>The file <b>{0}</b> already exists." 1219 self.tr("<p>The file <b>{0}</b> already exists."
1220 " Overwrite it?</p>").format(fname), 1220 " Overwrite it?</p>").format(fname),
1221 icon=E5MessageBox.Warning) 1221 icon=E5MessageBox.Warning)
1222 if not res: 1222 if not res:
1223 return 1223 return
1224 fname = Utilities.toNativeSeparators(fname) 1224 fname = Utilities.toNativeSeparators(fname)
1225 1225
1232 f.write(txt) 1232 f.write(txt)
1233 f.close() 1233 f.close()
1234 except IOError as err: 1234 except IOError as err:
1235 E5MessageBox.critical( 1235 E5MessageBox.critical(
1236 self, 1236 self,
1237 self.trUtf8("Error saving Messages"), 1237 self.tr("Error saving Messages"),
1238 self.trUtf8( 1238 self.tr(
1239 """<p>The messages contents could not be written""" 1239 """<p>The messages contents could not be written"""
1240 """ to <b>{0}</b></p><p>Reason: {1}</p>""") 1240 """ to <b>{0}</b></p><p>Reason: {1}</p>""")
1241 .format(fname, str(err))) 1241 .format(fname, str(err)))
1242 1242
1243 def __initMessagesMenu(self): 1243 def __initMessagesMenu(self):
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.
1412 if self.__autoWhoRequested: 1412 if self.__autoWhoRequested:
1413 self.__autoWhoRequested = False 1413 self.__autoWhoRequested = False
1414 self.initAutoWho() 1414 self.initAutoWho()
1415 else: 1415 else:
1416 self.__addManagementMessage( 1416 self.__addManagementMessage(
1417 self.trUtf8("Who"), 1417 self.tr("Who"),
1418 self.trUtf8("End of WHO list for {0}.").format( 1418 self.tr("End of WHO list for {0}.").format(
1419 match.group(1))) 1419 match.group(1)))
1420 return True 1420 return True
1421 1421
1422 return False 1422 return False
1423 1423
1434 # group(3) host 1434 # group(3) host
1435 # group(4) nick 1435 # group(4) nick
1436 # group(5) user flags 1436 # group(5) user flags
1437 # group(6) real name 1437 # group(6) real name
1438 if match.group(1).lower() == self.__name.lower(): 1438 if match.group(1).lower() == self.__name.lower():
1439 away = self.trUtf8(" (Away)") if match.group(5).startswith("G") \ 1439 away = self.tr(" (Away)") if match.group(5).startswith("G") \
1440 else "" 1440 else ""
1441 self.__addManagementMessage( 1441 self.__addManagementMessage(
1442 self.trUtf8("Who"), 1442 self.tr("Who"),
1443 self.trUtf8("{0} is {1}@{2} ({3}){4}").format( 1443 self.tr("{0} is {1}@{2} ({3}){4}").format(
1444 match.group(4), match.group(2), match.group(3), 1444 match.group(4), match.group(2), match.group(3),
1445 match.group(6), away)) 1445 match.group(6), away))
1446 return True 1446 return True
1447 1447
1448 return False 1448 return False
1459 # group(3) host 1459 # group(3) host
1460 # group(4) real name 1460 # group(4) real name
1461 if match.group(1) == self.__whoIsNick: 1461 if match.group(1) == self.__whoIsNick:
1462 realName = match.group(4).replace("<", "&lt;").replace(">", "&gt;") 1462 realName = match.group(4).replace("<", "&lt;").replace(">", "&gt;")
1463 self.__addManagementMessage( 1463 self.__addManagementMessage(
1464 self.trUtf8("Whois"), 1464 self.tr("Whois"),
1465 self.trUtf8("{0} is {1}@{2} ({3}).").format( 1465 self.tr("{0} is {1}@{2} ({3}).").format(
1466 match.group(1), match.group(2), match.group(3), realName)) 1466 match.group(1), match.group(2), match.group(3), realName))
1467 return True 1467 return True
1468 1468
1469 return False 1469 return False
1470 1470
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
1549 # group(1) nick 1549 # group(1) nick
1550 # group(2) server 1550 # group(2) server
1551 # group(3) server info 1551 # group(3) server info
1552 if match.group(1) == self.__whoIsNick: 1552 if match.group(1) == self.__whoIsNick:
1553 self.__addManagementMessage( 1553 self.__addManagementMessage(
1554 self.trUtf8("Whois"), 1554 self.tr("Whois"),
1555 self.trUtf8("{0} is online via {1} ({2}).").format( 1555 self.tr("{0} is online via {1} ({2}).").format(
1556 match.group(1), match.group(2), match.group(3))) 1556 match.group(1), match.group(2), match.group(3)))
1557 return True 1557 return True
1558 1558
1559 return False 1559 return False
1560 1560
1568 # group(1) nick 1568 # group(1) nick
1569 # group(2) message 1569 # group(2) message
1570 if match.group(1) == self.__whoIsNick: 1570 if match.group(1) == self.__whoIsNick:
1571 if match.group(2).lower().startswith("is an irc operator"): 1571 if match.group(2).lower().startswith("is an irc operator"):
1572 self.__addManagementMessage( 1572 self.__addManagementMessage(
1573 self.trUtf8("Whois"), 1573 self.tr("Whois"),
1574 self.trUtf8("{0} is an IRC Operator.").format( 1574 self.tr("{0} is an IRC Operator.").format(
1575 match.group(1))) 1575 match.group(1)))
1576 else: 1576 else:
1577 self.__addManagementMessage( 1577 self.__addManagementMessage(
1578 self.trUtf8("Whois"), 1578 self.tr("Whois"),
1579 "{0} {1}".format(match.group(1), match.group(2))) 1579 "{0} {1}".format(match.group(1), match.group(2)))
1580 return True 1580 return True
1581 1581
1582 return False 1582 return False
1583 1583
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
1664 # group(1) nick 1664 # group(1) nick
1665 # group(2) end message 1665 # group(2) end message
1666 if match.group(1) == self.__whoIsNick: 1666 if match.group(1) == self.__whoIsNick:
1667 self.__whoIsNick = "" 1667 self.__whoIsNick = ""
1668 self.__addManagementMessage( 1668 self.__addManagementMessage(
1669 self.trUtf8("Whois"), 1669 self.tr("Whois"),
1670 self.trUtf8("End of WHOIS list for {0}.").format( 1670 self.tr("End of WHOIS list for {0}.").format(
1671 match.group(1))) 1671 match.group(1)))
1672 return True 1672 return True
1673 1673
1674 return False 1674 return False
1675 1675
1682 """ 1682 """
1683 # group(1) nick 1683 # group(1) nick
1684 # group(2) identified message 1684 # group(2) identified message
1685 if match.group(1) == self.__whoIsNick: 1685 if match.group(1) == self.__whoIsNick:
1686 self.__addManagementMessage( 1686 self.__addManagementMessage(
1687 self.trUtf8("Whois"), 1687 self.tr("Whois"),
1688 self.trUtf8("{0} is an identified user.").format( 1688 self.tr("{0} is an identified user.").format(
1689 match.group(1))) 1689 match.group(1)))
1690 return True 1690 return True
1691 1691
1692 return False 1692 return False
1693 1693
1700 """ 1700 """
1701 # group(1) nick 1701 # group(1) nick
1702 # group(2) helper message 1702 # group(2) helper message
1703 if match.group(1) == self.__whoIsNick: 1703 if match.group(1) == self.__whoIsNick:
1704 self.__addManagementMessage( 1704 self.__addManagementMessage(
1705 self.trUtf8("Whois"), 1705 self.tr("Whois"),
1706 self.trUtf8("{0} is available for help.").format( 1706 self.tr("{0} is available for help.").format(
1707 match.group(1))) 1707 match.group(1)))
1708 return True 1708 return True
1709 1709
1710 return False 1710 return False
1711 1711
1718 """ 1718 """
1719 # group(1) nick 1719 # group(1) nick
1720 # group(2) login name 1720 # group(2) login name
1721 if match.group(1) == self.__whoIsNick: 1721 if match.group(1) == self.__whoIsNick:
1722 self.__addManagementMessage( 1722 self.__addManagementMessage(
1723 self.trUtf8("Whois"), 1723 self.tr("Whois"),
1724 self.trUtf8("{0} is logged in as {1}.").format( 1724 self.tr("{0} is logged in as {1}.").format(
1725 match.group(1), match.group(2))) 1725 match.group(1), match.group(2)))
1726 return True 1726 return True
1727 1727
1728 return False 1728 return False
1729 1729
1737 # group(1) nick 1737 # group(1) nick
1738 # group(2) actual user@host 1738 # group(2) actual user@host
1739 # group(3) actual IP 1739 # group(3) actual IP
1740 if match.group(1) == self.__whoIsNick: 1740 if match.group(1) == self.__whoIsNick:
1741 self.__addManagementMessage( 1741 self.__addManagementMessage(
1742 self.trUtf8("Whois"), 1742 self.tr("Whois"),
1743 self.trUtf8( 1743 self.tr(
1744 "{0} is actually using the host {1} (IP: {2}).").format( 1744 "{0} is actually using the host {1} (IP: {2}).").format(
1745 match.group(1), match.group(2), match.group(3))) 1745 match.group(1), match.group(2), match.group(3)))
1746 return True 1746 return True
1747 1747
1748 return False 1748 return False
1755 @return flag indicating whether the message was handled (boolean) 1755 @return flag indicating whether the message was handled (boolean)
1756 """ 1756 """
1757 # group(1) nick 1757 # group(1) nick
1758 if match.group(1) == self.__whoIsNick: 1758 if match.group(1) == self.__whoIsNick:
1759 self.__addManagementMessage( 1759 self.__addManagementMessage(
1760 self.trUtf8("Whois"), 1760 self.tr("Whois"),
1761 self.trUtf8("{0} is using a secure connection.").format( 1761 self.tr("{0} is using a secure connection.").format(
1762 match.group(1))) 1762 match.group(1)))
1763 return True 1763 return True
1764 1764
1765 return False 1765 return False
1766 1766
1774 # group(1) nick 1774 # group(1) nick
1775 # group(2) host name 1775 # group(2) host name
1776 # group(3) IP 1776 # group(3) IP
1777 if match.group(1) == self.__whoIsNick: 1777 if match.group(1) == self.__whoIsNick:
1778 self.__addManagementMessage( 1778 self.__addManagementMessage(
1779 self.trUtf8("Whois"), 1779 self.tr("Whois"),
1780 self.trUtf8("{0} is connecting from {1} (IP: {2}).").format( 1780 self.tr("{0} is connecting from {1} (IP: {2}).").format(
1781 match.group(1), match.group(2), match.group(3))) 1781 match.group(1), match.group(2), match.group(3)))
1782 return True 1782 return True
1783 1783
1784 return False 1784 return False
1785 1785
1796 """ 1796 """
1797 Private slot to change the topic of the channel. 1797 Private slot to change the topic of the channel.
1798 """ 1798 """
1799 topic, ok = QInputDialog.getText( 1799 topic, ok = QInputDialog.getText(
1800 self, 1800 self,
1801 self.trUtf8("Edit Channel Topic"), 1801 self.tr("Edit Channel Topic"),
1802 self.trUtf8("Enter the topic for this channel:"), 1802 self.tr("Enter the topic for this channel:"),
1803 QLineEdit.Normal, 1803 QLineEdit.Normal,
1804 self.topicLabel.text()) 1804 self.topicLabel.text())
1805 if ok and topic != "": 1805 if ok and topic != "":
1806 self.sendData.emit("TOPIC {0} :{1}".format( 1806 self.sendData.emit("TOPIC {0} :{1}".format(
1807 self.__name, topic)) 1807 self.__name, topic))

eric ide

mercurial