eric6/Network/IRC/IrcChannelWidget.py

Sat, 21 Sep 2019 18:30:02 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 21 Sep 2019 18:30:02 +0200
changeset 7255
d595f6f9cbf8
parent 7229
53054eb5b15a
child 7360
9190402e4505
permissions
-rw-r--r--

Continued to resolve code style issue M841.

2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6534
diff changeset
3 # Copyright (c) 2012 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the IRC channel widget.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2476
diff changeset
10
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
11 from itertools import zip_longest
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
12
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import re
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 from PyQt5.QtCore import (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
16 pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo, QTimer, QUrl,
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 QCoreApplication
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
18 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
19 from PyQt5.QtGui import QIcon, QPainter, QTextCursor, QDesktopServices
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 from PyQt5.QtWidgets import (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 QWidget, QListWidgetItem, QMenu, QApplication, QInputDialog, QLineEdit
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 )
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
24 from E5Gui import E5MessageBox, E5FileDialog
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 from E5Gui.E5Application import e5App
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from .Ui_IrcChannelWidget import Ui_IrcChannelWidget
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 from .IrcUtilities import ircFilter, ircTimestamp, getChannelModesDict
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 import Utilities
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 import UI.PixmapCache
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 import Preferences
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
2264
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
35 from UI.Info import Version, Copyright
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
36
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 class IrcUserItem(QListWidgetItem):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Class implementing a list widget item containing an IRC channel user.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 Normal = 0x00 # no privileges
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Operator = 0x01 # channel operator
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 Voice = 0x02 # voice operator
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 Admin = 0x04 # administrator
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 Halfop = 0x08 # half operator
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Owner = 0x10 # channel owner
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 Away = 0x80 # user away
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 PrivilegeMapping = {
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 "a": Away,
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 "o": Operator,
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 "O": Owner,
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 "v": Voice,
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 }
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 def __init__(self, name, parent=None):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 Constructor
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 @param name string with user name and privilege prefix (string)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
63 @param parent reference to the parent widget (QListWidget or
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
64 QListWidgetItem)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2476
diff changeset
66 super(IrcUserItem, self).__init__(name, parent)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__privilege = IrcUserItem.Normal
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__name = name
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
70 self.__ignored = False
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
72 self.__setText()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.__setIcon()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 def name(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 Public method to get the user name.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 @return user name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 return self.__name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 def setName(self, name):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 Public method to set a new nick name.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @param name new nick name for the user (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.__name = name
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
90 self.__setText()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 def changePrivilege(self, privilege):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 Public method to set or unset a user privilege.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 @param privilege privilege to set or unset (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 oper = privilege[0]
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 priv = privilege[1]
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 if oper == "+":
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 if priv in IrcUserItem.PrivilegeMapping:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.__privilege |= IrcUserItem.PrivilegeMapping[priv]
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 elif oper == "-":
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 if priv in IrcUserItem.PrivilegeMapping:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.__privilege &= ~IrcUserItem.PrivilegeMapping[priv]
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.__setIcon()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 def clearPrivileges(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 Public method to clear the user privileges.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.__privilege = IrcUserItem.Normal
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.__setIcon()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
115 def __setText(self):
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
116 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
117 Private method to set the user item text.
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
118 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
119 if self.__ignored:
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
120 self.setText(QCoreApplication.translate(
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
121 "IrcUserItem",
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
122 "{0} (ignored)").format(self.__name))
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
123 else:
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
124 self.setText(self.__name)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
125
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 def __setIcon(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 Private method to set the icon dependent on user privileges.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 # step 1: determine the icon
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 if self.__privilege & IrcUserItem.Voice:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 icon = UI.PixmapCache.getIcon("ircVoice.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 elif self.__privilege & IrcUserItem.Owner:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 icon = UI.PixmapCache.getIcon("ircOwner.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 elif self.__privilege & IrcUserItem.Operator:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 icon = UI.PixmapCache.getIcon("ircOp.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 elif self.__privilege & IrcUserItem.Halfop:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 icon = UI.PixmapCache.getIcon("ircHalfop.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 elif self.__privilege & IrcUserItem.Admin:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 icon = UI.PixmapCache.getIcon("ircAdmin.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 else:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 icon = UI.PixmapCache.getIcon("ircNormal.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 if self.__privilege & IrcUserItem.Away:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 icon = self.__awayIcon(icon)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 # step 2: set the icon
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.setIcon(icon)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 def __awayIcon(self, icon):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 Private method to convert an icon to an away icon.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 @param icon icon to be converted (QIcon)
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2632
diff changeset
154 @return away icon (QIcon)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 pix1 = icon.pixmap(16, 16)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 pix2 = UI.PixmapCache.getPixmap("ircAway.png")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 painter = QPainter(pix1)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 painter.drawPixmap(0, 0, pix2)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 painter.end()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 return QIcon(pix1)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
162
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
163 def parseWhoFlags(self, flags):
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
164 """
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
165 Public method to parse the user flags reported by a WHO command.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
166
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
167 @param flags user flags as reported by WHO (string)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
168 """
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
169 # H The user is not away.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
170 # G The user is set away.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
171 # * The user is an IRC operator.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
172 # @ The user is a channel op in the channel listed in the first field.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
173 # + The user is voiced in the channel listed.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
174 if flags.endswith("@"):
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
175 privilege = IrcUserItem.Operator
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
176 elif flags.endswith("+"):
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
177 privilege = IrcUserItem.Voice
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
178 else:
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
179 privilege = IrcUserItem.Normal
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
180 if "*" in flags:
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
181 privilege = IrcUserItem.Admin
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
182 if flags.startswith("G"):
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
183 privilege |= IrcUserItem.Away
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
184 self.__privilege = privilege
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
185 self.__setIcon()
2445
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
186
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
187 def canChangeTopic(self):
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
188 """
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
189 Public method to check, if the user is allowed to change the topic.
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
190
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
191 @return flag indicating that the topic can be changed (boolean)
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
192 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
193 return(bool(self.__privilege & IrcUserItem.Operator) or
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
194 bool(self.__privilege & IrcUserItem.Admin) or
2445
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
195 bool(self.__privilege & IrcUserItem.Owner))
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
196
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
197 def setIgnored(self, ignored):
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
198 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
199 Public method to set the user status to ignored.
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
200
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
201 @param ignored flag indicating the new ignored status
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
202 @type bool
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
203 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
204 self.__ignored = ignored
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
205 self.__setText()
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
206
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
207 def isIgnored(self):
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
208 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
209 Public method to check, if this user is ignored.
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
210
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
211 @return flag indicating the ignored status
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
212 @rtype bool
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
213 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
214 return self.__ignored
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 class IrcChannelWidget(QWidget, Ui_IrcChannelWidget):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 Class implementing the IRC channel widget.
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
220
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
221 @signal sendData(str) emitted to send a message to the channel
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
222 @signal sendCtcpRequest(str, str, str) emitted to send a CTCP request
2264
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
223 @signal sendCtcpReply(str, str) emitted to send a CTCP reply
2245
cbddacb4bc2e Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2244
diff changeset
224 @signal channelClosed(str) emitted after the user has left the channel
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
225 @signal openPrivateChat(str) emitted to open a "channel" for private
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
226 messages
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
227 @signal awayCommand(str) emitted to set the away status via the /away
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
228 command
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
229 @signal leaveChannels(list) emitted to leave a list of channels
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
230 @signal leaveAllChannels() emitted to leave all channels
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 sendData = pyqtSignal(str)
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
233 sendCtcpRequest = pyqtSignal(str, str, str)
2264
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
234 sendCtcpReply = pyqtSignal(str, str)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 channelClosed = pyqtSignal(str)
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
236 openPrivateChat = pyqtSignal(str)
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
237 awayCommand = pyqtSignal(str)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
238 leaveChannels = pyqtSignal(list)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
239 leaveAllChannels = pyqtSignal()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
241 UrlRe = re.compile(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
242 r"""((?:http|ftp|https):\/\/[\w\-_]+(?:\.[\w\-_]+)+"""
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 r"""(?:[\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)""")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 JoinIndicator = "--&gt;"
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 LeaveIndicator = "&lt;--"
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 MessageIndicator = "***"
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 def __init__(self, parent=None):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 Constructor
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 @param parent reference to the parent widget (QWidget)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2476
diff changeset
255 super(IrcChannelWidget, self).__init__(parent)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 self.setupUi(self)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 self.__ui = e5App().getObject("UserInterface")
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
259 self.__ircWidget = parent
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
261 self.editTopicButton.setIcon(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
262 UI.PixmapCache.getIcon("ircEditTopic.png"))
2445
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
263 self.editTopicButton.hide()
2271
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
264
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
265 height = self.usersList.height() + self.messages.height()
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
266 self.splitter.setSizes([height * 0.3, height * 0.7])
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
267
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2243
diff changeset
268 self.__initMessagesMenu()
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
269 self.__initUsersMenu()
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2243
diff changeset
270
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 self.__name = ""
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 self.__userName = ""
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.__partMessage = ""
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 self.__prefixToPrivilege = {}
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
275 self.__private = False
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
276 self.__privatePartner = ""
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
277 self.__whoIsNick = ""
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2243
diff changeset
279 self.__markerLine = ""
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
280 self.__hidden = True
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2243
diff changeset
281
6472
cb3809332396 IrcChannelWidget: fixed an issue handling '/msg' with nickserv, chanserv and memoserv.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
282 self.__serviceNamesLower = ["nickserv", "chanserv", "memoserv"]
cb3809332396 IrcChannelWidget: fixed an issue handling '/msg' with nickserv, chanserv and memoserv.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
283
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 self.__patterns = [
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 # :foo_!n=foo@foohost.bar.net PRIVMSG #eric-ide :some long message
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
286 # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
287 (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
288 self.__message),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 # :foo_!n=foo@foohost.bar.net JOIN :#eric-ide
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
290 (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
291 self.__userJoin),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 # :foo_!n=foo@foohost.bar.net PART #eric-ide :part message
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 (re.compile(r":([^!]+).*\sPART\s([^ ]+)\s:(.*)"), self.__userPart),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 # :foo_!n=foo@foohost.bar.net PART #eric-ide
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 (re.compile(r":([^!]+).*\sPART\s([^ ]+)\s*"), self.__userPart),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 # :foo_!n=foo@foohost.bar.net QUIT :quit message
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 (re.compile(r":([^!]+).*\sQUIT\s:(.*)"), self.__userQuit),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 # :foo_!n=foo@foohost.bar.net QUIT
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 (re.compile(r":([^!]+).*\sQUIT\s*"), self.__userQuit),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 # :foo_!n=foo@foohost.bar.net NICK :newnick
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 (re.compile(r":([^!]+).*\sNICK\s:(.*)"), self.__userNickChange),
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
302 # :foo_!n=foo@foohost.bar.net MODE #eric-ide +o foo_
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
303 (re.compile(r":([^!]+).*\sMODE\s([^ ]+)\s([+-][ovO]+)\s([^ ]+).*"),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 self.__setUserPrivilege),
2270
582bd5d24741 Added support for the TOPIC IRC channel command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2264
diff changeset
305 # :cameron.freenode.net MODE #eric-ide +ns
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
306 (re.compile(r":([^ ]+)\sMODE\s([^ ]+)\s(.+)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
307 self.__updateChannelModes),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
308 # :foo_!n=foo@foohost.bar.net TOPIC #eric-ide :eric - Python IDE
2270
582bd5d24741 Added support for the TOPIC IRC channel command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2264
diff changeset
309 (re.compile(r":.*\sTOPIC\s([^ ]+)\s:(.*)"), self.__setTopic),
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
310 # :sturgeon.freenode.net 301 foo_ bar :Gone away for now
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
311 (re.compile(r":.*\s301\s([^ ]+)\s([^ ]+)\s:(.+)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
312 self.__userAway),
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
313 # :sturgeon.freenode.net 315 foo_ #eric-ide :End of /WHO list.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
314 (re.compile(r":.*\s315\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoEnd),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 # :zelazny.freenode.net 324 foo_ #eric-ide +cnt
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 (re.compile(r":.*\s324\s.*\s([^ ]+)\s(.+)"), self.__channelModes),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
317 # :zelazny.freenode.net 328 foo_ #eric-ide :http://www.bugger.com/
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 (re.compile(r":.*\s328\s.*\s([^ ]+)\s:(.+)"), self.__channelUrl),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 # :zelazny.freenode.net 329 foo_ #eric-ide 1353001005
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
320 (re.compile(r":.*\s329\s.*\s([^ ]+)\s(.+)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
321 self.__channelCreated),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 # :zelazny.freenode.net 332 foo_ #eric-ide :eric support channel
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 (re.compile(r":.*\s332\s.*\s([^ ]+)\s:(.*)"), self.__setTopic),
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 # :zelazny.freenode.net foo_ 333 #eric-ide foo 1353089020
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
325 (re.compile(r":.*\s333\s.*\s([^ ]+)\s([^ ]+)\s(\d+)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
326 self.__topicCreated),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
327 # :cameron.freenode.net 352 detlev_ #eric-ide ~foo foohost.bar.net
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
328 # cameron.freenode.net foo_ H :0 Foo Bar
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
329 (re.compile(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
330 r":.*\s352\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s[^ ]+\s([^ ]+)"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
331 r"\s([^ ]+)\s:\d+\s(.*)"), self.__whoEntry),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 # :zelazny.freenode.net 353 foo_ @ #eric-ide :@user1 +user2 user3
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 (re.compile(r":.*\s353\s.*\s.\s([^ ]+)\s:(.*)"), self.__userList),
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
334 # :sturgeon.freenode.net 354 foo_ 42 ChanServ H@
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
335 (re.compile(r":.*\s354\s[^ ]+\s42\s([^ ]+)\s(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
336 self.__autoWhoEntry),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 # :zelazny.freenode.net 366 foo_ #eric-ide :End of /NAMES list.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 (re.compile(r":.*\s366\s.*\s([^ ]+)\s:(.*)"), self.__ignore),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
339 # :sturgeon.freenode.net 704 foo_ index :Help topics available:
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
340 (re.compile(r":.*\s70[456]\s[^ ]+\s([^ ]+)\s:(.*)"), self.__help),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
341
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
342 # WHOIS replies
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
343 # :sturgeon.freenode.net 311 foo_ bar ~bar barhost.foo.net * :Bar
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
344 (re.compile(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
345 r":.*\s311\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s\*\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
346 self.__whoIsUser),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
347 # :sturgeon.freenode.net 319 foo_ bar :@#eric-ide
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
348 (re.compile(r":.*\s319\s[^ ]+\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
349 self.__whoIsChannels),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
350 # :sturgeon.freenode.net 312 foo_ bar sturgeon.freenode.net :London
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
351 (re.compile(r":.*\s312\s[^ ]+\s([^ ]+)\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
352 self.__whoIsServer),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
353 # :sturgeon.freenode.net 671 foo_ bar :is using a secure connection
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
354 (re.compile(r":.*\s671\s[^ ]+\s([^ ]+)\s:.*"), self.__whoIsSecure),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
355 # :sturgeon.freenode.net 317 foo_ bar 3758 1355046912 :seconds
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
356 # idle, signon time
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
357 (re.compile(r":.*\s317\s[^ ]+\s([^ ]+)\s(\d+)\s(\d+)\s:.*"),
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
358 self.__whoIsIdle),
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
359 # :sturgeon.freenode.net 330 foo_ bar bar :is logged in as
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
360 (re.compile(r":.*\s330\s[^ ]+\s([^ ]+)\s([^ ]+)\s:.*"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
361 self.__whoIsAccount),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
362 # :sturgeon.freenode.net 318 foo_ bar :End of /WHOIS list.
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
363 (re.compile(r":.*\s318\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsEnd),
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
364 # :sturgeon.freenode.net 307 foo_ bar :is an identified user
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
365 (re.compile(r":.*\s307\s[^ ]+\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
366 self.__whoIsIdentify),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
367 # :sturgeon.freenode.net 320 foo_ bar :is an identified user
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
368 (re.compile(r":.*\s320\s[^ ]+\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
369 self.__whoIsIdentify),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
370 # :sturgeon.freenode.net 310 foo_ bar :is available for help
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
371 (re.compile(r":.*\s310\s[^ ]+\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
372 self.__whoIsHelper),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
373 # :sturgeon.freenode.net 338 foo_ bar real.ident@real.host
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
374 # 12.34.56.78 :Actual user@host, Actual IP
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
375 (re.compile(r":.*\s338\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s:.*"),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
376 self.__whoIsActually),
2256
d07e2e6f3c56 Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2255
diff changeset
377 # :sturgeon.freenode.net 313 foo_ bar :is an IRC Operator
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
378 (re.compile(r":.*\s313\s[^ ]+\s([^ ]+)\s:(.*)"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
379 self.__whoIsOperator),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
380 # :sturgeon.freenode.net 378 foo_ bar :is connecting from
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
381 # *@mnch-4d044d5a.pool.mediaWays.net 77.4.77.90
2271
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
382 (re.compile(r":.*\s378\s[^ ]+\s([^ ]+)\s:.*\s([^ ]+)\s([^ ]+)"),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
383 self.__whoIsConnection),
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 ]
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
385
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
386 self.__autoWhoTemplate = "WHO {0} %tnf,42"
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
387 self.__autoWhoTimer = QTimer()
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
388 self.__autoWhoTimer.setSingleShot(True)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
389 self.__autoWhoTimer.timeout.connect(self.__sendAutoWhoCommand)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
390 self.__autoWhoRequested = False
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 @pyqtSlot()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 def on_messageEdit_returnPressed(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 Private slot to send a message to the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 msg = self.messageEdit.text()
2244
654aaddbc2b9 Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2243
diff changeset
398 if msg:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
399 self.__processUserMessage(msg)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
400
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
401 def __processUserMessage(self, msg):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
402 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
403 Private method to process a message entered by the user or via the
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
404 user list context menu.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
405
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
406 @param msg message to be processed
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
407 @type str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
408 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
409 self.messages.append(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
410 '<font color="{0}">{2} <b>&lt;</b><font color="{1}">{3}</font>'
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
411 '<b>&gt;</b> {4}</font>'.format(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
412 Preferences.getIrc("ChannelMessageColour"),
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
413 Preferences.getIrc("OwnNickColour"),
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
414 ircTimestamp(), self.__userName,
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
415 Utilities.html_encode(msg)))
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
416
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
417 if msg.startswith("/"):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
418 if self.__private:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
419 E5MessageBox.information(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
420 self,
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
421 self.tr("Send Message"),
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
422 self.tr(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
423 """Messages starting with a '/' are not allowed"""
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
424 """ in private chats."""))
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
425 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
426 sendData = True
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
427 # flag set to False, if command was handled
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
428
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
429 msgList = msg.split()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
430 cmd = msgList[0][1:].upper()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
431 if cmd in ["MSG", "QUERY"]:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
432 cmd = "PRIVMSG"
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
433 if len(msgList) > 1:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
434 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
435 msgList[1].strip().lower() in
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
436 self.__serviceNamesLower
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
437 ):
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
438 msg = (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
439 "PRIVMSG " +
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
440 msgList[1].strip().lower() +
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
441 " :" + " ".join(msgList[2:])
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
442 )
6472
cb3809332396 IrcChannelWidget: fixed an issue handling '/msg' with nickserv, chanserv and memoserv.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
443 else:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
444 msg = "PRIVMSG {0} :{1}".format(
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
445 msgList[1], " ".join(msgList[2:]))
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
446 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
447 msgList[0] = cmd
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
448 msg = " ".join(msgList)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
449 elif cmd == "NOTICE":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
450 if len(msgList) > 2:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
451 msg = "NOTICE {0} :{1}".format(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
452 msgList[1], " ".join(msgList[2:]))
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
453 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
454 msg = "NOTICE {0}".format(" ".join(msgList[1:]))
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
455 elif cmd == "PING":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
456 receiver = msgList[1]
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
457 msg = "PING {0} "
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
458 self.sendCtcpRequest.emit(receiver, "PING", "")
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
459 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
460 elif cmd == "IGNORE":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
461 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
462 if len(msgList) > 1:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
463 if msgList[1] == "-r":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
464 ignored = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
465 userNamesList = msgList[2:]
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
466 else:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
467 ignored = True
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
468 userNamesList = msgList[1:]
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
469 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
470 userNamesList = []
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
471 userNames = ",".join(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
472 u.rstrip(",") for u in userNamesList).split(",")
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
473 for userName in userNames:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
474 itm = self.__findUser(userName)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
475 if itm:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
476 itm.setIgnored(ignored)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
477 elif cmd == "UNIGNORE":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
478 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
479 if len(msgList) > 1:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
480 userNamesList = msgList[1:]
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
481 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
482 userNamesList = []
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
483 userNames = ",".join(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
484 u.rstrip(",") for u in userNamesList).split(",")
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
485 for userName in userNames:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
486 itm = self.__findUser(userName)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
487 if itm:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
488 itm.setIgnored(False)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
489 elif cmd == "AWAY":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
490 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
491 if len(msgList) > 1:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
492 msg = " ".join(msgList[1:])
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
493 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
494 msg = ""
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
495 self.awayCommand.emit(msg)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
496 elif cmd == "JOIN":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
497 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
498 if len(msgList) > 1:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
499 channels = msgList[1].split(",")
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
500 if len(msgList) > 2:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
501 keys = msgList[2].split(",")
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
502 else:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
503 keys = []
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
504 for channel, key in zip_longest(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
505 channels, keys, fillvalue=""):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
506 self.__ircWidget.joinChannel(channel, key)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
507 elif cmd == "PART":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
508 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
509 if len(msgList) == 1:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
510 self.leaveChannel()
6472
cb3809332396 IrcChannelWidget: fixed an issue handling '/msg' with nickserv, chanserv and memoserv.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
511 else:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
512 self.leaveChannels.emit(msgList[1:])
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
513 elif cmd == "PARTALL":
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
514 sendData = False
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
515 self.leaveAllChannels.emit()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
516 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
517 msg = msg[1:]
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
518 if sendData:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
519 self.sendData.emit(msg)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
520 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
521 if self.__private:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
522 self.sendData.emit(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
523 "PRIVMSG " + self.__privatePartner + " :" + msg)
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
524 else:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
525 self.sendData.emit(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
526 "PRIVMSG " + self.__name + " :" + msg)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
527
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
528 self.messageEdit.clear()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6514
diff changeset
529 self.unsetMarkerLine()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 def requestLeave(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 Public method to leave the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 """
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
535 ok = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
536 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
537 self.tr("Leave IRC channel"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
538 self.tr(
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
539 """Do you really want to leave the IRC channel"""
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
540 """ <b>{0}</b>?""").format(self.__name))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 if ok:
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
542 self.leaveChannel()
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
543
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
544 def leaveChannel(self):
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
545 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
546 Public slot to leave the channel.
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
547 """
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
548 if not self.__private:
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
549 self.sendData.emit(
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
550 "PART " + self.__name + " :" + self.__partMessage)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
551 self.channelClosed.emit(self.__name)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 def name(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 Public method to get the name of the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 @return name of the channel (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 return self.__name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 def setName(self, name):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 Public method to set the name of the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 @param name of the channel (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 self.__name = name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 def getUsersCount(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 Public method to get the users count of the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 @return users count of the channel (integer)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 return self.usersList.count()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 def userName(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 Public method to get the nick name of the user.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 @return nick name of the user (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 return self.__userName
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 def setUserName(self, name):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 Public method to set the user name for the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 @param name user name for the channel (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 """
2254
14f923d13971 Changed the handling of the nick in the IRC channel widget to respect the case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2253
diff changeset
591 self.__userName = name
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 def partMessage(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 Public method to get the part message.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 @return part message (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 return self.__partMessage
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 def setPartMessage(self, message):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 Public method to set the part message.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 @param message message to be used for PART messages (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 self.__partMessage = message
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
609 def setPrivate(self, private, partner=""):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
610 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
611 Public method to set the private chat mode.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
612
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
613 @param private flag indicating private chat mode (boolean)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
614 @param partner name of the partner user (string)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
615 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
616 self.__private = private
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
617 self.__privatePartner = partner
2271
7dd914b6eb7d Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2270
diff changeset
618 self.editTopicButton.setEnabled(private)
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
619
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
620 def setPrivateInfo(self, infoText):
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
621 """
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
622 Public method to set some info text for private chat mode.
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
623
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
624 @param infoText info text to be shown (string)
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
625 """
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
626 if self.__private:
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
627 self.topicLabel.setText(infoText)
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
628
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 def handleMessage(self, line):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 Public method to handle the message sent by the server.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 @param line server message (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 @return flag indicating, if the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 for patternRe, patternFunc in self.__patterns:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 match = patternRe.match(line)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 if match is not None:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 if patternFunc(match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 def __message(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 Private method to handle messages to the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 """
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
651 # group(1) sender user name
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
652 # group(2) sender user@host
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
653 # group(3) target nick
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
654 # group(4) message
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
655 if match.group(3).lower() == self.__name.lower():
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
656 senderName = match.group(1)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
657 itm = self.__findUser(senderName)
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
658 if itm and itm.isIgnored():
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
659 # user should be ignored
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
660 return True
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
661
2264
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
662 if match.group(4).startswith("\x01"):
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
663 return self.__handleCtcp(match)
d8176c78c6a6 Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2257
diff changeset
664
6514
f11a703e4664 IRC: added support for the /query, /notice, /ping, /ignore, /unignore, /away, /join, /part and /partall commands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6513
diff changeset
665 self.addMessage(senderName, match.group(4))
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
666 if self.__private and not self.topicLabel.text():
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
667 self.setPrivateInfo(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
668 "{0} - {1}".format(match.group(1), match.group(2)))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
673 def addMessage(self, sender, msg):
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
674 """
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
675 Public method to add a message from external.
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
676
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
677 @param sender nick name of the sender (string)
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
678 @param msg message received from sender (string)
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
679 """
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
680 self.__appendMessage(
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
681 '<font color="{0}">{2} <b>&lt;</b><font color="{1}">{3}</font>'
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
682 '<b>&gt;</b> {4}</font>'.format(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
683 Preferences.getIrc("ChannelMessageColour"),
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
684 Preferences.getIrc("NickColour"),
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
685 ircTimestamp(), sender, ircFilter(msg)))
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
686 if Preferences.getIrc("ShowNotifications"):
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
687 if Preferences.getIrc("NotifyMessage"):
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
688 self.__ui.showNotification(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
689 UI.PixmapCache.getPixmap("irc48.png"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
690 self.tr("Channel Message"), msg)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
691 elif (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
692 Preferences.getIrc("NotifyNick") and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
693 self.__userName.lower() in msg.lower()
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
694 ):
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
695 self.__ui.showNotification(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
696 UI.PixmapCache.getPixmap("irc48.png"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
697 self.tr("Nick mentioned"), msg)
2255
3e728bfc178c Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2254
diff changeset
698
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
699 def addUsers(self, users):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
700 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
701 Public method to add users to the channel.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
702
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
703 @param users list of user names to add (list of string)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
704 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
705 for user in users:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
706 itm = self.__findUser(user)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
707 if itm is None:
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
708 IrcUserItem(user, self.usersList)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
709
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 def __userJoin(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 Private method to handle a user joining the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
717 if match.group(3).lower() == self.__name.lower():
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 if self.__userName != match.group(1):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 IrcUserItem(match.group(1), self.usersList)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
720 msg = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
721 "{0} has joined the channel {1} ({2}).").format(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
722 match.group(1), self.__name, match.group(2))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
723 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
724 IrcChannelWidget.JoinIndicator, msg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
726 msg = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
727 "You have joined the channel {0} ({1}).").format(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
728 self.__name, match.group(2))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
729 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
730 IrcChannelWidget.JoinIndicator, msg)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
731 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
732 Preferences.getIrc("ShowNotifications") and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
733 Preferences.getIrc("NotifyJoinPart")
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
734 ):
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
735 self.__ui.showNotification(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
736 UI.PixmapCache.getPixmap("irc48.png"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
737 self.tr("Join Channel"), msg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 def __userPart(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 Private method to handle a user leaving the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
749 if match.group(2).lower() == self.__name.lower():
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 itm = self.__findUser(match.group(1))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 self.usersList.takeItem(self.usersList.row(itm))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 del itm
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 if match.lastindex == 2:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
754 msg = self.tr("{0} has left {1}.").format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 match.group(1), self.__name)
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
756 nmsg = msg
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
757 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
758 IrcChannelWidget.LeaveIndicator, msg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
760 msg = self.tr("{0} has left {1}: {2}.").format(
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
761 match.group(1), self.__name, ircFilter(match.group(3)))
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
762 nmsg = self.tr("{0} has left {1}: {2}.").format(
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
763 match.group(1), self.__name, match.group(3))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
764 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
765 IrcChannelWidget.LeaveIndicator, msg)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
766 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
767 Preferences.getIrc("ShowNotifications") and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
768 Preferences.getIrc("NotifyJoinPart")
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
769 ):
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
770 self.__ui.showNotification(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
771 UI.PixmapCache.getPixmap("irc48.png"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
772 self.tr("Leave Channel"), nmsg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 def __userQuit(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 Private method to handle a user logging off the server.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 itm = self.__findUser(match.group(1))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 if itm:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 self.usersList.takeItem(self.usersList.row(itm))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 del itm
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 if match.lastindex == 1:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
789 msg = self.tr("{0} has quit {1}.").format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 match.group(1), self.__name)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
791 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
792 IrcChannelWidget.MessageIndicator, msg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
794 msg = self.tr("{0} has quit {1}: {2}.").format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 match.group(1), self.__name, ircFilter(match.group(2)))
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
796 self.__addManagementMessage(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
797 IrcChannelWidget.MessageIndicator, msg)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
798 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
799 Preferences.getIrc("ShowNotifications") and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
800 Preferences.getIrc("NotifyJoinPart")
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
801 ):
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
802 self.__ui.showNotification(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
803 UI.PixmapCache.getPixmap("irc48.png"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
804 self.tr("Quit"), msg)
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 # always return False for other channels and server to process
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 def __userNickChange(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 Private method to handle a nickname change of a user.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 itm = self.__findUser(match.group(1))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 if itm:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 itm.setName(match.group(2))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 if match.group(1) == self.__userName:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
820 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
821 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
822 self.tr("You are now known as {0}.").format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 match.group(2)))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 self.__userName = match.group(2)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 else:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
826 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
827 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
828 self.tr("User {0} is now known as {1}.").format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829 match.group(1), match.group(2)))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 # always return False for other channels and server to process
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 def __userList(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 Private method to handle the receipt of a list of users of the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
841 if match.group(1).lower() == self.__name.lower():
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842 users = match.group(2).split()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 for user in users:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 userPrivileges, userName = self.__extractPrivilege(user)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845 itm = self.__findUser(userName)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 if itm is None:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 itm = IrcUserItem(userName, self.usersList)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 for privilege in userPrivileges:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 itm.changePrivilege(privilege)
2445
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
850
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
851 self.__setEditTopicButton()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 return False
2445
e3fadb2b85c7 Change the logic of the IRC widget to only show the "Edit Topic" button, if the user is allowed to do so.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2442
diff changeset
855
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
856 def __userAway(self, match):
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
857 """
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
858 Private method to handle a topic change of the channel.
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
859
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
860 @param match match object that matched the pattern
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
861 @return flag indicating whether the message was handled (boolean)
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
862 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
863 if match.group(1).lower() == self.__name.lower():
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
864 self.__addManagementMessage(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
865 self.tr("Away"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
866 self.tr("{0} is away: {1}").format(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
867 match.group(2), match.group(3)))
2252
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
868 return True
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
869
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
870 return False
1fc32bd13be3 Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
871
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 def __setTopic(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 Private method to handle a topic change of the channel.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
875
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
877 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
878 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
879 if match.group(1).lower() == self.__name.lower():
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 self.topicLabel.setText(match.group(2))
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
881 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
882 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
883 ircFilter(self.tr('The channel topic is: "{0}".').format(
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884 match.group(2))))
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 def __topicCreated(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 Private method to handle a topic created message.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
896 if match.group(1).lower() == self.__name.lower():
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
897 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
898 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
899 self.tr("The topic was set by {0} on {1}.").format(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
900 match.group(2), QDateTime.fromTime_t(int(match.group(3)))
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
901 .toString("yyyy-MM-dd hh:mm")))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 def __channelUrl(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 Private method to handle a channel URL message.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
913 if match.group(1).lower() == self.__name.lower():
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
914 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
915 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
916 ircFilter(self.tr("Channel URL: {0}").format(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
917 match.group(2))))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 def __channelModes(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 Private method to handle a message reporting the channel modes.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
929 if match.group(1).lower() == self.__name.lower():
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 modesDict = getChannelModesDict()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 modesParameters = match.group(2).split()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 modeString = modesParameters.pop(0)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 modes = []
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 for modeChar in modeString:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 if modeChar == "+":
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 continue
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 elif modeChar == "k":
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 parameter = modesParameters.pop(0)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
939 modes.append(self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
940 "password protected ({0})").format(parameter))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 elif modeChar == "l":
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 parameter = modesParameters.pop(0)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
943 modes.append(self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
944 "limited to %n user(s)", "", int(parameter)))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 elif modeChar in modesDict:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 modes.append(modesDict[modeChar])
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 else:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 modes.append(modeChar)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
950 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
951 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
952 self.tr("Channel modes: {0}.").format(", ".join(modes)))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 def __channelCreated(self, match):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 Private method to handle a channel created message.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 @param match match object that matched the pattern
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 @return flag indicating whether the message was handled (boolean)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 """
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
965 if match.group(1).lower() == self.__name.lower():
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
966 self.__addManagementMessage(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
967 IrcChannelWidget.MessageIndicator,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
968 self.tr("This channel was created on {0}.").format(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
969 QDateTime.fromTime_t(int(match.group(2)))
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
970 .toString("yyyy-MM-dd hh:mm")))
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 return True
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 return False
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
975 def __updateChannelModes(self, match):
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
976 """
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
977 Private method to handle a message reporting the channel modes.
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
978
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
979 @param match match object that matched the pattern
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
980 @return flag indicating whether the message was handled (boolean)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
981 """
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
982 # group(1) user or server
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
983 # group(2) channel
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
984 # group(3) modes and parameter list
2476
3137ed00325e Fixed an issue in the IRC widget related to channels with uppercase characters in their name..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2446
diff changeset
985 if match.group(2).lower() == self.__name.lower():
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
986 nick = match.group(1)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
987 modesParameters = match.group(3).split()
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
988 modeString = modesParameters.pop(0)
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
989 isPlus = True
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
990 message = ""
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
991 for mode in modeString:
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
992 if mode == "+":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
993 isPlus = True
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
994 continue
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
995 elif mode == "-":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
996 isPlus = False
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
997 continue
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
998 elif mode == "a":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
999 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1000 message = self.tr(
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1001 "{0} sets the channel mode to 'anonymous'."
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1002 ).format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1003 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1004 message = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1005 "{0} removes the 'anonymous' mode from the"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1006 " channel.").format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1007 elif mode == "b":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1008 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1009 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1010 "{0} sets a ban on {1}.").format(
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1011 nick, modesParameters.pop(0))
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1012 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1013 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1014 "{0} removes the ban on {1}.").format(
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1015 nick, modesParameters.pop(0))
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1016 elif mode == "c":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1017 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1018 message = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1019 "{0} sets the channel mode to 'no colors"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1020 " allowed'.").format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1021 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1022 message = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1023 "{0} sets the channel mode to 'allow color"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1024 " codes'.").format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1025 elif mode == "e":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1026 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1027 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1028 "{0} sets a ban exception on {1}.").format(
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1029 nick, modesParameters.pop(0))
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1030 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1031 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1032 "{0} removes the ban exception on {1}.").format(
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1033 nick, modesParameters.pop(0))
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1034 elif mode == "i":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1035 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1036 message = self.tr(
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1037 "{0} sets the channel mode to 'invite only'."
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1038 ).format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1039 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1040 message = self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1041 "{0} removes the 'invite only' mode from the"
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
1042 " channel.").format(nick)
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1043 elif mode == "k":
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1044 if isPlus:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1045 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1046 "{0} sets the channel key to '{1}'.").format(
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1047 nick, modesParameters.pop(0))
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252
diff changeset
1048 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
1049 message = self.tr(
2253
7ba2af1ff785 Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2252