Sun, 09 Dec 2012 16:18:17 +0100
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Improved the "private IRC chat" support.
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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | 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
|
11 | |
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
|
12 | from PyQt4.QtCore import pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo, QTimer |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
13 | from PyQt4.QtGui import QWidget, QListWidgetItem, QIcon, QPainter, QMenu, QApplication |
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
|
14 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
15 | 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
|
16 | 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
|
17 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | 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
|
19 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | 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
|
21 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | 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
|
23 | 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
|
24 | 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
|
25 | |
b7aceb255831
First 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 | 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
|
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 | 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
|
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 | 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
|
32 | 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
|
33 | 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
|
34 | 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
|
35 | 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
|
36 | 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
|
37 | 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
|
38 | |
b7aceb255831
First 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 | 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
|
40 | "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
|
41 | "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
|
42 | "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
|
43 | "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
|
44 | |
b7aceb255831
First 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 | } |
b7aceb255831
First 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 | |
b7aceb255831
First 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 | 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
|
48 | """ |
b7aceb255831
First 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 | 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
|
50 | |
b7aceb255831
First 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 | @param name string with user name and privilege prefix (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
|
52 | @param parent reference to the parent widget (QListWidget or 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
|
53 | """ |
b7aceb255831
First 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 | super().__init__(name, parent) |
b7aceb255831
First 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 | 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
|
57 | 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
|
58 | |
b7aceb255831
First 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 | 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
|
60 | |
b7aceb255831
First 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 | 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
|
62 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | 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
|
64 | |
b7aceb255831
First 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 | @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
|
66 | """ |
b7aceb255831
First 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 | 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
|
68 | |
b7aceb255831
First 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 | 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
|
70 | """ |
b7aceb255831
First 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 | 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
|
72 | |
b7aceb255831
First 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 | @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
|
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 | 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
|
76 | self.setText(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
|
77 | |
b7aceb255831
First 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 | 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
|
79 | """ |
b7aceb255831
First 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 | 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
|
81 | |
b7aceb255831
First 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 | @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
|
83 | """ |
b7aceb255831
First 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 | 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
|
85 | 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
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | 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
|
90 | 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
|
91 | 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
|
92 | 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
|
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 | 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
|
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 | 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
|
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 | 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
|
99 | 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
|
100 | |
b7aceb255831
First 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 | 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
|
102 | """ |
b7aceb255831
First 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 | 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
|
104 | """ |
b7aceb255831
First 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 | # 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
|
106 | 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
|
107 | 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
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | 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
|
119 | 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
|
120 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | # 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
|
122 | 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
|
123 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | 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
|
125 | """ |
b7aceb255831
First 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 | 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
|
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 | @param icon icon to be converted (QIcon) |
b7aceb255831
First 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 | @param away icon (QIcon) |
b7aceb255831
First 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 | """ |
b7aceb255831
First 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 | 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
|
132 | 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
|
133 | 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
|
134 | 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
|
135 | 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
|
136 | 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
|
137 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
138 | 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
|
139 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
140 | 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
|
141 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
142 | @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
|
143 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
144 | # 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
|
145 | # 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
|
146 | # * 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
|
147 | # @ 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
|
148 | # + 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
|
149 | 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
|
150 | 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
|
151 | 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
|
152 | 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
|
153 | 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
|
154 | 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
|
155 | 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
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | 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
|
160 | self.__setIcon() |
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
|
161 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | 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
|
164 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 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
|
166 | |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
167 | @signal sendData(str) emitted to send a message to the channel |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
168 | @signal channelClosed(str) emitted after the user has left the channel |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
169 | @signal openPrivateChat(str) emitted to open a "channel" for private messages |
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
|
170 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | sendData = pyqtSignal(str) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | channelClosed = pyqtSignal(str) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
173 | openPrivateChat = pyqtSignal(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
|
174 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | UrlRe = re.compile(r"""((?:http|ftp|https):\/\/[\w\-_]+(?:\.[\w\-_]+)+""" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | r"""(?:[\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)""") |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | JoinIndicator = "-->" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | LeaveIndicator = "<--" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | 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
|
181 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | 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
|
183 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | 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
|
185 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | @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
|
187 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | super().__init__(parent) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | 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
|
190 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | self.__ui = e5App().getObject("UserInterface") |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
193 | self.__initMessagesMenu() |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
194 | self.__initUsersMenu() |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
195 | |
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
|
196 | 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
|
197 | 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
|
198 | 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
|
199 | self.__prefixToPrivilege = {} |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
200 | self.__private = False |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
201 | self.__privatePartner = "" |
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
|
202 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
203 | self.__markerLine = "" |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
204 | self.__hidden = True |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
205 | |
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
|
206 | 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
|
207 | # :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
|
208 | # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message |
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
|
209 | (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), 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
|
210 | # :foo_!n=foo@foohost.bar.net JOIN :#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
|
211 | (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"), self.__userJoin), |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | # :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
|
213 | (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
|
214 | # :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
|
215 | (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
|
216 | # :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
|
217 | (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
|
218 | # :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
|
219 | (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
|
220 | # :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
|
221 | (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
|
222 | # :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
|
223 | (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
|
224 | self.__setUserPrivilege), |
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
|
225 | # :cameron.freenode.net MODE #testeric +ns |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
226 | (re.compile(r":([^ ]+)\sMODE\s([^ ]+)\s(.+)"), self.__updateChannelModes), |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
227 | # :sturgeon.freenode.net 301 foo_ bar :Gone away for now |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
228 | (re.compile(r":.*\s301\s([^ ]+)\s([^ ]+)\s:(.+)"), 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
|
229 | # :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
|
230 | (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
|
231 | # :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
|
232 | (re.compile(r":.*\s324\s.*\s([^ ]+)\s(.+)"), self.__channelModes), |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | # :zelazny.freenode.net 328 foo_ #eric-ide :http://www.buggeroff.com/ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | (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
|
235 | # :zelazny.freenode.net 329 foo_ #eric-ide 1353001005 |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | (re.compile(r":.*\s329\s.*\s([^ ]+)\s(.+)"), self.__channelCreated), |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | # :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
|
238 | (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
|
239 | # :zelazny.freenode.net foo_ 333 #eric-ide foo 1353089020 |
b7aceb255831
First 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 | (re.compile(r":.*\s333\s.*\s([^ ]+)\s([^ ]+)\s(\d+)"), self.__topicCreated), |
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
|
241 | # :cameron.freenode.net 352 detlev_ #eric-ide ~foo foohost.bar.net cameron.freenode.net foo_ H :0 Foo Bar |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
242 | (re.compile(r":.*\s352\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s[^ ]+\s([^ ]+)" |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
243 | 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
|
244 | # :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
|
245 | (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
|
246 | # :sturgeon.freenode.net 354 foo_ 42 ChanServ H@ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
247 | (re.compile(r":.*\s354\s[^ ]+\s42\s([^ ]+)\s(.*)"), 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
|
248 | # :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
|
249 | (re.compile(r":.*\s366\s.*\s([^ ]+)\s:(.*)"), self.__ignore), |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
250 | # :sturgeon.freenode.net 704 foo_ index :Help topics available to users: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
251 | (re.compile(r":.*\s70[456]\s[^ ]+\s([^ ]+)\s:(.*)"), self.__help), |
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
|
252 | ] |
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
|
253 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
254 | 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
|
255 | 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
|
256 | 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
|
257 | 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
|
258 | 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
|
259 | |
b7aceb255831
First 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 | @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
|
261 | 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
|
262 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | 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
|
264 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | 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
|
266 | if msg: |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
267 | self.messages.append( |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
268 | '<font color="{0}">{2} <b><</b><font color="{1}">{3}</font>' |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
269 | '<b>></b> {4}</font>'.format( |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
270 | Preferences.getIrc("ChannelMessageColour"), |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
271 | Preferences.getIrc("OwnNickColour"), |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
272 | ircTimestamp(), self.__userName, Utilities.html_encode(msg))) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
273 | if msg.startswith("/"): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
274 | if self.__private: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
275 | E5MessageBox.information(self, |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
276 | self.trUtf8("Send Message"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
277 | self.trUtf8("""Messages starting with a '/' are not allowed""" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
278 | """ in private chats.""")) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
279 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
280 | msgList = msg.split(None, 1) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
281 | cmd = msgList[0][1:].upper() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
282 | if cmd == "MSG": |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
283 | cmd = "PRIVMSG" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
284 | msgList[0] = cmd |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
285 | self.sendData.emit(" ".join(msgList)) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
286 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
287 | if self.__private: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
288 | self.sendData.emit("PRIVMSG " + self.__privatePartner + " :" + msg) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
289 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
290 | self.sendData.emit("PRIVMSG " + self.__name + " :" + msg) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
291 | self.messageEdit.clear() |
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
|
292 | 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
|
293 | |
b7aceb255831
First 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 | 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
|
295 | """ |
b7aceb255831
First 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 | 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
|
297 | """ |
b7aceb255831
First 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 | ok = E5MessageBox.yesNo(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
|
299 | self.trUtf8("Leave IRC 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
|
300 | self.trUtf8("""Do you really want to leave the IRC channel <b>{0}</b>?""")\ |
b7aceb255831
First 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 | .format(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
|
302 | if ok: |
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
|
303 | if not 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
|
304 | self.sendData.emit("PART " + self.__name + " :" + self.__partMessage) |
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
|
305 | self.channelClosed.emit(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
|
306 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | 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
|
308 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | 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
|
310 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | @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
|
312 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | 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
|
314 | |
b7aceb255831
First 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 | 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
|
316 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | 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
|
318 | |
b7aceb255831
First 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 | @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
|
320 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | 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
|
322 | |
b7aceb255831
First 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 | 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
|
324 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | 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
|
326 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | @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
|
328 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | 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
|
330 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | 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
|
332 | """ |
b7aceb255831
First 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 | 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
|
334 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | @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
|
336 | """ |
b7aceb255831
First 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 | 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
|
338 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | 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
|
340 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | 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
|
342 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | @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
|
344 | """ |
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
|
345 | 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
|
346 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | 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
|
348 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | 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
|
350 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | @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
|
352 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | 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
|
354 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | 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
|
356 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | 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
|
358 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | @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
|
360 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | 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
|
362 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
363 | 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
|
364 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
365 | 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
|
366 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
367 | @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
|
368 | @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
|
369 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
370 | self.__private = private |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
371 | self.__privatePartner = partner |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
372 | |
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
|
373 | 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
|
374 | """ |
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
|
375 | 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
|
376 | |
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
|
377 | @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
|
378 | """ |
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
|
379 | 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
|
380 | 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
|
381 | |
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
|
382 | 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
|
383 | """ |
b7aceb255831
First 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 | 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
|
385 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | @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
|
387 | @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
|
388 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | 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
|
390 | 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
|
391 | 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
|
392 | 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
|
393 | 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
|
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 | 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
|
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 | 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
|
398 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | 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
|
400 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | @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
|
402 | @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
|
403 | """ |
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
|
404 | # 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
|
405 | # 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
|
406 | # 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
|
407 | # group(4) message |
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
|
408 | if match.group(3).lower() == self.__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
|
409 | self.addMessage(match.group(1), match.group(4)) |
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
|
410 | if self.__private and not self.topicLabel.text(): |
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
|
411 | self.setPrivateInfo("{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
|
412 | 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
|
413 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | 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
|
415 | |
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
|
416 | 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
|
417 | """ |
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
|
418 | 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
|
419 | |
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
|
420 | @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
|
421 | @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
|
422 | """ |
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
|
423 | 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
|
424 | '<font color="{0}">{2} <b><</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
|
425 | '<b>></b> {4}</font>'.format( |
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
|
426 | Preferences.getIrc("ChannelMessageColour"), |
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
|
427 | Preferences.getIrc("NickColour"), |
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
|
428 | ircTimestamp(), sender, ircFilter(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
|
429 | 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
|
430 | if Preferences.getIrc("NotifyMessage"): |
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
|
431 | self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
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
|
432 | self.trUtf8("Channel Message"), 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
|
433 | elif Preferences.getIrc("NotifyNick") and \ |
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
|
434 | self.__userName.lower() in msg.lower(): |
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
|
435 | self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
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
|
436 | self.trUtf8("Nick mentioned"), 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
|
437 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
438 | def addUsers(self, users): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
439 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
440 | 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
|
441 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
442 | @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
|
443 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
444 | for user in users: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
445 | itm = self.__findUser(user) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
446 | if itm is None: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
447 | IrcUserItem(user, self.usersList) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
448 | |
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
|
449 | 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
|
450 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | 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
|
452 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | @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
|
454 | @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
|
455 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | if match.group(3).lower() == 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
|
457 | 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
|
458 | IrcUserItem(match.group(1), 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
|
459 | msg = self.trUtf8("{0} has joined the channel {1} ({2}).").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | match.group(1), self.__name, 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
|
461 | self.__addManagementMessage(IrcChannelWidget.JoinIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | 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
|
463 | msg = self.trUtf8("You have joined the channel {0} ({1}).").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | self.__name, 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
|
465 | self.__addManagementMessage(IrcChannelWidget.JoinIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | if Preferences.getIrc("ShowNotifications") and \ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | Preferences.getIrc("NotifyJoinPart"): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.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
|
469 | self.trUtf8("Join Channel"), msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | 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
|
471 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | 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
|
473 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | 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
|
475 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | 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
|
477 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | @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
|
479 | @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
|
480 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | if match.group(2).lower() == 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
|
482 | 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
|
483 | 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
|
484 | 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
|
485 | if match.lastindex == 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
|
486 | msg = self.trUtf8("{0} has left {1}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | match.group(1), self.__name) |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
488 | nmsg = 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
|
489 | self.__addManagementMessage(IrcChannelWidget.LeaveIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | 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
|
491 | msg = self.trUtf8("{0} has left {1}: {2}.").format( |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
492 | match.group(1), self.__name, ircFilter(match.group(3))) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
493 | nmsg = self.trUtf8("{0} has left {1}: {2}.").format( |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
494 | match.group(1), self.__name, match.group(3)) |
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
|
495 | self.__addManagementMessage(IrcChannelWidget.LeaveIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | if Preferences.getIrc("ShowNotifications") and \ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | Preferences.getIrc("NotifyJoinPart"): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
499 | self.trUtf8("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
|
500 | 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
|
501 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | 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
|
503 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | 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
|
505 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | 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
|
507 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | @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
|
509 | @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
|
510 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | 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
|
512 | 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
|
513 | 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
|
514 | 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
|
515 | if match.lastindex == 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
|
516 | msg = self.trUtf8("{0} has quit {1}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | match.group(1), 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
|
518 | self.__addManagementMessage(IrcChannelWidget.MessageIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | 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
|
520 | msg = self.trUtf8("{0} has quit {1}: {2}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | match.group(1), self.__name, ircFilter(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
|
522 | self.__addManagementMessage(IrcChannelWidget.MessageIndicator, msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | if Preferences.getIrc("ShowNotifications") and \ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | Preferences.getIrc("NotifyJoinPart"): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.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
|
526 | self.trUtf8("Quit"), msg) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
528 | # 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
|
529 | 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
|
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 __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
|
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 | 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
|
534 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | @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
|
536 | @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
|
537 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | if match.group(1) == 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
|
542 | self.__addManagementMessage(IrcChannelWidget.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
|
543 | self.trUtf8("You are now known as {0}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | 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
|
545 | 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
|
546 | 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
|
547 | self.__addManagementMessage(IrcChannelWidget.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
|
548 | self.trUtf8("User {0} is now known as {1}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | 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
|
550 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | # 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
|
552 | 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
|
553 | |
b7aceb255831
First 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 | 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
|
555 | """ |
b7aceb255831
First 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 | 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
|
557 | |
b7aceb255831
First 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 | @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
|
559 | @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
|
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 | if match.group(1).lower() == 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 | 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
|
563 | 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
|
564 | 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
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | itm.changePrivilege(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
|
570 | 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
|
571 | |
b7aceb255831
First 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 | 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
|
573 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
574 | def __userAway(self, match): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
575 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
576 | 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
|
577 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
578 | @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
|
579 | @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
|
580 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
581 | if match.group(1).lower() == self.__name: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
582 | self.__addManagementMessage(self.trUtf8("Away"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
583 | self.trUtf8("{0} is away: {1}").format(match.group(2), match.group(3))) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
584 | return True |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
585 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
586 | return False |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
587 | |
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
|
588 | 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
|
589 | """ |
b7aceb255831
First 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 | 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
|
591 | |
b7aceb255831
First 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 | @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
|
593 | @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
|
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 | if match.group(1).lower() == 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
|
596 | self.topicLabel.setText(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
|
597 | self.__addManagementMessage(IrcChannelWidget.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
|
598 | ircFilter(self.trUtf8('The channel topic is: "{0}".').format( |
b7aceb255831
First 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 | 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
|
600 | 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
|
601 | |
b7aceb255831
First 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 | 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
|
603 | |
b7aceb255831
First 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 | 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
|
605 | """ |
b7aceb255831
First 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 | 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
|
607 | |
b7aceb255831
First 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 | @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
|
609 | @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
|
610 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
611 | if match.group(1).lower() == 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
|
612 | self.__addManagementMessage(IrcChannelWidget.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
|
613 | self.trUtf8("The topic was set by {0} on {1}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
614 | match.group(2), QDateTime.fromTime_t(int(match.group(3)))\ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
615 | .toString("yyyy-MM-dd hh:mm"))) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
616 | 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
|
617 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
618 | 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
|
619 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
620 | 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
|
621 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
622 | 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
|
623 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
624 | @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
|
625 | @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
|
626 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
627 | if match.group(1).lower() == 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
|
628 | self.__addManagementMessage(IrcChannelWidget.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
|
629 | ircFilter(self.trUtf8("Channel URL: {0}").format(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
|
630 | 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
|
631 | |
b7aceb255831
First 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 | 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
|
633 | |
b7aceb255831
First 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 | 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
|
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 | 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
|
637 | |
b7aceb255831
First 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 | @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
|
639 | @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
|
640 | """ |
b7aceb255831
First 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 | if match.group(1).lower() == 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
|
642 | 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
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | 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
|
647 | 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
|
648 | 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
|
649 | 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
|
650 | parameter = 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
|
651 | modes.append( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | self.trUtf8("password protected ({0})").format(parameter)) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | 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
|
654 | parameter = 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
|
655 | modes.append( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | self.trUtf8("limited to %n user(s)", "", int(parameter))) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | 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
|
661 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | self.__addManagementMessage(IrcChannelWidget.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
|
663 | self.trUtf8("Channel modes: {0}.").format(", ".join(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
|
664 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
665 | 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
|
666 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
667 | 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
|
668 | |
b7aceb255831
First 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 | 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
|
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 | 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
|
672 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | @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
|
674 | @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
|
675 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
676 | if match.group(1).lower() == 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
|
677 | self.__addManagementMessage(IrcChannelWidget.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
|
678 | self.trUtf8("This channel was created on {0}.").format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
679 | QDateTime.fromTime_t(int(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
|
680 | .toString("yyyy-MM-dd hh:mm"))) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
681 | 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
|
682 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
683 | 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
|
684 | |
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
|
685 | 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
|
686 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
687 | 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
|
688 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
689 | @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
|
690 | @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
|
691 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
692 | # 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
|
693 | # 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
|
694 | # group(3) modes and parameter 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
|
695 | if match.group(2).lower() == self.__name: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
696 | 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
|
697 | 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
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | 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
|
702 | 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
|
703 | 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
|
704 | 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
|
705 | 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
|
706 | 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
|
707 | 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
|
708 | 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
|
709 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
710 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
711 | "{0} sets the channel mode to 'anonymous'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
712 | 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
|
713 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
714 | "{0} removes the 'anonymous' mode from the channel.").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
|
715 | nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
716 | 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
|
717 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
718 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
719 | "{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
|
720 | 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
|
721 | 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
|
722 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
723 | "{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
|
724 | 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
|
725 | 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
|
726 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
727 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
728 | "{0} sets the channel mode to 'no colors allowed'.").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
|
729 | nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
730 | 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
|
731 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
732 | "{0} sets the channel mode to 'allow color codes'.").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
|
733 | nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
734 | 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
|
735 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
736 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
737 | "{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
|
738 | 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
|
739 | 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
|
740 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
741 | "{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
|
742 | 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
|
743 | 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
|
744 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
745 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
746 | "{0} sets the channel mode to 'invite only'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
747 | 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
|
748 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
749 | "{0} removes the 'invite only' mode from the 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
|
750 | ).format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
751 | 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
|
752 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
753 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
754 | "{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
|
755 | 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
|
756 | 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
|
757 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
758 | "{0} removes the channel key.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
759 | elif mode == "l": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
760 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
761 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
762 | "{0} sets the channel limit to %n nick(s).", "", |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
763 | int(modesParameters.pop(0))).format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
764 | 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
|
765 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
766 | "{0} removes the channel limit.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
767 | elif mode == "m": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
768 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
769 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
770 | "{0} sets the channel mode to 'moderated'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
771 | 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
|
772 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
773 | "{0} sets the channel mode to 'unmoderated'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
774 | elif mode == "n": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
775 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
776 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
777 | "{0} sets the channel mode to 'no messages from outside'." |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
778 | ).format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
779 | 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
|
780 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
781 | "{0} sets the channel mode to 'allow messages from outside'." |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
782 | ).format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
783 | elif mode == "p": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
784 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
785 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
786 | "{0} sets the channel mode to 'private'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
787 | 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
|
788 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
789 | "{0} sets the channel mode to 'public'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
790 | elif mode == "q": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
791 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
792 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
793 | "{0} sets the channel mode to 'quiet'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
794 | 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
|
795 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
796 | "{0} removes the 'quiet' mode from the channel.").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
|
797 | nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
798 | elif mode == "r": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
799 | 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
|
800 | elif mode == "s": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
801 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
802 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
803 | "{0} sets the channel mode to 'secret'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
804 | 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
|
805 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
806 | "{0} sets the channel mode to 'visible'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
807 | elif mode == "t": |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
808 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
809 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
810 | "{0} switches on 'topic protection'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
811 | 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
|
812 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
813 | "{0} switches off 'topic protection'.").format(nick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
814 | 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
|
815 | if isPlus: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
816 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
817 | "{0} sets invitation mask {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
|
818 | 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
|
819 | 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
|
820 | message = self.trUtf8( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
821 | "{0} removes the invitation mask {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
|
822 | 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
|
823 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
824 | self.__addManagementMessage(self.trUtf8("Mode"), 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
|
825 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
826 | return 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
|
827 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
828 | return 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
|
829 | |
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
|
830 | def __setUserPrivilege(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
|
831 | """ |
b7aceb255831
First 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 | Private method to handle a change of user privileges 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
|
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 | @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
|
835 | @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
|
836 | """ |
b7aceb255831
First 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 | if match.group(2).lower() == 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
|
838 | itm = self.__findUser(match.group(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
|
839 | 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
|
840 | itm.changePrivilege(match.group(3)) |
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
|
841 | self.__addManagementMessage(IrcChannelWidget.MessageIndicator, |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
842 | self.trUtf8("{0} sets mode for {1}: {2}.").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
|
843 | match.group(1), match.group(4), match.group(3))) |
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
|
844 | 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
|
845 | |
b7aceb255831
First 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 | 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
|
847 | |
b7aceb255831
First 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 | def __ignore(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
|
849 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
850 | Private method to handle a channel message we are not interested in. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
851 | |
b7aceb255831
First 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 | @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
|
853 | @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
|
854 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | if match.group(1).lower() == 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
|
856 | 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
|
857 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | 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
|
859 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
860 | def __help(self, match): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
861 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
862 | Private method to handle a help message. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
863 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
864 | @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
|
865 | @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
|
866 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
867 | self.__addManagementMessage(self.trUtf8("Help"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
868 | "{0} {1}".format(match.group(1), ircFilter(match.group(2)))) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
869 | return True |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
870 | |
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
|
871 | def setUserPrivilegePrefix(self, prefixes): |
b7aceb255831
First 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 | """ |
b7aceb255831
First 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 | Public method to set the user privilege to prefix mapping. |
b7aceb255831
First 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 | |
b7aceb255831
First 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 | @param prefixes dictionary with privilege as key and prefix as value |
b7aceb255831
First 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 | """ |
b7aceb255831
First 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 | self.__prefixToPrivilege = {} |
b7aceb255831
First 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 | for privilege, prefix in prefixes.items(): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
879 | if prefix: |
b7aceb255831
First 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.__prefixToPrivilege[prefix] = 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
|
881 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | def __findUser(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
|
883 | """ |
b7aceb255831
First 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 | Private method to find the user in the list of 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
|
885 | |
b7aceb255831
First 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 | @param name user name to search for (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
|
887 | @return reference to the list entry (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
|
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 | for row in range(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
|
890 | itm = self.usersList.item(row) |
b7aceb255831
First 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 | if itm.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
|
892 | return 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
|
893 | |
b7aceb255831
First 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 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
|
895 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | def __extractPrivilege(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
|
897 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | Private method to extract the user privileges out of the 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
|
899 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
900 | @param name user name and prefixes (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
|
901 | return list of privileges and user name (list of string, 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
|
902 | """ |
b7aceb255831
First 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 | 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
|
904 | while name[0] in self.__prefixToPrivilege: |
b7aceb255831
First 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 | prefix = name[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
|
906 | privileges.append(self.__prefixToPrivilege[prefix]) |
b7aceb255831
First 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 | name = name[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
|
908 | if name[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
|
909 | name = name[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
|
910 | |
b7aceb255831
First 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 privileges, 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
|
912 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | def __addManagementMessage(self, indicator, 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
|
914 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
915 | Private method to add a channel management message to the 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
|
916 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | @param indicator indicator to be shown (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
|
918 | @param message message to be shown (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
|
919 | @keyparam isLocal flag indicating a message related to the local user (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
|
920 | """ |
b7aceb255831
First 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 | if indicator == self.JoinIndicator: |
b7aceb255831
First 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 | color = Preferences.getIrc("JoinChannelColour") |
b7aceb255831
First 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 | elif indicator == self.LeaveIndicator: |
b7aceb255831
First 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 | color = Preferences.getIrc("LeaveChannelColour") |
b7aceb255831
First 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 | 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
|
926 | color = Preferences.getIrc("ChannelInfoColour") |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
927 | self.__appendMessage( |
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
|
928 | '<font color="{0}">{1} <b>[</b>{2}<b>]</b> {3}</font>'.format( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
929 | color, ircTimestamp(), indicator, message)) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
930 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
931 | def __appendMessage(self, message): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
932 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
933 | Private slot to append a message. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
934 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
935 | if self.__hidden and self.__markerLine == "": |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
936 | self.setMarkerLine() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
937 | self.messages.append(message) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
938 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
939 | def setMarkerLine(self): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
940 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
941 | Public method to draw a line to mark the current position. |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
942 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
943 | self.unsetMarkerLine() |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
944 | # TODO: make colors configurable |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
945 | self.__markerLine = \ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
946 | '<span style=" color:#000000; background-color:#ffff00;">{0}</span>'.format( |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
947 | self.trUtf8('--- New From Here ---')) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
948 | self.messages.append(self.__markerLine) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
949 | |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
950 | def unsetMarkerLine(self): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
951 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
952 | Public method to remove the marker line. |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
953 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
954 | if self.__markerLine: |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
955 | txt = self.messages.toHtml() |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
956 | if txt.endswith(self.__markerLine + "</p></body></html>"): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
957 | # remove empty last paragraph |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
958 | pos = txt.rfind("<p") |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
959 | txt = txt[:pos] + "</body></html>" |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
960 | else: |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
961 | txt = txt.replace(self.__markerLine, "") |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
962 | self.messages.setHtml(txt) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
963 | self.__markerLine = "" |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
964 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
965 | def __clearMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
966 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
967 | Private slot to clear the contents of the messages display. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
968 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
969 | self.messages.clear() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
970 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
971 | def __copyMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
972 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
973 | Private slot to copy the selection of the messages display to the clipboard. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
974 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
975 | self.messages.copy() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
976 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
977 | def __cutMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
978 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
979 | Private slot to cut the selection of the messages display to the clipboard. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
980 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
981 | self.messages.cut() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
982 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
983 | def __copyAllMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
984 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
985 | Private slot to copy the contents of the messages display to the clipboard. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
986 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
987 | txt = self.messages.toPlainText() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
988 | if txt: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
989 | cb = QApplication.clipboard() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
990 | cb.setText(txt) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
991 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
992 | def __cutAllMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
993 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
994 | Private slot to cut the contents of the messages display to the clipboard. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
995 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
996 | txt = self.messages.toPlainText() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
997 | if txt: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
998 | cb = QApplication.clipboard() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
999 | cb.setText(txt) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1000 | self.messages.clear() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1001 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1002 | def __saveMessages(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1003 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1004 | Private slot to save the contents of the messages display. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1005 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1006 | hasText = not self.messages.document().isEmpty() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1007 | if hasText: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1008 | if Utilities.isWindowsPlatform(): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1009 | htmlExtension = "htm" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1010 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1011 | htmlExtension = "html" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1012 | fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1013 | self, |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1014 | self.trUtf8("Save Messages"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1015 | "", |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1016 | self.trUtf8( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1017 | "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)").format( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1018 | htmlExtension), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1019 | None, |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1020 | E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1021 | if fname: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1022 | ext = QFileInfo(fname).suffix() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1023 | if not ext: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1024 | ex = selectedFilter.split("(*")[1].split(")")[0] |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1025 | if ex: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1026 | fname += ex |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1027 | ext = QFileInfo(fname).suffix() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1028 | if QFileInfo(fname).exists(): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1029 | res = E5MessageBox.yesNo(self, |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1030 | self.trUtf8("Save Messages"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1031 | self.trUtf8("<p>The file <b>{0}</b> already exists." |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1032 | " Overwrite it?</p>").format(fname), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1033 | icon=E5MessageBox.Warning) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1034 | if not res: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1035 | return |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1036 | fname = Utilities.toNativeSeparators(fname) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1037 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1038 | try: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1039 | if ext.lower() in ["htm", "html"]: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1040 | txt = self.messages.toHtml() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1041 | else: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1042 | txt = self.messages.toPlainText() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1043 | f = open(fname, "w", encoding="utf-8") |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1044 | f.write(txt) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1045 | f.close() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1046 | except IOError as err: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1047 | E5MessageBox.critical(self, |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1048 | self.trUtf8("Error saving Messages"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1049 | self.trUtf8("""<p>The messages contents could not be written""" |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1050 | """ to <b>{0}</b></p><p>Reason: {1}</p>""")\ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1051 | .format(fname, str(err))) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1052 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1053 | def __initMessagesMenu(self): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1054 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1055 | Private slot to initialize the context menu of the messages pane. |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1056 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1057 | self.__messagesMenu = QMenu(self) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1058 | self.__cutMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1059 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1060 | UI.PixmapCache.getIcon("editCut.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1061 | self.trUtf8("Cut"), self.__cutMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1062 | self.__copyMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1063 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1064 | UI.PixmapCache.getIcon("editCopy.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1065 | self.trUtf8("Copy"), self.__copyMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1066 | self.__messagesMenu.addSeparator() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1067 | self.__cutAllMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1068 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1069 | UI.PixmapCache.getIcon("editCut.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1070 | self.trUtf8("Cut all"), self.__cutAllMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1071 | self.__copyAllMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1072 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1073 | UI.PixmapCache.getIcon("editCopy.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1074 | self.trUtf8("Copy all"), self.__copyAllMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1075 | self.__messagesMenu.addSeparator() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1076 | self.__clearMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1077 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1078 | UI.PixmapCache.getIcon("editDelete.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1079 | self.trUtf8("Clear"), self.__clearMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1080 | self.__messagesMenu.addSeparator() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1081 | self.__saveMessagesAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1082 | self.__messagesMenu.addAction( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1083 | UI.PixmapCache.getIcon("fileSave.png"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1084 | self.trUtf8("Save"), self.__saveMessages) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1085 | self.__messagesMenu.addSeparator() |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1086 | self.__setMarkerMessagesAct = \ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1087 | self.__messagesMenu.addAction(self.trUtf8("Mark Current Position"), |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1088 | self.setMarkerLine) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1089 | self.__unsetMarkerMessagesAct = \ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1090 | self.__messagesMenu.addAction(self.trUtf8("Remove Position Marker"), |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1091 | self.unsetMarkerLine) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1092 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1093 | self.on_messages_copyAvailable(False) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1094 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1095 | @pyqtSlot(bool) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1096 | def on_messages_copyAvailable(self, yes): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1097 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1098 | Private slot to react to text selection/deselection of the messages edit. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1099 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1100 | @param yes flag signaling the availability of selected text (boolean) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1101 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1102 | self.__copyMessagesAct.setEnabled(yes) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1103 | self.__cutMessagesAct.setEnabled(yes) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1104 | |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1105 | @pyqtSlot(QPoint) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1106 | def on_messages_customContextMenuRequested(self, pos): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1107 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1108 | Private slot to show the context menu of the messages pane. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1109 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1110 | @param pos the position of the mouse pointer (QPoint) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1111 | """ |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1112 | enable = not self.messages.document().isEmpty() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1113 | self.__cutAllMessagesAct.setEnabled(enable) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1114 | self.__copyAllMessagesAct.setEnabled(enable) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1115 | self.__saveMessagesAct.setEnabled(enable) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1116 | self.__setMarkerMessagesAct.setEnabled(self.__markerLine == "") |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1117 | self.__unsetMarkerMessagesAct.setEnabled(self.__markerLine != "") |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1118 | self.__messagesMenu.popup(self.messages.mapToGlobal(pos)) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1119 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1120 | def __whoIs(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1121 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1122 | Private slot to get information about the selected user. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1123 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1124 | # TODO: not implemented yet |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1125 | return |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1126 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1127 | def __openPrivateChat(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1128 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1129 | Private slot to open a chat with the selected user. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1130 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1131 | user = self.usersList.selectedItems()[0].text() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1132 | self.openPrivateChat.emit(user) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1133 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1134 | def __initUsersMenu(self): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1135 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1136 | Private slot to initialize the users list context menu. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1137 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1138 | self.__usersMenu = QMenu(self) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1139 | self.__usersMenu.addAction(self.trUtf8("Who Is"), self.__whoIs) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1140 | self.__usersMenu.addSeparator() |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1141 | self.__privateChatAct = \ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1142 | self.__usersMenu.addAction(self.trUtf8("Private Chat"), |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1143 | self.__openPrivateChat) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1144 | |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1145 | @pyqtSlot(QPoint) |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1146 | def on_usersList_customContextMenuRequested(self, pos): |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1147 | """ |
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1148 | Private slot to show the context menu of the users list. |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1149 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1150 | @param pos the position of the mouse pointer (QPoint) |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
1151 | """ |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1152 | self.__privateChatAct.setEnabled(not self.__private) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1153 | if len(self.usersList.selectedItems()) > 0: |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1154 | self.__usersMenu.popup(self.usersList.mapToGlobal(pos)) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1155 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1156 | def hideEvent(self, evt): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1157 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1158 | Protected method handling hide events. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1159 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1160 | @param evt reference to the hide event (QHideEvent) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1161 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1162 | self.__hidden = True |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1163 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1164 | def showEvent(self, evt): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1165 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1166 | Protected method handling show events. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1167 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1168 | @param evt reference to the show event (QShowEvent) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1169 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
1170 | self.__hidden = False |
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
|
1171 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1172 | def initAutoWho(self): |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1173 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1174 | Public method to initialize the Auto Who system. |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1175 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1176 | if Preferences.getIrc("AutoUserInfoLookup"): |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1177 | self.__autoWhoTimer.setInterval( |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1178 | Preferences.getIrc("AutoUserInfoInterval") * 1000) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1179 | self.__autoWhoTimer.start() |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1180 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1181 | @pyqtSlot() |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1182 | def __sendAutoWhoCommand(self): |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1183 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1184 | Private slot to send the WHO command to update the users 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
|
1185 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1186 | if self.usersList.count() <= Preferences.getIrc("AutoUserInfoMax"): |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1187 | self.__autoWhoRequested = 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
|
1188 | self.sendData.emit(self.__autoWhoTemplate.format(self.__name)) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1189 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1190 | def __autoWhoEntry(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
|
1191 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1192 | Private method to handle a WHO entry returned by the server as requested |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1193 | automatically. |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1194 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1195 | @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
|
1196 | @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
|
1197 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1198 | # group(1) nick |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1199 | # group(2) user 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
|
1200 | if self.__autoWhoRequested: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1201 | itm = self.__findUser(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
|
1202 | if itm: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1203 | itm.parseWhoFlags(match.group(2)) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1204 | return 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
|
1205 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1206 | return 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
|
1207 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1208 | def __whoEnd(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
|
1209 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1210 | Private method to handle the end of the 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
|
1211 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1212 | @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
|
1213 | @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
|
1214 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1215 | if match.group(1).lower() == self.__name: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1216 | if self.__autoWhoRequested: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1217 | self.__autoWhoRequested = 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
|
1218 | self.initAutoWho() |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1219 | 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
|
1220 | self.__addManagementMessage(self.trUtf8("Who"), |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1221 | self.trUtf8("End of /WHO list for {0}.").format(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
|
1222 | return 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
|
1223 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1224 | return 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
|
1225 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1226 | def __whoEntry(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
|
1227 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1228 | Private method to handle a WHO entry returned by the server as requested |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1229 | manually. |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1230 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1231 | @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
|
1232 | @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
|
1233 | """ |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1234 | # group(1) 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
|
1235 | # group(2) user |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1236 | # group(3) host |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1237 | # group(4) nick |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1238 | # group(5) user 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
|
1239 | # group(6) real name |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1240 | if match.group(2).lower() == self.__name: |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1241 | away = self.trUtf8(" (Away)") if match.group(5).startswith("G") 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
|
1242 | self.__addManagementMessage(self.trUtf8("Who"), |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1243 | self.trUtf8("{0} is {1}@{2} ({3}){4}").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
|
1244 | match.group(4), match.group(2), match.group(3), match.group(6), 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
|
1245 | return 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
|
1246 | |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
1247 | return 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
|
1248 |