Network/IRC/IrcChannelWidget.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
355 Utilities.html_encode(msg))) 355 Utilities.html_encode(msg)))
356 if msg.startswith("/"): 356 if msg.startswith("/"):
357 if self.__private: 357 if self.__private:
358 E5MessageBox.information( 358 E5MessageBox.information(
359 self, 359 self,
360 self.trUtf8("Send Message"), 360 self.tr("Send Message"),
361 self.trUtf8( 361 self.tr(
362 """Messages starting with a '/' are not allowed""" 362 """Messages starting with a '/' are not allowed"""
363 """ in private chats.""")) 363 """ in private chats."""))
364 else: 364 else:
365 msgList = msg.split(None, 1) 365 msgList = msg.split(None, 1)
366 cmd = msgList[0][1:].upper() 366 cmd = msgList[0][1:].upper()
382 """ 382 """
383 Public method to leave the channel. 383 Public method to leave the channel.
384 """ 384 """
385 ok = E5MessageBox.yesNo( 385 ok = E5MessageBox.yesNo(
386 self, 386 self,
387 self.trUtf8("Leave IRC channel"), 387 self.tr("Leave IRC channel"),
388 self.trUtf8( 388 self.tr(
389 """Do you really want to leave the IRC channel <b>{0}</b>?""") 389 """Do you really want to leave the IRC channel <b>{0}</b>?""")
390 .format(self.__name)) 390 .format(self.__name))
391 if ok: 391 if ok:
392 if not self.__private: 392 if not self.__private:
393 self.sendData.emit( 393 self.sendData.emit(
523 ircTimestamp(), sender, ircFilter(msg))) 523 ircTimestamp(), sender, ircFilter(msg)))
524 if Preferences.getIrc("ShowNotifications"): 524 if Preferences.getIrc("ShowNotifications"):
525 if Preferences.getIrc("NotifyMessage"): 525 if Preferences.getIrc("NotifyMessage"):
526 self.__ui.showNotification( 526 self.__ui.showNotification(
527 UI.PixmapCache.getPixmap("irc48.png"), 527 UI.PixmapCache.getPixmap("irc48.png"),
528 self.trUtf8("Channel Message"), msg) 528 self.tr("Channel Message"), msg)
529 elif Preferences.getIrc("NotifyNick") and \ 529 elif Preferences.getIrc("NotifyNick") and \
530 self.__userName.lower() in msg.lower(): 530 self.__userName.lower() in msg.lower():
531 self.__ui.showNotification( 531 self.__ui.showNotification(
532 UI.PixmapCache.getPixmap("irc48.png"), 532 UI.PixmapCache.getPixmap("irc48.png"),
533 self.trUtf8("Nick mentioned"), msg) 533 self.tr("Nick mentioned"), msg)
534 534
535 def addUsers(self, users): 535 def addUsers(self, users):
536 """ 536 """
537 Public method to add users to the channel. 537 Public method to add users to the channel.
538 538
551 @return flag indicating whether the message was handled (boolean) 551 @return flag indicating whether the message was handled (boolean)
552 """ 552 """
553 if match.group(3).lower() == self.__name.lower(): 553 if match.group(3).lower() == self.__name.lower():
554 if self.__userName != match.group(1): 554 if self.__userName != match.group(1):
555 IrcUserItem(match.group(1), self.usersList) 555 IrcUserItem(match.group(1), self.usersList)
556 msg = self.trUtf8( 556 msg = self.tr(
557 "{0} has joined the channel {1} ({2}).").format( 557 "{0} has joined the channel {1} ({2}).").format(
558 match.group(1), self.__name, match.group(2)) 558 match.group(1), self.__name, match.group(2))
559 self.__addManagementMessage( 559 self.__addManagementMessage(
560 IrcChannelWidget.JoinIndicator, msg) 560 IrcChannelWidget.JoinIndicator, msg)
561 else: 561 else:
562 msg = self.trUtf8( 562 msg = self.tr(
563 "You have joined the channel {0} ({1}).").format( 563 "You have joined the channel {0} ({1}).").format(
564 self.__name, match.group(2)) 564 self.__name, match.group(2))
565 self.__addManagementMessage( 565 self.__addManagementMessage(
566 IrcChannelWidget.JoinIndicator, msg) 566 IrcChannelWidget.JoinIndicator, msg)
567 if Preferences.getIrc("ShowNotifications") and \ 567 if Preferences.getIrc("ShowNotifications") and \
568 Preferences.getIrc("NotifyJoinPart"): 568 Preferences.getIrc("NotifyJoinPart"):
569 self.__ui.showNotification( 569 self.__ui.showNotification(
570 UI.PixmapCache.getPixmap("irc48.png"), 570 UI.PixmapCache.getPixmap("irc48.png"),
571 self.trUtf8("Join Channel"), msg) 571 self.tr("Join Channel"), msg)
572 return True 572 return True
573 573
574 return False 574 return False
575 575
576 def __userPart(self, match): 576 def __userPart(self, match):
583 if match.group(2).lower() == self.__name.lower(): 583 if match.group(2).lower() == self.__name.lower():
584 itm = self.__findUser(match.group(1)) 584 itm = self.__findUser(match.group(1))
585 self.usersList.takeItem(self.usersList.row(itm)) 585 self.usersList.takeItem(self.usersList.row(itm))
586 del itm 586 del itm
587 if match.lastindex == 2: 587 if match.lastindex == 2:
588 msg = self.trUtf8("{0} has left {1}.").format( 588 msg = self.tr("{0} has left {1}.").format(
589 match.group(1), self.__name) 589 match.group(1), self.__name)
590 nmsg = msg 590 nmsg = msg
591 self.__addManagementMessage( 591 self.__addManagementMessage(
592 IrcChannelWidget.LeaveIndicator, msg) 592 IrcChannelWidget.LeaveIndicator, msg)
593 else: 593 else:
594 msg = self.trUtf8("{0} has left {1}: {2}.").format( 594 msg = self.tr("{0} has left {1}: {2}.").format(
595 match.group(1), self.__name, ircFilter(match.group(3))) 595 match.group(1), self.__name, ircFilter(match.group(3)))
596 nmsg = self.trUtf8("{0} has left {1}: {2}.").format( 596 nmsg = self.tr("{0} has left {1}: {2}.").format(
597 match.group(1), self.__name, match.group(3)) 597 match.group(1), self.__name, match.group(3))
598 self.__addManagementMessage( 598 self.__addManagementMessage(
599 IrcChannelWidget.LeaveIndicator, msg) 599 IrcChannelWidget.LeaveIndicator, msg)
600 if Preferences.getIrc("ShowNotifications") and \ 600 if Preferences.getIrc("ShowNotifications") and \
601 Preferences.getIrc("NotifyJoinPart"): 601 Preferences.getIrc("NotifyJoinPart"):
602 self.__ui.showNotification( 602 self.__ui.showNotification(
603 UI.PixmapCache.getPixmap("irc48.png"), 603 UI.PixmapCache.getPixmap("irc48.png"),
604 self.trUtf8("Leave Channel"), nmsg) 604 self.tr("Leave Channel"), nmsg)
605 return True 605 return True
606 606
607 return False 607 return False
608 608
609 def __userQuit(self, match): 609 def __userQuit(self, match):
616 itm = self.__findUser(match.group(1)) 616 itm = self.__findUser(match.group(1))
617 if itm: 617 if itm:
618 self.usersList.takeItem(self.usersList.row(itm)) 618 self.usersList.takeItem(self.usersList.row(itm))
619 del itm 619 del itm
620 if match.lastindex == 1: 620 if match.lastindex == 1:
621 msg = self.trUtf8("{0} has quit {1}.").format( 621 msg = self.tr("{0} has quit {1}.").format(
622 match.group(1), self.__name) 622 match.group(1), self.__name)
623 self.__addManagementMessage( 623 self.__addManagementMessage(
624 IrcChannelWidget.MessageIndicator, msg) 624 IrcChannelWidget.MessageIndicator, msg)
625 else: 625 else:
626 msg = self.trUtf8("{0} has quit {1}: {2}.").format( 626 msg = self.tr("{0} has quit {1}: {2}.").format(
627 match.group(1), self.__name, ircFilter(match.group(2))) 627 match.group(1), self.__name, ircFilter(match.group(2)))
628 self.__addManagementMessage( 628 self.__addManagementMessage(
629 IrcChannelWidget.MessageIndicator, msg) 629 IrcChannelWidget.MessageIndicator, msg)
630 if Preferences.getIrc("ShowNotifications") and \ 630 if Preferences.getIrc("ShowNotifications") and \
631 Preferences.getIrc("NotifyJoinPart"): 631 Preferences.getIrc("NotifyJoinPart"):
632 self.__ui.showNotification( 632 self.__ui.showNotification(
633 UI.PixmapCache.getPixmap("irc48.png"), 633 UI.PixmapCache.getPixmap("irc48.png"),
634 self.trUtf8("Quit"), msg) 634 self.tr("Quit"), msg)
635 635
636 # always return False for other channels and server to process 636 # always return False for other channels and server to process
637 return False 637 return False
638 638
639 def __userNickChange(self, match): 639 def __userNickChange(self, match):
647 if itm: 647 if itm:
648 itm.setName(match.group(2)) 648 itm.setName(match.group(2))
649 if match.group(1) == self.__userName: 649 if match.group(1) == self.__userName:
650 self.__addManagementMessage( 650 self.__addManagementMessage(
651 IrcChannelWidget.MessageIndicator, 651 IrcChannelWidget.MessageIndicator,
652 self.trUtf8("You are now known as {0}.").format( 652 self.tr("You are now known as {0}.").format(
653 match.group(2))) 653 match.group(2)))
654 self.__userName = match.group(2) 654 self.__userName = match.group(2)
655 else: 655 else:
656 self.__addManagementMessage( 656 self.__addManagementMessage(
657 IrcChannelWidget.MessageIndicator, 657 IrcChannelWidget.MessageIndicator,
658 self.trUtf8("User {0} is now known as {1}.").format( 658 self.tr("User {0} is now known as {1}.").format(
659 match.group(1), match.group(2))) 659 match.group(1), match.group(2)))
660 660
661 # always return False for other channels and server to process 661 # always return False for other channels and server to process
662 return False 662 return False
663 663
690 @param match match object that matched the pattern 690 @param match match object that matched the pattern
691 @return flag indicating whether the message was handled (boolean) 691 @return flag indicating whether the message was handled (boolean)
692 """ 692 """
693 if match.group(1).lower() == self.__name.lower(): 693 if match.group(1).lower() == self.__name.lower():
694 self.__addManagementMessage( 694 self.__addManagementMessage(
695 self.trUtf8("Away"), 695 self.tr("Away"),
696 self.trUtf8("{0} is away: {1}").format( 696 self.tr("{0} is away: {1}").format(
697 match.group(2), match.group(3))) 697 match.group(2), match.group(3)))
698 return True 698 return True
699 699
700 return False 700 return False
701 701
708 """ 708 """
709 if match.group(1).lower() == self.__name.lower(): 709 if match.group(1).lower() == self.__name.lower():
710 self.topicLabel.setText(match.group(2)) 710 self.topicLabel.setText(match.group(2))
711 self.__addManagementMessage( 711 self.__addManagementMessage(
712 IrcChannelWidget.MessageIndicator, 712 IrcChannelWidget.MessageIndicator,
713 ircFilter(self.trUtf8('The channel topic is: "{0}".').format( 713 ircFilter(self.tr('The channel topic is: "{0}".').format(
714 match.group(2)))) 714 match.group(2))))
715 return True 715 return True
716 716
717 return False 717 return False
718 718
724 @return flag indicating whether the message was handled (boolean) 724 @return flag indicating whether the message was handled (boolean)
725 """ 725 """
726 if match.group(1).lower() == self.__name.lower(): 726 if match.group(1).lower() == self.__name.lower():
727 self.__addManagementMessage( 727 self.__addManagementMessage(
728 IrcChannelWidget.MessageIndicator, 728 IrcChannelWidget.MessageIndicator,
729 self.trUtf8("The topic was set by {0} on {1}.").format( 729 self.tr("The topic was set by {0} on {1}.").format(
730 match.group(2), QDateTime.fromTime_t(int(match.group(3))) 730 match.group(2), QDateTime.fromTime_t(int(match.group(3)))
731 .toString("yyyy-MM-dd hh:mm"))) 731 .toString("yyyy-MM-dd hh:mm")))
732 return True 732 return True
733 733
734 return False 734 return False
741 @return flag indicating whether the message was handled (boolean) 741 @return flag indicating whether the message was handled (boolean)
742 """ 742 """
743 if match.group(1).lower() == self.__name.lower(): 743 if match.group(1).lower() == self.__name.lower():
744 self.__addManagementMessage( 744 self.__addManagementMessage(
745 IrcChannelWidget.MessageIndicator, 745 IrcChannelWidget.MessageIndicator,
746 ircFilter(self.trUtf8("Channel URL: {0}").format( 746 ircFilter(self.tr("Channel URL: {0}").format(
747 match.group(2)))) 747 match.group(2))))
748 return True 748 return True
749 749
750 return False 750 return False
751 751
764 for modeChar in modeString: 764 for modeChar in modeString:
765 if modeChar == "+": 765 if modeChar == "+":
766 continue 766 continue
767 elif modeChar == "k": 767 elif modeChar == "k":
768 parameter = modesParameters.pop(0) 768 parameter = modesParameters.pop(0)
769 modes.append(self.trUtf8( 769 modes.append(self.tr(
770 "password protected ({0})").format(parameter)) 770 "password protected ({0})").format(parameter))
771 elif modeChar == "l": 771 elif modeChar == "l":
772 parameter = modesParameters.pop(0) 772 parameter = modesParameters.pop(0)
773 modes.append(self.trUtf8( 773 modes.append(self.tr(
774 "limited to %n user(s)", "", int(parameter))) 774 "limited to %n user(s)", "", int(parameter)))
775 elif modeChar in modesDict: 775 elif modeChar in modesDict:
776 modes.append(modesDict[modeChar]) 776 modes.append(modesDict[modeChar])
777 else: 777 else:
778 modes.append(modeChar) 778 modes.append(modeChar)
779 779
780 self.__addManagementMessage( 780 self.__addManagementMessage(
781 IrcChannelWidget.MessageIndicator, 781 IrcChannelWidget.MessageIndicator,
782 self.trUtf8("Channel modes: {0}.").format(", ".join(modes))) 782 self.tr("Channel modes: {0}.").format(", ".join(modes)))
783 783
784 return True 784 return True
785 785
786 return False 786 return False
787 787
793 @return flag indicating whether the message was handled (boolean) 793 @return flag indicating whether the message was handled (boolean)
794 """ 794 """
795 if match.group(1).lower() == self.__name.lower(): 795 if match.group(1).lower() == self.__name.lower():
796 self.__addManagementMessage( 796 self.__addManagementMessage(
797 IrcChannelWidget.MessageIndicator, 797 IrcChannelWidget.MessageIndicator,
798 self.trUtf8("This channel was created on {0}.").format( 798 self.tr("This channel was created on {0}.").format(
799 QDateTime.fromTime_t(int(match.group(2))) 799 QDateTime.fromTime_t(int(match.group(2)))
800 .toString("yyyy-MM-dd hh:mm"))) 800 .toString("yyyy-MM-dd hh:mm")))
801 return True 801 return True
802 802
803 return False 803 return False
825 elif mode == "-": 825 elif mode == "-":
826 isPlus = False 826 isPlus = False
827 continue 827 continue
828 elif mode == "a": 828 elif mode == "a":
829 if isPlus: 829 if isPlus:
830 message = self.trUtf8( 830 message = self.tr(
831 "{0} sets the channel mode to 'anonymous'.")\ 831 "{0} sets the channel mode to 'anonymous'.")\
832 .format(nick) 832 .format(nick)
833 else: 833 else:
834 message = self.trUtf8( 834 message = self.tr(
835 "{0} removes the 'anonymous' mode from the" 835 "{0} removes the 'anonymous' mode from the"
836 " channel.").format(nick) 836 " channel.").format(nick)
837 elif mode == "b": 837 elif mode == "b":
838 if isPlus: 838 if isPlus:
839 message = self.trUtf8( 839 message = self.tr(
840 "{0} sets a ban on {1}.").format( 840 "{0} sets a ban on {1}.").format(
841 nick, modesParameters.pop(0)) 841 nick, modesParameters.pop(0))
842 else: 842 else:
843 message = self.trUtf8( 843 message = self.tr(
844 "{0} removes the ban on {1}.").format( 844 "{0} removes the ban on {1}.").format(
845 nick, modesParameters.pop(0)) 845 nick, modesParameters.pop(0))
846 elif mode == "c": 846 elif mode == "c":
847 if isPlus: 847 if isPlus:
848 message = self.trUtf8( 848 message = self.tr(
849 "{0} sets the channel mode to 'no colors" 849 "{0} sets the channel mode to 'no colors"
850 " allowed'.").format(nick) 850 " allowed'.").format(nick)
851 else: 851 else:
852 message = self.trUtf8( 852 message = self.tr(
853 "{0} sets the channel mode to 'allow color" 853 "{0} sets the channel mode to 'allow color"
854 " codes'.").format(nick) 854 " codes'.").format(nick)
855 elif mode == "e": 855 elif mode == "e":
856 if isPlus: 856 if isPlus:
857 message = self.trUtf8( 857 message = self.tr(
858 "{0} sets a ban exception on {1}.").format( 858 "{0} sets a ban exception on {1}.").format(
859 nick, modesParameters.pop(0)) 859 nick, modesParameters.pop(0))
860 else: 860 else:
861 message = self.trUtf8( 861 message = self.tr(
862 "{0} removes the ban exception on {1}.").format( 862 "{0} removes the ban exception on {1}.").format(
863 nick, modesParameters.pop(0)) 863 nick, modesParameters.pop(0))
864 elif mode == "i": 864 elif mode == "i":
865 if isPlus: 865 if isPlus:
866 message = self.trUtf8( 866 message = self.tr(
867 "{0} sets the channel mode to 'invite only'.")\ 867 "{0} sets the channel mode to 'invite only'.")\
868 .format(nick) 868 .format(nick)
869 else: 869 else:
870 message = self.trUtf8( 870 message = self.tr(
871 "{0} removes the 'invite only' mode from the" 871 "{0} removes the 'invite only' mode from the"
872 " channel.").format(nick) 872 " channel.").format(nick)
873 elif mode == "k": 873 elif mode == "k":
874 if isPlus: 874 if isPlus:
875 message = self.trUtf8( 875 message = self.tr(
876 "{0} sets the channel key to '{1}'.").format( 876 "{0} sets the channel key to '{1}'.").format(
877 nick, modesParameters.pop(0)) 877 nick, modesParameters.pop(0))
878 else: 878 else:
879 message = self.trUtf8( 879 message = self.tr(
880 "{0} removes the channel key.").format(nick) 880 "{0} removes the channel key.").format(nick)
881 elif mode == "l": 881 elif mode == "l":
882 if isPlus: 882 if isPlus:
883 message = self.trUtf8( 883 message = self.tr(
884 "{0} sets the channel limit to %n nick(s).", "", 884 "{0} sets the channel limit to %n nick(s).", "",
885 int(modesParameters.pop(0))).format(nick) 885 int(modesParameters.pop(0))).format(nick)
886 else: 886 else:
887 message = self.trUtf8( 887 message = self.tr(
888 "{0} removes the channel limit.").format(nick) 888 "{0} removes the channel limit.").format(nick)
889 elif mode == "m": 889 elif mode == "m":
890 if isPlus: 890 if isPlus:
891 message = self.trUtf8( 891 message = self.tr(
892 "{0} sets the channel mode to 'moderated'.")\ 892 "{0} sets the channel mode to 'moderated'.")\
893 .format(nick) 893 .format(nick)
894 else: 894 else:
895 message = self.trUtf8( 895 message = self.tr(
896 "{0} sets the channel mode to 'unmoderated'.")\ 896 "{0} sets the channel mode to 'unmoderated'.")\
897 .format(nick) 897 .format(nick)
898 elif mode == "n": 898 elif mode == "n":
899 if isPlus: 899 if isPlus:
900 message = self.trUtf8( 900 message = self.tr(
901 "{0} sets the channel mode to 'no messages from" 901 "{0} sets the channel mode to 'no messages from"
902 " outside'.").format(nick) 902 " outside'.").format(nick)
903 else: 903 else:
904 message = self.trUtf8( 904 message = self.tr(
905 "{0} sets the channel mode to 'allow messages" 905 "{0} sets the channel mode to 'allow messages"
906 " from outside'.").format(nick) 906 " from outside'.").format(nick)
907 elif mode == "p": 907 elif mode == "p":
908 if isPlus: 908 if isPlus:
909 message = self.trUtf8( 909 message = self.tr(
910 "{0} sets the channel mode to 'private'.")\ 910 "{0} sets the channel mode to 'private'.")\
911 .format(nick) 911 .format(nick)
912 else: 912 else:
913 message = self.trUtf8( 913 message = self.tr(
914 "{0} sets the channel mode to 'public'.")\ 914 "{0} sets the channel mode to 'public'.")\
915 .format(nick) 915 .format(nick)
916 elif mode == "q": 916 elif mode == "q":
917 if isPlus: 917 if isPlus:
918 message = self.trUtf8( 918 message = self.tr(
919 "{0} sets the channel mode to 'quiet'.")\ 919 "{0} sets the channel mode to 'quiet'.")\
920 .format(nick) 920 .format(nick)
921 else: 921 else:
922 message = self.trUtf8( 922 message = self.tr(
923 "{0} removes the 'quiet' mode from the channel.")\ 923 "{0} removes the 'quiet' mode from the channel.")\
924 .format(nick) 924 .format(nick)
925 elif mode == "r": 925 elif mode == "r":
926 continue 926 continue
927 elif mode == "s": 927 elif mode == "s":
928 if isPlus: 928 if isPlus:
929 message = self.trUtf8( 929 message = self.tr(
930 "{0} sets the channel mode to 'secret'.")\ 930 "{0} sets the channel mode to 'secret'.")\
931 .format(nick) 931 .format(nick)
932 else: 932 else:
933 message = self.trUtf8( 933 message = self.tr(
934 "{0} sets the channel mode to 'visible'.")\ 934 "{0} sets the channel mode to 'visible'.")\
935 .format(nick) 935 .format(nick)
936 elif mode == "t": 936 elif mode == "t":
937 if isPlus: 937 if isPlus:
938 message = self.trUtf8( 938 message = self.tr(
939 "{0} switches on 'topic protection'.").format(nick) 939 "{0} switches on 'topic protection'.").format(nick)
940 else: 940 else:
941 message = self.trUtf8( 941 message = self.tr(
942 "{0} switches off 'topic protection'.")\ 942 "{0} switches off 'topic protection'.")\
943 .format(nick) 943 .format(nick)
944 elif mode == "I": 944 elif mode == "I":
945 if isPlus: 945 if isPlus:
946 message = self.trUtf8( 946 message = self.tr(
947 "{0} sets invitation mask {1}.").format( 947 "{0} sets invitation mask {1}.").format(
948 nick, modesParameters.pop(0)) 948 nick, modesParameters.pop(0))
949 else: 949 else:
950 message = self.trUtf8( 950 message = self.tr(
951 "{0} removes the invitation mask {1}.").format( 951 "{0} removes the invitation mask {1}.").format(
952 nick, modesParameters.pop(0)) 952 nick, modesParameters.pop(0))
953 953
954 self.__addManagementMessage(self.trUtf8("Mode"), message) 954 self.__addManagementMessage(self.tr("Mode"), message)
955 955
956 return True 956 return True
957 957
958 return False 958 return False
959 959
969 if itm: 969 if itm:
970 itm.changePrivilege(match.group(3)) 970 itm.changePrivilege(match.group(3))
971 self.__setEditTopicButton() 971 self.__setEditTopicButton()
972 self.__addManagementMessage( 972 self.__addManagementMessage(
973 IrcChannelWidget.MessageIndicator, 973 IrcChannelWidget.MessageIndicator,
974 self.trUtf8("{0} sets mode for {1}: {2}.").format( 974 self.tr("{0} sets mode for {1}: {2}.").format(
975 match.group(1), match.group(4), match.group(3))) 975 match.group(1), match.group(4), match.group(3)))
976 return True 976 return True
977 977
978 return False 978 return False
979 979
995 995
996 @param match match object that matched the pattern 996 @param match match object that matched the pattern
997 @return flag indicating whether the message was handled (boolean) 997 @return flag indicating whether the message was handled (boolean)
998 """ 998 """
999 self.__addManagementMessage( 999 self.__addManagementMessage(
1000 self.trUtf8("Help"), 1000 self.tr("Help"),
1001 "{0} {1}".format(match.group(1), ircFilter(match.group(2)))) 1001 "{0} {1}".format(match.group(1), ircFilter(match.group(2))))
1002 return True 1002 return True
1003 1003
1004 def __handleCtcp(self, match): 1004 def __handleCtcp(self, match):
1005 """ 1005 """
1020 ctcpRequest, ctcpArg = ctcpCommand, "" 1020 ctcpRequest, ctcpArg = ctcpCommand, ""
1021 ctcpRequest = ctcpRequest.lower() 1021 ctcpRequest = ctcpRequest.lower()
1022 if ctcpRequest == "version": 1022 if ctcpRequest == "version":
1023 msg = "Eric IRC client {0}, {1}".format(Version, Copyright) 1023 msg = "Eric IRC client {0}, {1}".format(Version, Copyright)
1024 self.__addManagementMessage( 1024 self.__addManagementMessage(
1025 self.trUtf8("CTCP"), 1025 self.tr("CTCP"),
1026 self.trUtf8("Received Version request from {0}.").format( 1026 self.tr("Received Version request from {0}.").format(
1027 match.group(1))) 1027 match.group(1)))
1028 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg) 1028 self.sendCtcpReply.emit(match.group(1), "VERSION " + msg)
1029 elif ctcpRequest == "ping": 1029 elif ctcpRequest == "ping":
1030 self.__addManagementMessage( 1030 self.__addManagementMessage(
1031 self.trUtf8("CTCP"), 1031 self.tr("CTCP"),
1032 self.trUtf8( 1032 self.tr(
1033 "Received CTCP-PING request from {0}," 1033 "Received CTCP-PING request from {0},"
1034 " sending answer.").format(match.group(1))) 1034 " sending answer.").format(match.group(1)))
1035 self.sendCtcpReply.emit( 1035 self.sendCtcpReply.emit(
1036 match.group(1), "PING {0}".format(ctcpArg)) 1036 match.group(1), "PING {0}".format(ctcpArg))
1037 elif ctcpRequest == "clientinfo": 1037 elif ctcpRequest == "clientinfo":
1038 self.__addManagementMessage( 1038 self.__addManagementMessage(
1039 self.trUtf8("CTCP"), 1039 self.tr("CTCP"),
1040 self.trUtf8( 1040 self.tr(
1041 "Received CTCP-CLIENTINFO request from {0}," 1041 "Received CTCP-CLIENTINFO request from {0},"
1042 " sending answer.").format(match.group(1))) 1042 " sending answer.").format(match.group(1)))
1043 self.sendCtcpReply.emit( 1043 self.sendCtcpReply.emit(
1044 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION") 1044 match.group(1), "CLIENTINFO CLIENTINFO PING VERSION")
1045 else: 1045 else:
1046 self.__addManagementMessage( 1046 self.__addManagementMessage(
1047 self.trUtf8("CTCP"), 1047 self.tr("CTCP"),
1048 self.trUtf8("Received unknown CTCP-{0} request from {1}.") 1048 self.tr("Received unknown CTCP-{0} request from {1}.")
1049 .format(ctcpRequest, match.group(1))) 1049 .format(ctcpRequest, match.group(1)))
1050 return True 1050 return True
1051 1051
1052 return False 1052 return False
1053 1053
1129 self.unsetMarkerLine() 1129 self.unsetMarkerLine()
1130 self.__markerLine = \ 1130 self.__markerLine = \
1131 '<span style=" color:{0}; background-color:{1};">{2}</span>'\ 1131 '<span style=" color:{0}; background-color:{1};">{2}</span>'\
1132 .format(Preferences.getIrc("MarkerLineForegroundColour"), 1132 .format(Preferences.getIrc("MarkerLineForegroundColour"),
1133 Preferences.getIrc("MarkerLineBackgroundColour"), 1133 Preferences.getIrc("MarkerLineBackgroundColour"),
1134 self.trUtf8('--- New From Here ---')) 1134 self.tr('--- New From Here ---'))
1135 self.messages.append(self.__markerLine) 1135 self.messages.append(self.__markerLine)
1136 1136
1137 def unsetMarkerLine(self): 1137 def unsetMarkerLine(self):
1138 """ 1138 """
1139 Public method to remove the marker line. 1139 Public method to remove the marker line.
1194 htmlExtension = "htm" 1194 htmlExtension = "htm"
1195 else: 1195 else:
1196 htmlExtension = "html" 1196 htmlExtension = "html"
1197 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 1197 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
1198 self, 1198 self,
1199 self.trUtf8("Save Messages"), 1199 self.tr("Save Messages"),
1200 "", 1200 "",
1201 self.trUtf8( 1201 self.tr(
1202 "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)") 1202 "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)")
1203 .format(htmlExtension), 1203 .format(htmlExtension),
1204 None, 1204 None,
1205 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 1205 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
1206 if fname: 1206 if fname:
1211 fname += ex 1211 fname += ex
1212 ext = QFileInfo(fname).suffix() 1212 ext = QFileInfo(fname).suffix()
1213 if QFileInfo(fname).exists(): 1213 if QFileInfo(fname).exists():
1214 res = E5MessageBox.yesNo( 1214 res = E5MessageBox.yesNo(
1215 self, 1215 self,
1216 self.trUtf8("Save Messages"), 1216 self.tr("Save Messages"),
1217 self.trUtf8("<p>The file <b>{0}</b> already exists." 1217 self.tr("<p>The file <b>{0}</b> already exists."
1218 " Overwrite it?</p>").format(fname), 1218 " Overwrite it?</p>").format(fname),
1219 icon=E5MessageBox.Warning) 1219 icon=E5MessageBox.Warning)
1220 if not res: 1220 if not res:
1221 return 1221 return
1222 fname = Utilities.toNativeSeparators(fname) 1222 fname = Utilities.toNativeSeparators(fname)
1223 1223
1230 f.write(txt) 1230 f.write(txt)
1231 f.close() 1231 f.close()
1232 except IOError as err: 1232 except IOError as err:
1233 E5MessageBox.critical( 1233 E5MessageBox.critical(
1234 self, 1234 self,
1235 self.trUtf8("Error saving Messages"), 1235 self.tr("Error saving Messages"),
1236 self.trUtf8( 1236 self.tr(
1237 """<p>The messages contents could not be written""" 1237 """<p>The messages contents could not be written"""
1238 """ to <b>{0}</b></p><p>Reason: {1}</p>""") 1238 """ to <b>{0}</b></p><p>Reason: {1}</p>""")
1239 .format(fname, str(err))) 1239 .format(fname, str(err)))
1240 1240
1241 def __initMessagesMenu(self): 1241 def __initMessagesMenu(self):
1244 """ 1244 """
1245 self.__messagesMenu = QMenu(self) 1245 self.__messagesMenu = QMenu(self)
1246 self.__copyMessagesAct = \ 1246 self.__copyMessagesAct = \
1247 self.__messagesMenu.addAction( 1247 self.__messagesMenu.addAction(
1248 UI.PixmapCache.getIcon("editCopy.png"), 1248 UI.PixmapCache.getIcon("editCopy.png"),
1249 self.trUtf8("Copy"), self.__copyMessages) 1249 self.tr("Copy"), self.__copyMessages)
1250 self.__messagesMenu.addSeparator() 1250 self.__messagesMenu.addSeparator()
1251 self.__cutAllMessagesAct = \ 1251 self.__cutAllMessagesAct = \
1252 self.__messagesMenu.addAction( 1252 self.__messagesMenu.addAction(
1253 UI.PixmapCache.getIcon("editCut.png"), 1253 UI.PixmapCache.getIcon("editCut.png"),
1254 self.trUtf8("Cut all"), self.__cutAllMessages) 1254 self.tr("Cut all"), self.__cutAllMessages)
1255 self.__copyAllMessagesAct = \ 1255 self.__copyAllMessagesAct = \
1256 self.__messagesMenu.addAction( 1256 self.__messagesMenu.addAction(
1257 UI.PixmapCache.getIcon("editCopy.png"), 1257 UI.PixmapCache.getIcon("editCopy.png"),
1258 self.trUtf8("Copy all"), self.__copyAllMessages) 1258 self.tr("Copy all"), self.__copyAllMessages)
1259 self.__messagesMenu.addSeparator() 1259 self.__messagesMenu.addSeparator()
1260 self.__clearMessagesAct = \ 1260 self.__clearMessagesAct = \
1261 self.__messagesMenu.addAction( 1261 self.__messagesMenu.addAction(
1262 UI.PixmapCache.getIcon("editDelete.png"), 1262 UI.PixmapCache.getIcon("editDelete.png"),
1263 self.trUtf8("Clear"), self.__clearMessages) 1263 self.tr("Clear"), self.__clearMessages)
1264 self.__messagesMenu.addSeparator() 1264 self.__messagesMenu.addSeparator()
1265 self.__saveMessagesAct = \ 1265 self.__saveMessagesAct = \
1266 self.__messagesMenu.addAction( 1266 self.__messagesMenu.addAction(
1267 UI.PixmapCache.getIcon("fileSave.png"), 1267 UI.PixmapCache.getIcon("fileSave.png"),
1268 self.trUtf8("Save"), self.__saveMessages) 1268 self.tr("Save"), self.__saveMessages)
1269 self.__messagesMenu.addSeparator() 1269 self.__messagesMenu.addSeparator()
1270 self.__setMarkerMessagesAct = self.__messagesMenu.addAction( 1270 self.__setMarkerMessagesAct = self.__messagesMenu.addAction(
1271 self.trUtf8("Mark Current Position"), self.setMarkerLine) 1271 self.tr("Mark Current Position"), self.setMarkerLine)
1272 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction( 1272 self.__unsetMarkerMessagesAct = self.__messagesMenu.addAction(
1273 self.trUtf8("Remove Position Marker"), 1273 self.tr("Remove Position Marker"),
1274 self.unsetMarkerLine) 1274 self.unsetMarkerLine)
1275 1275
1276 self.on_messages_copyAvailable(False) 1276 self.on_messages_copyAvailable(False)
1277 1277
1278 @pyqtSlot(bool) 1278 @pyqtSlot(bool)
1318 """ 1318 """
1319 Private slot to initialize the users list context menu. 1319 Private slot to initialize the users list context menu.
1320 """ 1320 """
1321 self.__usersMenu = QMenu(self) 1321 self.__usersMenu = QMenu(self)
1322 self.__whoIsAct = self.__usersMenu.addAction( 1322 self.__whoIsAct = self.__usersMenu.addAction(
1323 self.trUtf8("Who Is"), self.__whoIs) 1323 self.tr("Who Is"), self.__whoIs)
1324 self.__usersMenu.addSeparator() 1324 self.__usersMenu.addSeparator()
1325 self.__privateChatAct = self.__usersMenu.addAction( 1325 self.__privateChatAct = self.__usersMenu.addAction(
1326 self.trUtf8("Private Chat"), self.__openPrivateChat) 1326 self.tr("Private Chat"), self.__openPrivateChat)
1327 self.__usersMenu.addSeparator() 1327 self.__usersMenu.addSeparator()
1328 self.__usersListRefreshAct = self.__usersMenu.addAction( 1328 self.__usersListRefreshAct = self.__usersMenu.addAction(
1329 self.trUtf8("Refresh"), self.__sendAutoWhoCommand) 1329 self.tr("Refresh"), self.__sendAutoWhoCommand)
1330 1330
1331 @pyqtSlot(QPoint) 1331 @pyqtSlot(QPoint)
1332 def on_usersList_customContextMenuRequested(self, pos): 1332 def on_usersList_customContextMenuRequested(self, pos):
1333 """ 1333 """
1334 Private slot to show the context menu of the users list. 1334 Private slot to show the context menu of the users list.
1410 if self.__autoWhoRequested: 1410 if self.__autoWhoRequested:
1411 self.__autoWhoRequested = False 1411 self.__autoWhoRequested = False
1412 self.initAutoWho() 1412 self.initAutoWho()
1413 else: 1413 else:
1414 self.__addManagementMessage( 1414 self.__addManagementMessage(
1415 self.trUtf8("Who"), 1415 self.tr("Who"),
1416 self.trUtf8("End of WHO list for {0}.").format( 1416 self.tr("End of WHO list for {0}.").format(
1417 match.group(1))) 1417 match.group(1)))
1418 return True 1418 return True
1419 1419
1420 return False 1420 return False
1421 1421
1432 # group(3) host 1432 # group(3) host
1433 # group(4) nick 1433 # group(4) nick
1434 # group(5) user flags 1434 # group(5) user flags
1435 # group(6) real name 1435 # group(6) real name
1436 if match.group(1).lower() == self.__name.lower(): 1436 if match.group(1).lower() == self.__name.lower():
1437 away = self.trUtf8(" (Away)") if match.group(5).startswith("G") \ 1437 away = self.tr(" (Away)") if match.group(5).startswith("G") \
1438 else "" 1438 else ""
1439 self.__addManagementMessage( 1439 self.__addManagementMessage(
1440 self.trUtf8("Who"), 1440 self.tr("Who"),
1441 self.trUtf8("{0} is {1}@{2} ({3}){4}").format( 1441 self.tr("{0} is {1}@{2} ({3}){4}").format(
1442 match.group(4), match.group(2), match.group(3), 1442 match.group(4), match.group(2), match.group(3),
1443 match.group(6), away)) 1443 match.group(6), away))
1444 return True 1444 return True
1445 1445
1446 return False 1446 return False
1457 # group(3) host 1457 # group(3) host
1458 # group(4) real name 1458 # group(4) real name
1459 if match.group(1) == self.__whoIsNick: 1459 if match.group(1) == self.__whoIsNick:
1460 realName = match.group(4).replace("<", "&lt;").replace(">", "&gt;") 1460 realName = match.group(4).replace("<", "&lt;").replace(">", "&gt;")
1461 self.__addManagementMessage( 1461 self.__addManagementMessage(
1462 self.trUtf8("Whois"), 1462 self.tr("Whois"),
1463 self.trUtf8("{0} is {1}@{2} ({3}).").format( 1463 self.tr("{0} is {1}@{2} ({3}).").format(
1464 match.group(1), match.group(2), match.group(3), realName)) 1464 match.group(1), match.group(2), match.group(3), realName))
1465 return True 1465 return True
1466 1466
1467 return False 1467 return False
1468 1468
1503 userChannels.append(channel) 1503 userChannels.append(channel)
1504 1504
1505 # show messages 1505 # show messages
1506 if userChannels: 1506 if userChannels:
1507 self.__addManagementMessage( 1507 self.__addManagementMessage(
1508 self.trUtf8("Whois"), 1508 self.tr("Whois"),
1509 self.trUtf8("{0} is a user on channels: {1}").format( 1509 self.tr("{0} is a user on channels: {1}").format(
1510 match.group(1), " ".join(userChannels))) 1510 match.group(1), " ".join(userChannels)))
1511 if voiceChannels: 1511 if voiceChannels:
1512 self.__addManagementMessage( 1512 self.__addManagementMessage(
1513 self.trUtf8("Whois"), 1513 self.tr("Whois"),
1514 self.trUtf8("{0} has voice on channels: {1}").format( 1514 self.tr("{0} has voice on channels: {1}").format(
1515 match.group(1), " ".join(voiceChannels))) 1515 match.group(1), " ".join(voiceChannels)))
1516 if halfopChannels: 1516 if halfopChannels:
1517 self.__addManagementMessage( 1517 self.__addManagementMessage(
1518 self.trUtf8("Whois"), 1518 self.tr("Whois"),
1519 self.trUtf8("{0} is a halfop on channels: {1}").format( 1519 self.tr("{0} is a halfop on channels: {1}").format(
1520 match.group(1), " ".join(halfopChannels))) 1520 match.group(1), " ".join(halfopChannels)))
1521 if opChannels: 1521 if opChannels:
1522 self.__addManagementMessage( 1522 self.__addManagementMessage(
1523 self.trUtf8("Whois"), 1523 self.tr("Whois"),
1524 self.trUtf8("{0} is an operator on channels: {1}").format( 1524 self.tr("{0} is an operator on channels: {1}").format(
1525 match.group(1), " ".join(opChannels))) 1525 match.group(1), " ".join(opChannels)))
1526 if ownerChannels: 1526 if ownerChannels:
1527 self.__addManagementMessage( 1527 self.__addManagementMessage(
1528 self.trUtf8("Whois"), 1528 self.tr("Whois"),
1529 self.trUtf8("{0} is owner of channels: {1}").format( 1529 self.tr("{0} is owner of channels: {1}").format(
1530 match.group(1), " ".join(ownerChannels))) 1530 match.group(1), " ".join(ownerChannels)))
1531 if adminChannels: 1531 if adminChannels:
1532 self.__addManagementMessage( 1532 self.__addManagementMessage(
1533 self.trUtf8("Whois"), 1533 self.tr("Whois"),
1534 self.trUtf8("{0} is admin on channels: {1}").format( 1534 self.tr("{0} is admin on channels: {1}").format(
1535 match.group(1), " ".join(adminChannels))) 1535 match.group(1), " ".join(adminChannels)))
1536 return True 1536 return True
1537 1537
1538 return False 1538 return False
1539 1539
1547 # group(1) nick 1547 # group(1) nick
1548 # group(2) server 1548 # group(2) server
1549 # group(3) server info 1549 # group(3) server info
1550 if match.group(1) == self.__whoIsNick: 1550 if match.group(1) == self.__whoIsNick:
1551 self.__addManagementMessage( 1551 self.__addManagementMessage(
1552 self.trUtf8("Whois"), 1552 self.tr("Whois"),
1553 self.trUtf8("{0} is online via {1} ({2}).").format( 1553 self.tr("{0} is online via {1} ({2}).").format(
1554 match.group(1), match.group(2), match.group(3))) 1554 match.group(1), match.group(2), match.group(3)))
1555 return True 1555 return True
1556 1556
1557 return False 1557 return False
1558 1558
1566 # group(1) nick 1566 # group(1) nick
1567 # group(2) message 1567 # group(2) message
1568 if match.group(1) == self.__whoIsNick: 1568 if match.group(1) == self.__whoIsNick:
1569 if match.group(2).lower().startswith("is an irc operator"): 1569 if match.group(2).lower().startswith("is an irc operator"):
1570 self.__addManagementMessage( 1570 self.__addManagementMessage(
1571 self.trUtf8("Whois"), 1571 self.tr("Whois"),
1572 self.trUtf8("{0} is an IRC Operator.").format( 1572 self.tr("{0} is an IRC Operator.").format(
1573 match.group(1))) 1573 match.group(1)))
1574 else: 1574 else:
1575 self.__addManagementMessage( 1575 self.__addManagementMessage(
1576 self.trUtf8("Whois"), 1576 self.tr("Whois"),
1577 "{0} {1}".format(match.group(1), match.group(2))) 1577 "{0} {1}".format(match.group(1), match.group(2)))
1578 return True 1578 return True
1579 1579
1580 return False 1580 return False
1581 1581
1598 signonTimestamp = int(match.group(3)) 1598 signonTimestamp = int(match.group(3))
1599 signonTime = QDateTime() 1599 signonTime = QDateTime()
1600 signonTime.setTime_t(signonTimestamp) 1600 signonTime.setTime_t(signonTimestamp)
1601 1601
1602 if days: 1602 if days:
1603 daysString = self.trUtf8("%n day(s)", "", days) 1603 daysString = self.tr("%n day(s)", "", days)
1604 hoursString = self.trUtf8("%n hour(s)", "", hours) 1604 hoursString = self.tr("%n hour(s)", "", hours)
1605 minutesString = self.trUtf8("%n minute(s)", "", minutes) 1605 minutesString = self.tr("%n minute(s)", "", minutes)
1606 secondsString = self.trUtf8("%n second(s)", "", seconds) 1606 secondsString = self.tr("%n second(s)", "", seconds)
1607 self.__addManagementMessage( 1607 self.__addManagementMessage(
1608 self.trUtf8("Whois"), 1608 self.tr("Whois"),
1609 self.trUtf8( 1609 self.tr(
1610 "{0} has been idle for {1}, {2}, {3}, and {4}.", 1610 "{0} has been idle for {1}, {2}, {3}, and {4}.",
1611 "{0} = name of person, {1} = (x days)," 1611 "{0} = name of person, {1} = (x days),"
1612 " {2} = (x hours), {3} = (x minutes)," 1612 " {2} = (x hours), {3} = (x minutes),"
1613 " {4} = (x seconds)").format( 1613 " {4} = (x seconds)").format(
1614 match.group(1), daysString, hoursString, minutesString, 1614 match.group(1), daysString, hoursString, minutesString,
1615 secondsString)) 1615 secondsString))
1616 elif hours: 1616 elif hours:
1617 hoursString = self.trUtf8("%n hour(s)", "", hours) 1617 hoursString = self.tr("%n hour(s)", "", hours)
1618 minutesString = self.trUtf8("%n minute(s)", "", minutes) 1618 minutesString = self.tr("%n minute(s)", "", minutes)
1619 secondsString = self.trUtf8("%n second(s)", "", seconds) 1619 secondsString = self.tr("%n second(s)", "", seconds)
1620 self.__addManagementMessage( 1620 self.__addManagementMessage(
1621 self.trUtf8("Whois"), 1621 self.tr("Whois"),
1622 self.trUtf8( 1622 self.tr(
1623 "{0} has been idle for {1}, {2}, and {3}.", 1623 "{0} has been idle for {1}, {2}, and {3}.",
1624 "{0} = name of person, {1} = (x hours), " 1624 "{0} = name of person, {1} = (x hours), "
1625 "{2} = (x minutes), {3} = (x seconds)") 1625 "{2} = (x minutes), {3} = (x seconds)")
1626 .format(match.group(1), hoursString, minutesString, 1626 .format(match.group(1), hoursString, minutesString,
1627 secondsString)) 1627 secondsString))
1628 elif minutes: 1628 elif minutes:
1629 minutesString = self.trUtf8("%n minute(s)", "", minutes) 1629 minutesString = self.tr("%n minute(s)", "", minutes)
1630 secondsString = self.trUtf8("%n second(s)", "", seconds) 1630 secondsString = self.tr("%n second(s)", "", seconds)
1631 self.__addManagementMessage( 1631 self.__addManagementMessage(
1632 self.trUtf8("Whois"), 1632 self.tr("Whois"),
1633 self.trUtf8( 1633 self.tr(
1634 "{0} has been idle for {1} and {2}.", 1634 "{0} has been idle for {1} and {2}.",
1635 "{0} = name of person, {1} = (x minutes), " 1635 "{0} = name of person, {1} = (x minutes), "
1636 "{3} = (x seconds)") 1636 "{3} = (x seconds)")
1637 .format(match.group(1), minutesString, secondsString)) 1637 .format(match.group(1), minutesString, secondsString))
1638 else: 1638 else:
1639 self.__addManagementMessage( 1639 self.__addManagementMessage(
1640 self.trUtf8("Whois"), 1640 self.tr("Whois"),
1641 self.trUtf8( 1641 self.tr(
1642 "{0} has been idle for %n second(s).", "", 1642 "{0} has been idle for %n second(s).", "",
1643 seconds).format(match.group(1))) 1643 seconds).format(match.group(1)))
1644 1644
1645 if not signonTime.isNull(): 1645 if not signonTime.isNull():
1646 self.__addManagementMessage( 1646 self.__addManagementMessage(
1647 self.trUtf8("Whois"), 1647 self.tr("Whois"),
1648 self.trUtf8("{0} has been online since {1}.").format( 1648 self.tr("{0} has been online since {1}.").format(
1649 match.group(1), 1649 match.group(1),
1650 signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) 1650 signonTime.toString("yyyy-MM-dd, hh:mm:ss")))
1651 return True 1651 return True
1652 1652
1653 return False 1653 return False
1662 # group(1) nick 1662 # group(1) nick
1663 # group(2) end message 1663 # group(2) end message
1664 if match.group(1) == self.__whoIsNick: 1664 if match.group(1) == self.__whoIsNick:
1665 self.__whoIsNick = "" 1665 self.__whoIsNick = ""
1666 self.__addManagementMessage( 1666 self.__addManagementMessage(
1667 self.trUtf8("Whois"), 1667 self.tr("Whois"),
1668 self.trUtf8("End of WHOIS list for {0}.").format( 1668 self.tr("End of WHOIS list for {0}.").format(
1669 match.group(1))) 1669 match.group(1)))
1670 return True 1670 return True
1671 1671
1672 return False 1672 return False
1673 1673
1680 """ 1680 """
1681 # group(1) nick 1681 # group(1) nick
1682 # group(2) identified message 1682 # group(2) identified message
1683 if match.group(1) == self.__whoIsNick: 1683 if match.group(1) == self.__whoIsNick:
1684 self.__addManagementMessage( 1684 self.__addManagementMessage(
1685 self.trUtf8("Whois"), 1685 self.tr("Whois"),
1686 self.trUtf8("{0} is an identified user.").format( 1686 self.tr("{0} is an identified user.").format(
1687 match.group(1))) 1687 match.group(1)))
1688 return True 1688 return True
1689 1689
1690 return False 1690 return False
1691 1691
1698 """ 1698 """
1699 # group(1) nick 1699 # group(1) nick
1700 # group(2) helper message 1700 # group(2) helper message
1701 if match.group(1) == self.__whoIsNick: 1701 if match.group(1) == self.__whoIsNick:
1702 self.__addManagementMessage( 1702 self.__addManagementMessage(
1703 self.trUtf8("Whois"), 1703 self.tr("Whois"),
1704 self.trUtf8("{0} is available for help.").format( 1704 self.tr("{0} is available for help.").format(
1705 match.group(1))) 1705 match.group(1)))
1706 return True 1706 return True
1707 1707
1708 return False 1708 return False
1709 1709
1716 """ 1716 """
1717 # group(1) nick 1717 # group(1) nick
1718 # group(2) login name 1718 # group(2) login name
1719 if match.group(1) == self.__whoIsNick: 1719 if match.group(1) == self.__whoIsNick:
1720 self.__addManagementMessage( 1720 self.__addManagementMessage(
1721 self.trUtf8("Whois"), 1721 self.tr("Whois"),
1722 self.trUtf8("{0} is logged in as {1}.").format( 1722 self.tr("{0} is logged in as {1}.").format(
1723 match.group(1), match.group(2))) 1723 match.group(1), match.group(2)))
1724 return True 1724 return True
1725 1725
1726 return False 1726 return False
1727 1727
1735 # group(1) nick 1735 # group(1) nick
1736 # group(2) actual user@host 1736 # group(2) actual user@host
1737 # group(3) actual IP 1737 # group(3) actual IP
1738 if match.group(1) == self.__whoIsNick: 1738 if match.group(1) == self.__whoIsNick:
1739 self.__addManagementMessage( 1739 self.__addManagementMessage(
1740 self.trUtf8("Whois"), 1740 self.tr("Whois"),
1741 self.trUtf8( 1741 self.tr(
1742 "{0} is actually using the host {1} (IP: {2}).").format( 1742 "{0} is actually using the host {1} (IP: {2}).").format(
1743 match.group(1), match.group(2), match.group(3))) 1743 match.group(1), match.group(2), match.group(3)))
1744 return True 1744 return True
1745 1745
1746 return False 1746 return False
1753 @return flag indicating whether the message was handled (boolean) 1753 @return flag indicating whether the message was handled (boolean)
1754 """ 1754 """
1755 # group(1) nick 1755 # group(1) nick
1756 if match.group(1) == self.__whoIsNick: 1756 if match.group(1) == self.__whoIsNick:
1757 self.__addManagementMessage( 1757 self.__addManagementMessage(
1758 self.trUtf8("Whois"), 1758 self.tr("Whois"),
1759 self.trUtf8("{0} is using a secure connection.").format( 1759 self.tr("{0} is using a secure connection.").format(
1760 match.group(1))) 1760 match.group(1)))
1761 return True 1761 return True
1762 1762
1763 return False 1763 return False
1764 1764
1772 # group(1) nick 1772 # group(1) nick
1773 # group(2) host name 1773 # group(2) host name
1774 # group(3) IP 1774 # group(3) IP
1775 if match.group(1) == self.__whoIsNick: 1775 if match.group(1) == self.__whoIsNick:
1776 self.__addManagementMessage( 1776 self.__addManagementMessage(
1777 self.trUtf8("Whois"), 1777 self.tr("Whois"),
1778 self.trUtf8("{0} is connecting from {1} (IP: {2}).").format( 1778 self.tr("{0} is connecting from {1} (IP: {2}).").format(
1779 match.group(1), match.group(2), match.group(3))) 1779 match.group(1), match.group(2), match.group(3)))
1780 return True 1780 return True
1781 1781
1782 return False 1782 return False
1783 1783
1794 """ 1794 """
1795 Private slot to change the topic of the channel. 1795 Private slot to change the topic of the channel.
1796 """ 1796 """
1797 topic, ok = QInputDialog.getText( 1797 topic, ok = QInputDialog.getText(
1798 self, 1798 self,
1799 self.trUtf8("Edit Channel Topic"), 1799 self.tr("Edit Channel Topic"),
1800 self.trUtf8("Enter the topic for this channel:"), 1800 self.tr("Enter the topic for this channel:"),
1801 QLineEdit.Normal, 1801 QLineEdit.Normal,
1802 self.topicLabel.text()) 1802 self.topicLabel.text())
1803 if ok and topic != "": 1803 if ok and topic != "":
1804 self.sendData.emit("TOPIC {0} :{1}".format( 1804 self.sendData.emit("TOPIC {0} :{1}".format(
1805 self.__name, topic)) 1805 self.__name, topic))

eric ide

mercurial