Wed, 01 Jan 2014 14:39:32 +0100
Updated copyright for 2014.
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 | |
3161
06f57a834adf
Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3145
diff
changeset
|
3 | # Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the IRC window. |
b7aceb255831
First 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 | |
3145
a9de05d4a22f
# __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3060
diff
changeset
|
10 | from __future__ import unicode_literals |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2469
diff
changeset
|
11 | try: |
3145
a9de05d4a22f
# __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3060
diff
changeset
|
12 | str = unicode # __IGNORE_WARNING__ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2469
diff
changeset
|
13 | except (NameError): |
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2469
diff
changeset
|
14 | pass |
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2469
diff
changeset
|
15 | |
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 | 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
|
17 | import logging |
b7aceb255831
First 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 | |
2258
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
19 | from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QTimer |
2268
72ad198bf43e
Some fine tuning to the IRC widget for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2265
diff
changeset
|
20 | from PyQt4.QtGui import QWidget, QToolButton, QLabel, QTabWidget |
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
|
21 | from PyQt4.QtNetwork import QTcpSocket, QAbstractSocket |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
22 | try: |
2354
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
23 | from PyQt4.QtNetwork import QSslSocket, QSslConfiguration |
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
24 | from E5Network.E5SslErrorHandler import E5SslErrorHandler |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
25 | SSL_AVAILABLE = True |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
26 | except ImportError: |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
27 | SSL_AVAILABLE = 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
|
28 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | from E5Gui import E5MessageBox |
b7aceb255831
First 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 | from .Ui_IrcWidget import Ui_IrcWidget |
b7aceb255831
First 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 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | import Preferences |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | 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
|
35 | |
2268
72ad198bf43e
Some fine tuning to the IRC widget for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2265
diff
changeset
|
36 | from Globals import isMacPlatform |
72ad198bf43e
Some fine tuning to the IRC widget for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2265
diff
changeset
|
37 | |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
38 | from UI.Info import Version, Copyright |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
39 | |
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
|
40 | |
b7aceb255831
First 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 | class IrcWidget(QWidget, Ui_IrcWidget): |
b7aceb255831
First 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 | """ |
b7aceb255831
First 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 | Class implementing the IRC window. |
2258
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
44 | |
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
45 | @signal autoConnected() emitted after an automatic connection was initiated |
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
|
46 | """ |
2258
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
47 | autoConnected = pyqtSignal() |
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
48 | |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
49 | ServerDisconnected = 1 |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
50 | ServerConnected = 2 |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
51 | ServerConnecting = 3 |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
52 | |
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
|
53 | 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
|
54 | """ |
b7aceb255831
First 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 | 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
|
56 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | @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
|
58 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2469
diff
changeset
|
59 | super(IrcWidget, self).__init__(parent) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | 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
|
61 | |
2404
cba0ff902c2b
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2360
diff
changeset
|
62 | from .IrcNetworkManager import IrcNetworkManager |
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
|
63 | self.__ircNetworkManager = IrcNetworkManager(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
|
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 | self.__leaveButton = QToolButton(self) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
66 | self.__leaveButton.setIcon( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
67 | UI.PixmapCache.getIcon("ircCloseChannel.png")) |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
68 | self.__leaveButton.setToolTip( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
69 | self.trUtf8("Press to leave the current channel")) |
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
|
70 | self.__leaveButton.clicked[()].connect(self.__leaveChannel) |
b7aceb255831
First 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 | self.__leaveButton.setEnabled(False) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
72 | self.channelsWidget.setCornerWidget( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
73 | self.__leaveButton, Qt.BottomRightCorner) |
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
|
74 | self.channelsWidget.setTabsClosable(False) |
2268
72ad198bf43e
Some fine tuning to the IRC widget for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2265
diff
changeset
|
75 | if not isMacPlatform(): |
72ad198bf43e
Some fine tuning to the IRC widget for Mac.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2265
diff
changeset
|
76 | self.channelsWidget.setTabPosition(QTabWidget.South) |
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
|
77 | |
2271
7dd914b6eb7d
Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2268
diff
changeset
|
78 | height = self.height() |
7dd914b6eb7d
Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2268
diff
changeset
|
79 | self.splitter.setSizes([height * 0.6, height * 0.4]) |
7dd914b6eb7d
Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2268
diff
changeset
|
80 | |
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
|
81 | self.__channelList = [] |
b7aceb255831
First 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 | self.__channelTypePrefixes = "" |
b7aceb255831
First 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 | self.__userName = "" |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
84 | self.__identityName = "" |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
85 | self.__quitMessage = "" |
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
|
86 | self.__nickIndex = -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
|
87 | self.__nickName = "" |
b7aceb255831
First 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.__server = 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
|
89 | self.__registering = 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
|
90 | |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
91 | self.__connectionState = IrcWidget.ServerDisconnected |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
92 | self.__sslErrorLock = False |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
93 | |
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
|
94 | self.__buffer = "" |
b7aceb255831
First 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 | self.__userPrefix = {} |
b7aceb255831
First 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 | |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
97 | self.__socket = None |
2354
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
98 | if SSL_AVAILABLE: |
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
99 | self.__sslErrorHandler = E5SslErrorHandler(self) |
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
100 | else: |
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
101 | self.__sslErrorHandler = None |
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
|
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 | self.__patterns = [ |
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:
2253
diff
changeset
|
104 | # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
105 | (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
106 | self.__query), |
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
|
107 | # :foo.bar.net COMMAND some message |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
108 | (re.compile(r""":([^ ]+)\s+([A-Z]+)\s+(.+)"""), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
109 | self.__handleNamedMessage), |
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
|
110 | # :foo.bar.net 123 * :info |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
111 | (re.compile(r""":([^ ]+)\s+(\d{3})\s+(.+)"""), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
112 | self.__handleNumericMessage), |
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
|
113 | # PING :ping 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
|
114 | (re.compile(r"""PING\s+:(.*)"""), self.__ping), |
b7aceb255831
First 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 | ] |
b7aceb255831
First 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 | self.__prefixRe = re.compile(r""".*\sPREFIX=\((.*)\)([^ ]+).*""") |
b7aceb255831
First 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 | self.__chanTypesRe = re.compile(r""".*\sCHANTYPES=([^ ]+).*""") |
b7aceb255831
First 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 | |
b7aceb255831
First 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 | ircPic = UI.PixmapCache.getPixmap("irc128.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
|
120 | self.__emptyLabel = QLabel() |
b7aceb255831
First 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 | self.__emptyLabel.setPixmap(ircPic) |
b7aceb255831
First 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.__emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter) |
b7aceb255831
First 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 | self.channelsWidget.addTab(self.__emptyLabel, "") |
b7aceb255831
First 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 | |
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
|
125 | # all initialized, do connections now |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
126 | self.__ircNetworkManager.dataChanged.connect(self.__networkDataChanged) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
127 | self.networkWidget.initialize(self.__ircNetworkManager) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
128 | self.networkWidget.connectNetwork.connect(self.__connectNetwork) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
129 | self.networkWidget.editNetwork.connect(self.__editNetwork) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
130 | self.networkWidget.joinChannel.connect(self.__joinChannel) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
131 | self.networkWidget.nickChanged.connect(self.__changeNick) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
132 | self.networkWidget.sendData.connect(self.__send) |
7ba2af1ff785
Implemented support for the WHO command and the auto user status update function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2252
diff
changeset
|
133 | self.networkWidget.away.connect(self.__away) |
2258
9ca42fd3ecc0
Added a signal to the IRC widget fired after the autoconnect was initiated. This will make the IRC pane the current one on the right side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2256
diff
changeset
|
134 | self.networkWidget.autoConnected.connect(self.autoConnected) |
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
|
135 | |
b7aceb255831
First 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 | def shutdown(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
|
137 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | Public method to shut down the 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
|
139 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | @return flag indicating successful shutdown (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
|
141 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | if self.__server: |
2299
73285f9b53d4
Added an option to confirm a shutdown of eric5 when there is still a connection to an IRC server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2296
diff
changeset
|
143 | if Preferences.getIrc("AskOnShutdown"): |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
144 | ok = E5MessageBox.yesNo( |
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
145 | self, |
2299
73285f9b53d4
Added an option to confirm a shutdown of eric5 when there is still a connection to an IRC server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2296
diff
changeset
|
146 | self.trUtf8("Disconnect from Server"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
147 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
148 | """<p>Do you really want to disconnect from""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
149 | """ <b>{0}</b>?</p><p>All channels will be closed.""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
150 | """</p>""").format(self.__server.getName())) |
2299
73285f9b53d4
Added an option to confirm a shutdown of eric5 when there is still a connection to an IRC server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2296
diff
changeset
|
151 | else: |
73285f9b53d4
Added an option to confirm a shutdown of eric5 when there is still a connection to an IRC server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2296
diff
changeset
|
152 | ok = True |
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
|
153 | if ok: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | self.__socket.blockSignals(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
|
155 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
156 | self.__send("QUIT :" + self.__quitMessage) |
2265
72e6f479987b
Corrected some of the new display strings and completed the German translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2264
diff
changeset
|
157 | self.__socket.flush() |
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
|
158 | self.__socket.close() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | self.__socket.deleteLater() |
2296
da3757bc5218
Fixed an issue shutting down the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2292
diff
changeset
|
160 | self.__socket = None |
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 | 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
|
162 | ok = 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
|
163 | |
b7aceb255831
First 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 | if ok: |
b7aceb255831
First 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 | self.__ircNetworkManager.close() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | return ok |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
168 | def autoConnect(self): |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
169 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
170 | Public method to initiate the IRC auto connection. |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
171 | """ |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
172 | self.networkWidget.autoConnect() |
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
173 | |
2339
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
174 | def __connectNetwork(self, name, connect, silent=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
|
175 | """ |
b7aceb255831
First 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 | Private slot to connect to or disconnect from the given network. |
b7aceb255831
First 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 | @param name name of the network to connect to (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
|
179 | @param connect flag indicating to connect (boolean) |
2339
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
180 | @keyparam silent flag indicating a silent connect/disconnect (boolean) |
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
|
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 | if connect: |
b7aceb255831
First 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 | network = self.__ircNetworkManager.getNetwork(name) |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
184 | if network: |
2237
baddb671c326
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2236
diff
changeset
|
185 | self.__server = network.getServer() |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
186 | self.__identityName = network.getIdentityName() |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
187 | identity = self.__ircNetworkManager.getIdentity( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
188 | self.__identityName) |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
189 | self.__userName = identity.getIdent() |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
190 | self.__quitMessage = identity.getQuitMessage() |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
191 | if self.__server: |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
192 | useSSL = self.__server.useSSL() |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
193 | if useSSL and not SSL_AVAILABLE: |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
194 | E5MessageBox.critical( |
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
195 | self, |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
196 | self.trUtf8("SSL Connection"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
197 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
198 | """An encrypted connection to the IRC""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
199 | """ network was requested but SSL is not""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
200 | """ available. Please change the server""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
201 | """ configuration.""")) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
202 | return |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
203 | |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
204 | if useSSL: |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
205 | # create SSL socket |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
206 | self.__socket = QSslSocket(self) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
207 | self.__socket.encrypted.connect(self.__hostConnected) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
208 | self.__socket.sslErrors.connect(self.__sslErrors) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
209 | else: |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
210 | # create TCP socket |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
211 | self.__socket = QTcpSocket(self) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
212 | self.__socket.connected.connect(self.__hostConnected) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
213 | self.__socket.hostFound.connect(self.__hostFound) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
214 | self.__socket.disconnected.connect(self.__hostDisconnected) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
215 | self.__socket.readyRead.connect(self.__readyRead) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
216 | self.__socket.error.connect(self.__tcpError) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
217 | |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
218 | self.__connectionState = IrcWidget.ServerConnecting |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
219 | if useSSL: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
220 | self.networkWidget.addServerMessage( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
221 | self.trUtf8("Info"), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
222 | self.trUtf8("Looking for server {0} (port {1})" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
223 | " using an SSL encrypted connection" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
224 | "...").format(self.__server.getName(), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
225 | self.__server.getPort())) |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
226 | self.__socket.connectToHostEncrypted( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
227 | self.__server.getName(), self.__server.getPort()) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
228 | else: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
229 | self.networkWidget.addServerMessage( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
230 | self.trUtf8("Info"), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
231 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
232 | "Looking for server {0} (port {1})...").format( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
233 | self.__server.getName(), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
234 | self.__server.getPort())) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
235 | self.__socket.connectToHost(self.__server.getName(), |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
236 | self.__server.getPort()) |
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
|
237 | else: |
2339
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
238 | if silent: |
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
239 | ok = True |
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
240 | else: |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
241 | ok = E5MessageBox.yesNo( |
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2992
diff
changeset
|
242 | self, |
2339
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
243 | self.trUtf8("Disconnect from Server"), |
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
244 | self.trUtf8("""<p>Do you really want to disconnect from""" |
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
245 | """ <b>{0}</b>?</p><p>All channels will be""" |
3034
7ce719013078
Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3022
diff
changeset
|
246 | """ closed.</p>""") |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
247 | .format(self.__server.getName())) |
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 | if ok: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
249 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
250 | self.trUtf8("Info"), |
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
|
251 | self.trUtf8("Disconnecting from server {0}...").format( |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
252 | self.__server.getName())) |
2336
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
253 | self.__closeAllChannels() |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
254 | self.__send("QUIT :" + self.__quitMessage) |
2265
72e6f479987b
Corrected some of the new display strings and completed the German translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2264
diff
changeset
|
255 | self.__socket and self.__socket.flush() |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
256 | self.__socket and self.__socket.close() |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
257 | self.__userName = "" |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
258 | self.__identityName = "" |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
259 | self.__quitMessage = "" |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | |
b7aceb255831
First 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 __editNetwork(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
|
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 edit the network configuration. |
b7aceb255831
First 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 | @param name name of the network to edit (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
|
266 | """ |
2404
cba0ff902c2b
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2360
diff
changeset
|
267 | from .IrcNetworkListDialog import IrcNetworkListDialog |
2232
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
268 | dlg = IrcNetworkListDialog(self.__ircNetworkManager, self) |
47290dad6d0b
Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2227
diff
changeset
|
269 | dlg.exec_() |
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
|
270 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
271 | def __networkDataChanged(self): |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
272 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
273 | Private slot handling changes of the network and identity definitions. |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
274 | """ |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
275 | identity = self.__ircNetworkManager.getIdentity(self.__identityName) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
276 | if identity: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
277 | partMsg = identity.getPartMessage() |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
278 | for channel in self.__channelList: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
279 | channel.setPartMessage(partMsg) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
280 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
281 | def __joinChannel(self, name, key=""): |
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
|
282 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | Private slot to join a 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
|
284 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | @param name name of the channel (string) |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
286 | @param key key of the channel (string) |
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
|
287 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | # step 1: check, if this channel is already joined |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | for channel in self.__channelList: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | if channel.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
|
291 | return |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | |
2404
cba0ff902c2b
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2360
diff
changeset
|
293 | from .IrcChannelWidget import IrcChannelWidget |
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
|
294 | channel = IrcChannelWidget(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 | channel.setName(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
|
296 | channel.setUserName(self.__nickName) |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
297 | identity = self.__ircNetworkManager.getIdentity(self.__identityName) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
298 | channel.setPartMessage(identity.getPartMessage()) |
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
|
299 | channel.setUserPrivilegePrefix(self.__userPrefix) |
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
|
300 | channel.initAutoWho() |
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
|
301 | |
b7aceb255831
First 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 | channel.sendData.connect(self.__send) |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
303 | channel.sendCtcpReply.connect(self.__sendCtcpReply) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | channel.channelClosed.connect(self.__closeChannel) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
305 | channel.openPrivateChat.connect(self.__openPrivate) |
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
|
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 | self.channelsWidget.addTab(channel, 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
|
308 | self.__channelList.append(channel) |
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
|
309 | self.channelsWidget.setCurrentWidget(channel) |
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
|
310 | |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
311 | joinCommand = ["JOIN", name] |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
312 | if key: |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
313 | joinCommand.append(key) |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
314 | self.__send(" ".join(joinCommand)) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | self.__send("MODE " + 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 | emptyIndex = self.channelsWidget.indexOf(self.__emptyLabel) |
b7aceb255831
First 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 | if emptyIndex > -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
|
319 | self.channelsWidget.removeTab(emptyIndex) |
b7aceb255831
First 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 | self.__leaveButton.setEnabled(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
|
321 | self.channelsWidget.setTabsClosable(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
|
322 | |
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:
2253
diff
changeset
|
323 | def __query(self, match): |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
324 | """ |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
325 | Private method to handle a new private connection. |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
326 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
327 | @param match reference to the match object |
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:
2253
diff
changeset
|
328 | @return flag indicating, if the message was handled (boolean) |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
329 | """ |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
330 | # 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:
2253
diff
changeset
|
331 | # 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:
2253
diff
changeset
|
332 | # 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:
2253
diff
changeset
|
333 | # group(4) message |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
334 | if match.group(4).startswith("\x01"): |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
335 | return self.__handleCtcp(match) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
336 | |
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:
2253
diff
changeset
|
337 | self.__openPrivate(match.group(1)) |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
338 | # the above call sets the new channel as the current widget |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
339 | channel = self.channelsWidget.currentWidget() |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
340 | channel.addMessage(match.group(1), match.group(4)) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
341 | channel.setPrivateInfo( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
342 | "{0} - {1}".format(match.group(1), match.group(2))) |
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:
2253
diff
changeset
|
343 | |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
344 | return True |
3e728bfc178c
Added a specialized line edit for entering IRC messages, which supports a non-persistent edit history.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2253
diff
changeset
|
345 | |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
346 | @pyqtSlot(str) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
347 | def __openPrivate(self, name): |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
348 | """ |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
349 | Private slot to open a private chat with the given user. |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
350 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
351 | @param name name of the user (string) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
352 | """ |
2404
cba0ff902c2b
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2360
diff
changeset
|
353 | from .IrcChannelWidget import IrcChannelWidget |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
354 | channel = IrcChannelWidget(self) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
355 | channel.setName(self.__nickName) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
356 | channel.setUserName(self.__nickName) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
357 | identity = self.__ircNetworkManager.getIdentity(self.__identityName) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
358 | channel.setPartMessage(identity.getPartMessage()) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
359 | channel.setUserPrivilegePrefix(self.__userPrefix) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
360 | channel.setPrivate(True, name) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
361 | channel.addUsers([name, self.__nickName]) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
362 | |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
363 | channel.sendData.connect(self.__send) |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
364 | channel.sendCtcpReply.connect(self.__sendCtcpReply) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
365 | channel.channelClosed.connect(self.__closeChannel) |
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 | self.channelsWidget.addTab(channel, name) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
368 | self.__channelList.append(channel) |
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
|
369 | self.channelsWidget.setCurrentWidget(channel) |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
370 | |
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
|
371 | @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
|
372 | def __leaveChannel(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
|
373 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | Private slot to leave a channel and close the associated tab. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | channel = self.channelsWidget.currentWidget() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | channel.requestLeave() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
378 | |
2336
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
379 | def __closeAllChannels(self): |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
380 | """ |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
381 | Private method to close all channels. |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
382 | """ |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
383 | while self.__channelList: |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
384 | channel = self.__channelList.pop() |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
385 | self.channelsWidget.removeTab(self.channelsWidget.indexOf(channel)) |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
386 | channel.deleteLater() |
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
387 | channel = None |
2469
20d2166280bb
Fixed an issue in the IRC widget when disconnecting from the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2404
diff
changeset
|
388 | |
20d2166280bb
Fixed an issue in the IRC widget when disconnecting from the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2404
diff
changeset
|
389 | self.channelsWidget.addTab(self.__emptyLabel, "") |
20d2166280bb
Fixed an issue in the IRC widget when disconnecting from the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2404
diff
changeset
|
390 | self.__emptyLabel.show() |
20d2166280bb
Fixed an issue in the IRC widget when disconnecting from the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2404
diff
changeset
|
391 | self.__leaveButton.setEnabled(False) |
20d2166280bb
Fixed an issue in the IRC widget when disconnecting from the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2404
diff
changeset
|
392 | self.channelsWidget.setTabsClosable(False) |
2336
d9e47b8ee1ef
Fixed an issue with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
393 | |
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
|
394 | def __closeChannel(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
|
395 | """ |
b7aceb255831
First 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 | Private slot handling the closing of a 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
|
397 | |
2280
8e85ca3fabe7
Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2279
diff
changeset
|
398 | @param name name of the closed channel (string) |
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
|
399 | """ |
b7aceb255831
First 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 | for channel in self.__channelList: |
b7aceb255831
First 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 | if channel.name() == name: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
402 | self.channelsWidget.removeTab( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
403 | self.channelsWidget.indexOf(channel)) |
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
|
404 | self.__channelList.remove(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
|
405 | channel.deleteLater() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | if self.channelsWidget.count() == 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
|
408 | self.channelsWidget.addTab(self.__emptyLabel, "") |
2271
7dd914b6eb7d
Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2268
diff
changeset
|
409 | self.__emptyLabel.show() |
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
|
410 | self.__leaveButton.setEnabled(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
|
411 | self.channelsWidget.setTabsClosable(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
|
412 | |
b7aceb255831
First 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 | @pyqtSlot(int) |
b7aceb255831
First 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 | def on_channelsWidget_tabCloseRequested(self, index): |
b7aceb255831
First 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 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | Private slot to close a channel by pressing the close button of |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | the channels 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
|
418 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | @param index index of the tab to be closed (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
|
420 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | channel = self.channelsWidget.widget(index) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | channel.requestLeave() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | def __send(self, data): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | Private slot to send data to the IRC 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
|
427 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | @param data data to be sent (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
|
429 | """ |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
430 | if self.__socket: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
431 | self.__socket.write( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
432 | QByteArray("{0}\r\n".format(data).encode("utf-8"))) |
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
|
433 | |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
434 | def __sendCtcpReply(self, receiver, text): |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
435 | """ |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
436 | Private slot to send a CTCP reply. |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
437 | |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
438 | @param receiver nick name of the receiver (string) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
439 | @param text text to be sent (string) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
440 | """ |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
441 | self.__send("NOTICE {0} :\x01{1}\x01".format(receiver, text)) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
442 | |
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
|
443 | def __hostFound(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
|
444 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | Private slot to indicate the host was found. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | """ |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
447 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
448 | self.trUtf8("Info"), |
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 | self.trUtf8("Server found,connecting...")) |
b7aceb255831
First 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 | def __hostConnected(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
|
452 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
453 | Private slot to log in to the server after the connection was |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
454 | established. |
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
|
455 | """ |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
456 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
457 | self.trUtf8("Info"), |
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
|
458 | self.trUtf8("Connected,logging 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
|
459 | self.networkWidget.setConnected(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
|
460 | |
b7aceb255831
First 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.__registering = 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
|
462 | serverPassword = self.__server.getPassword() |
b7aceb255831
First 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 | if serverPassword: |
b7aceb255831
First 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.__send("PASS " + serverPassword) |
b7aceb255831
First 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 | nick = self.networkWidget.getNickname() |
b7aceb255831
First 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 not nick: |
b7aceb255831
First 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 | self.__nickIndex = 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
|
468 | try: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
469 | nick = self.__ircNetworkManager.getIdentity( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
470 | self.__identityName).getNickNames()[self.__nickIndex] |
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
|
471 | except IndexError: |
b7aceb255831
First 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 | nick = "" |
b7aceb255831
First 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 | if not nick: |
b7aceb255831
First 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 | nick = 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
|
475 | self.__nickName = nick |
b7aceb255831
First 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 | self.networkWidget.setNickName(nick) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
477 | realName = self.__ircNetworkManager.getIdentity( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
478 | self.__identityName).getRealName() |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
479 | if not realName: |
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
480 | realName = "eric IDE chat" |
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
|
481 | self.__send("NICK " + nick) |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
482 | self.__send("USER " + self.__userName + " 0 * :" + realName) |
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
|
483 | |
b7aceb255831
First 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 | def __hostDisconnected(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
|
485 | """ |
b7aceb255831
First 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 | Private slot to indicate the host was disconnected. |
b7aceb255831
First 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 | """ |
2528
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
488 | if self.networkWidget.isConnected(): |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
489 | self.__closeAllChannels() |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
490 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
491 | self.trUtf8("Info"), |
2528
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
492 | self.trUtf8("Server disconnected.")) |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
493 | self.networkWidget.setRegistered(False) |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
494 | self.networkWidget.setConnected(False) |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
495 | self.__server = None |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
496 | self.__nickName = "" |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
497 | self.__nickIndex = -1 |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
498 | self.__channelTypePrefixes = "" |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
499 | |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
500 | self.__socket.deleteLater() |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
501 | self.__socket = None |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
502 | |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
503 | self.__connectionState = IrcWidget.ServerDisconnected |
688c7ef0a5b0
Fixed another situation in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2527
diff
changeset
|
504 | self.__sslErrorLock = 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
|
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 | def __readyRead(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
|
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 | Private slot to read data from the socket. |
b7aceb255831
First 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 | """ |
2527
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
510 | if self.__socket: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
511 | self.__buffer += str( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
512 | self.__socket.readAll(), |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
513 | Preferences.getSystem("IOEncoding"), |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
514 | 'replace') |
2527
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
515 | if self.__buffer.endswith("\r\n"): |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
516 | for line in self.__buffer.splitlines(): |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
517 | line = line.strip() |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
518 | if line: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
519 | logging.debug("<IRC> " + line) |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
520 | handled = False |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
521 | # step 1: give channels a chance to handle the message |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
522 | for channel in self.__channelList: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
523 | handled = channel.handleMessage(line) |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
524 | if handled: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
525 | break |
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
|
526 | else: |
2527
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
527 | # step 2: try to process the message ourselves |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
528 | for patternRe, patternFunc in self.__patterns: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
529 | match = patternRe.match(line) |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
530 | if match is not None: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
531 | if patternFunc(match): |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
532 | break |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
533 | else: |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
534 | # Oops, the message wasn't handled |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
535 | self.networkWidget.addErrorMessage( |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
536 | self.trUtf8("Message Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
537 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
538 | "Unknown message received from server:" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
539 | "<br/>{0}").format(line)) |
2527
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
540 | |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
541 | self.__updateUsersCount() |
867488bb56b0
Fixed an issue in the IRC widget, that could cause a stack trace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2469
diff
changeset
|
542 | self.__buffer = "" |
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
|
543 | |
b7aceb255831
First 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 | def __handleNamedMessage(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
|
545 | """ |
b7aceb255831
First 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 | Private method to handle a server message containing a message 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
|
547 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
548 | @param match reference to the match object |
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
|
549 | @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
|
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 | 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
|
552 | if name == "NOTICE": |
b7aceb255831
First 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 | try: |
b7aceb255831
First 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 | msg = match.group(3).split(":", 1)[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
|
555 | except IndexError: |
b7aceb255831
First 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 | msg = 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
|
557 | if "!" in 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
|
558 | name = match.group(1).split("!", 1)[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
|
559 | msg = "-{0}- {1}".format(name, 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
|
560 | self.networkWidget.addServerMessage(self.trUtf8("Notice"), 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
|
561 | 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
|
562 | elif name == "MODE": |
b7aceb255831
First 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 | self.__registering = 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
|
564 | if ":" in 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
|
565 | # :detlev_ MODE detlev_ :+i |
b7aceb255831
First 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 | name, modes = match.group(3).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
|
567 | sourceNick = match.group(1) |
2256
d07e2e6f3c56
Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2255
diff
changeset
|
568 | if not self.isChannelName(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
|
569 | if name == self.__nickName: |
b7aceb255831
First 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 | if sourceNick == self.__nickName: |
b7aceb255831
First 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 | msg = self.trUtf8( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
572 | "You have set your personal modes to" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
573 | " <b>[{0}]</b>.").format(modes) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | 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
|
575 | msg = self.trUtf8( |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
576 | "{0} has changed your personal modes to" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
577 | " <b>[{1}]</b>.").format(sourceNick, modes) |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | self.networkWidget.addServerMessage( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | self.trUtf8("Mode"), msg, filterMsg=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
|
580 | 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
|
581 | elif name == "PART": |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
582 | nick = match.group(1).split("!", 1)[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
|
583 | if nick == self.__nickName: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
584 | channel = match.group(3).split(None, 1)[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
|
585 | self.networkWidget.addMessage( |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
586 | self.trUtf8("You have left channel {0}.").format(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
|
587 | return True |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
588 | elif name == "QUIT": |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
589 | # don't do anything with it here |
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
590 | return True |
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
|
591 | elif name == "NICK": |
b7aceb255831
First 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 | # :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
|
593 | oldNick = match.group(1).split("!", 1)[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
|
594 | newNick = match.group(3).split(":", 1)[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
|
595 | if oldNick == self.__nickName: |
b7aceb255831
First 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.networkWidget.addMessage( |
b7aceb255831
First 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.trUtf8("You are now known as {0}.").format(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
|
598 | self.__nickName = 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
|
599 | self.networkWidget.setNickName(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
|
600 | 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
|
601 | self.networkWidget.addMessage( |
b7aceb255831
First 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 | self.trUtf8("User {0} is now known as {1}.").format( |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
603 | oldNick, newNick)) |
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
|
604 | return True |
2252
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
605 | elif name == "ERROR": |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
606 | self.networkWidget.addErrorMessage( |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
607 | self.trUtf8("Server Error"), match.group(3).split(":", 1)[1]) |
1fc32bd13be3
Continued with the implementation of the simple IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2246
diff
changeset
|
608 | return True |
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
|
609 | |
b7aceb255831
First 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 | 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
|
611 | |
b7aceb255831
First 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 | def __handleNumericMessage(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
|
613 | """ |
b7aceb255831
First 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 | Private method to handle a server message containing a numeric code. |
b7aceb255831
First 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 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
616 | @param match reference to the match object |
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
|
617 | @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
|
618 | """ |
b7aceb255831
First 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 | code = 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
|
620 | if code < 400: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
621 | return self.__handleServerReply( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
622 | code, match.group(1), 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
|
623 | else: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
624 | return self.__handleServerError( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
625 | code, match.group(1), 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
|
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 | def __handleServerError(self, code, server, 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
|
628 | """ |
b7aceb255831
First 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 | Private slot to handle a server error reply. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
630 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
631 | @param code numerical code sent by the server (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
|
632 | @param server name of the server (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
|
633 | @param message message sent by the server (string) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
634 | @return flag indicating, if the message was handled (boolean) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
636 | if code == 433: |
b7aceb255831
First 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 | if self.__registering: |
b7aceb255831
First 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 | self.__handleNickInUseLogin() |
b7aceb255831
First 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 | 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
|
640 | self.__handleNickInUse() |
b7aceb255831
First 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 | 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
|
642 | self.networkWidget.addServerMessage(self.trUtf8("Error"), 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
|
643 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | 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
|
645 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
646 | def __handleServerReply(self, code, server, 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
|
647 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | Private slot to handle a server reply. |
b7aceb255831
First 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 | |
b7aceb255831
First 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 | @param code numerical code sent by the server (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
|
651 | @param server name of the server (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
|
652 | @param message message sent by the server (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
|
653 | @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
|
654 | """ |
b7aceb255831
First 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 | # determine message type |
b7aceb255831
First 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 | if code in [1, 2, 3, 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
|
657 | msgType = self.trUtf8("Welcome") |
b7aceb255831
First 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 | elif code == 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
|
659 | msgType = self.trUtf8("Support") |
b7aceb255831
First 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 | elif code in [250, 251, 252, 253, 254, 255, 265, 266]: |
b7aceb255831
First 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 | msgType = self.trUtf8("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
|
662 | elif code in [372, 375, 376]: |
b7aceb255831
First 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 | msgType = self.trUtf8("MOTD") |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
664 | elif code in [305, 306]: |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
665 | msgType = self.trUtf8("Away") |
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
|
666 | 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
|
667 | msgType = self.trUtf8("Info ({0})").format(code) |
b7aceb255831
First 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 | # special treatment for some messages |
b7aceb255831
First 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 | if code == 375: |
b7aceb255831
First 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 | message = self.trUtf8("Message of the day") |
b7aceb255831
First 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 | elif code == 376: |
b7aceb255831
First 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 | message = self.trUtf8("End of message of the day") |
b7aceb255831
First 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 | elif code == 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
|
675 | parts = message.strip().split() |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
676 | message = self.trUtf8( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
677 | "Server {0} (Version {1}), User-Modes: {2}," |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
678 | " Channel-Modes: {3}")\ |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
679 | .format(parts[1], parts[2], parts[3], parts[4]) |
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
|
680 | elif code == 265: |
b7aceb255831
First 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 | parts = message.strip().split() |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
682 | message = self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
683 | "Current users on {0}: {1}, max. {2}").format( |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
684 | server, parts[1], parts[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
|
685 | elif code == 266: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
686 | parts = message.strip().split() |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
687 | message = self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
688 | "Current users on the network: {0}, max. {1}").format( |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
689 | parts[1], parts[2]) |
2245
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
690 | elif code == 305: |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
691 | message = self.trUtf8("You are no longer marked as being away.") |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
692 | elif code == 306: |
cbddacb4bc2e
Added code to manually set the AWAY status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2244
diff
changeset
|
693 | message = self.trUtf8("You have been marked as being away.") |
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
|
694 | 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
|
695 | first, message = message.split(None, 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
|
696 | if message.startswith(":"): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
697 | message = message[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
|
698 | 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
|
699 | message = message.replace(":", "", 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
|
700 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
701 | self.networkWidget.addServerMessage(msgType, 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
|
702 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
703 | if code == 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
|
704 | # register with services after the welcome message |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
705 | self.__connectionState = IrcWidget.ServerConnected |
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
|
706 | self.__registerWithServices() |
2244
654aaddbc2b9
Added the messages marker stuff to the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2243
diff
changeset
|
707 | self.networkWidget.setRegistered(True) |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
708 | QTimer.singleShot(1000, self.__autoJoinChannels) |
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
|
709 | elif code == 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
|
710 | # extract the user privilege 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
|
711 | # ... PREFIX=(ov)@+ ... |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
712 | m = self.__prefixRe.match(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
|
713 | if m: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
714 | self.__setUserPrivilegePrefix(m.group(1), m.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
|
715 | # extract the channel type 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
|
716 | # ... CHANTYPES=# ... |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
717 | m = self.__chanTypesRe.match(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
|
718 | if m: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
719 | self.__setChannelTypePrefixes(m.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
|
720 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
721 | 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
|
722 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
723 | def __registerWithServices(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
|
724 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
725 | Private method to register to services. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
726 | """ |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
727 | identity = self.__ircNetworkManager.getIdentity(self.__identityName) |
2240
11445430c553
Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2237
diff
changeset
|
728 | service = identity.getServiceName() |
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
|
729 | password = identity.getPassword() |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
730 | if service and password: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
731 | self.__send("PRIVMSG " + service + " :identify " + password) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
732 | |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
733 | def __autoJoinChannels(self): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
734 | """ |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
735 | Private slot to join channels automatically once a server got |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
736 | connected. |
2234
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
737 | """ |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
738 | for channel in self.networkWidget.getNetworkChannels(): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
739 | if channel.autoJoin(): |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
740 | name = channel.getName() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
741 | key = channel.getKey() |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
742 | self.__joinChannel(name, key) |
1e33501a0d33
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2232
diff
changeset
|
743 | |
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
|
744 | def __tcpError(self, error): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
745 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
746 | Private slot to handle errors reported by the TCP socket. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
747 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
748 | @param error error code reported by the socket |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
749 | (QAbstractSocket.SocketError) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
751 | if error == QAbstractSocket.RemoteHostClosedError: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | # ignore this one, it's a disconnect |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
753 | if self.__sslErrorLock: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
754 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
755 | self.trUtf8("SSL Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
756 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
757 | """Connection to server {0} (port {1}) lost while""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
758 | """ waiting for user response to an SSL error.""") |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
759 | .format(self.__server.getName(), self.__server.getPort())) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
760 | self.__connectionState = IrcWidget.ServerDisconnected |
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
|
761 | elif error == QAbstractSocket.HostNotFoundError: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
762 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
763 | self.trUtf8("Socket Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
764 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
765 | "The host was not found. Please check the host name" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
766 | " and port settings.")) |
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
|
767 | elif error == QAbstractSocket.ConnectionRefusedError: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
768 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
769 | self.trUtf8("Socket Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
770 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
771 | "The connection was refused by the peer. Please check the" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
772 | " host name and port settings.")) |
2292
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
773 | elif error == QAbstractSocket.SslHandshakeFailedError: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
774 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
775 | self.trUtf8("Socket Error"), |
2292
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
776 | self.trUtf8("The SSL handshake failed.")) |
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
777 | else: |
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
778 | if self.__socket: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
779 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
780 | self.trUtf8("Socket Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
781 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
782 | "The following network error occurred:<br/>{0}") |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
783 | .format(self.__socket.errorString())) |
2292
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
784 | else: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
785 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
786 | self.trUtf8("Socket Error"), |
2292
1e29752b51d7
Fixed an issue in the IRC widget and updated the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2280
diff
changeset
|
787 | self.trUtf8("A network error occurred.")) |
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
|
788 | |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
789 | def __sslErrors(self, errors): |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
790 | """ |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
791 | Private slot to handle SSL errors. |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
792 | |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
793 | @param errors list of SSL errors (list of QSslError) |
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
794 | """ |
2360
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
795 | ignored, defaultChanged = self.__sslErrorHandler.sslErrors( |
2354
c63de4af553d
Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2339
diff
changeset
|
796 | errors, self.__server.getName(), self.__server.getPort()) |
2360
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
797 | if ignored == E5SslErrorHandler.NotIgnored: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
798 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
799 | self.trUtf8("SSL Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
800 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
801 | """Could not connect to {0} (port {1}) using an SSL""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
802 | """ encrypted connection. Either the server does not""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
803 | """ support SSL (did you use the correct port?) or""" |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
804 | """ you rejected the certificate.""") |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
805 | .format(self.__server.getName(), self.__server.getPort())) |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
806 | self.__socket.close() |
2360
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
807 | else: |
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
808 | if defaultChanged: |
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
809 | self.__socket.setSslConfiguration( |
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
810 | QSslConfiguration.defaultConfiguration()) |
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
811 | if ignored == E5SslErrorHandler.UserIgnored: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
812 | self.networkWidget.addErrorMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
813 | self.trUtf8("SSL Error"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
814 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
815 | """The SSL certificate for the server {0} (port {1})""" |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
816 | """ failed the authenticity check. SSL errors""" |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
817 | """ were accepted by you.""") |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
818 | .format(self.__server.getName(), self.__server.getPort())) |
2360
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
819 | if self.__connectionState == IrcWidget.ServerConnecting: |
b6bf3925e3e1
Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2354
diff
changeset
|
820 | self.__socket.ignoreSslErrors() |
2241
030924019d88
Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2240
diff
changeset
|
821 | |
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
|
822 | def __setUserPrivilegePrefix(self, prefix1, prefix2): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
824 | Private method to set the user privilege 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
|
825 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
826 | @param prefix1 first part of the 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
|
827 | @param prefix2 indictors the first part gets mapped to (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
|
828 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | # PREFIX=(ov)@+ |
b7aceb255831
First 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 | # o = @ -> @ircbot , 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
|
831 | # v = + -> +userName , 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
|
832 | for i in range(len(prefix1)): |
b7aceb255831
First 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 | self.__userPrefix["+" + prefix1[i]] = prefix2[i] |
b7aceb255831
First 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 | self.__userPrefix["-" + prefix1[i]] = "" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
835 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
836 | def __ping(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
|
837 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | Private method to handle a PING 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
|
839 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
840 | @param match reference to the match object |
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
|
841 | @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
|
842 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
843 | self.__send("PONG " + 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
|
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 | |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
846 | def __handleCtcp(self, match): |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
847 | """ |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
848 | Private method to handle a CTCP command. |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
849 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
850 | @param match reference to the match object |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
851 | @return flag indicating, if the message was handled (boolean) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
852 | """ |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
853 | # group(1) sender user name |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
854 | # group(2) sender user@host |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
855 | # group(3) target nick |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
856 | # group(4) message |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
857 | if match.group(4).startswith("\x01"): |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
858 | ctcpCommand = match.group(4)[1:].split("\x01", 1)[0] |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
859 | if " " in ctcpCommand: |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
860 | ctcpRequest, ctcpArg = ctcpCommand.split(" ", 1) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
861 | else: |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
862 | ctcpRequest, ctcpArg = ctcpCommand, "" |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
863 | ctcpRequest = ctcpRequest.lower() |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
864 | if ctcpRequest == "version": |
2273
58d27b642a35
A little extension of the IRC CTCP VERSION command response.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2271
diff
changeset
|
865 | if Version.startswith("@@"): |
58d27b642a35
A little extension of the IRC CTCP VERSION command response.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2271
diff
changeset
|
866 | vers = "" |
58d27b642a35
A little extension of the IRC CTCP VERSION command response.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2271
diff
changeset
|
867 | else: |
58d27b642a35
A little extension of the IRC CTCP VERSION command response.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2271
diff
changeset
|
868 | vers = " " + Version |
58d27b642a35
A little extension of the IRC CTCP VERSION command response.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2271
diff
changeset
|
869 | msg = "Eric IRC client{0}, {1}".format(vers, Copyright) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
870 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
871 | self.trUtf8("CTCP"), |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
872 | self.trUtf8("Received Version request from {0}.").format( |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
873 | match.group(1))) |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
874 | self.__sendCtcpReply(match.group(1), "VERSION " + msg) |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
875 | elif ctcpRequest == "ping": |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
876 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
877 | self.trUtf8("CTCP"), |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
878 | self.trUtf8( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
879 | "Received CTCP-PING request from {0}," |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
880 | " sending answer.").format(match.group(1))) |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
881 | self.__sendCtcpReply( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
882 | match.group(1), "PING {0}".format(ctcpArg)) |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
883 | elif ctcpRequest == "clientinfo": |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
884 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
885 | self.trUtf8("CTCP"), |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
886 | self.trUtf8( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
887 | "Received CTCP-CLIENTINFO request from {0}," |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
888 | " sending answer.").format(match.group(1))) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
889 | self.__sendCtcpReply( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
890 | match.group(1), |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
891 | "CLIENTINFO CLIENTINFO PING VERSION") |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
892 | else: |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
893 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
894 | self.trUtf8("CTCP"), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
895 | self.trUtf8( |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
896 | "Received unknown CTCP-{0} request from {1}.") |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
897 | .format(ctcpRequest, match.group(1))) |
2264
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
898 | return True |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
899 | |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
900 | return False |
d8176c78c6a6
Added basic CTCP support to the IRC client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2258
diff
changeset
|
901 | |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
902 | def __updateUsersCount(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
|
903 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
904 | Private method to update the users count on the channel tabs. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
905 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
906 | for channel in self.__channelList: |
b7aceb255831
First 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 | index = self.channelsWidget.indexOf(channel) |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
908 | self.channelsWidget.setTabText( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
909 | index, |
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
|
910 | self.trUtf8("{0} ({1})", "channel name, users count").format( |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
911 | channel.name(), channel.getUsersCount())) |
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
|
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 __handleNickInUseLogin(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
|
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 handle a 443 server error at login. |
b7aceb255831
First 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 | self.__nickIndex += 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
|
918 | try: |
2236
e30d5f978919
Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2234
diff
changeset
|
919 | nick = self.__ircNetworkManager.getIdentity(self.__identityName)\ |
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
|
920 | .getNickNames()[self.__nickIndex] |
b7aceb255831
First 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 | self.__nickName = nick |
b7aceb255831
First 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 | except IndexError: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
923 | self.networkWidget.addServerMessage( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
924 | self.trUtf8("Critical"), |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
925 | self.trUtf8( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
926 | "No nickname acceptable to the server configured" |
3036
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
927 | " for <b>{0}</b>. Disconnecting...") |
30c81c9e88b8
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3034
diff
changeset
|
928 | .format(self.__userName), |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
929 | filterMsg=False) |
2339
4ee173db22c2
Fixed two little issues with the IRC widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2336
diff
changeset
|
930 | self.__connectNetwork("", False, silent=True) |
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
|
931 | self.__nickName = "" |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | self.__nickIndex = -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
|
933 | return |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
934 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
935 | self.networkWidget.setNickName(nick) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
936 | self.__send("NICK " + nick) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
937 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
938 | def __handleNickInUse(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
|
939 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
940 | Private method to handle a 443 server error. |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
941 | """ |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
942 | self.networkWidget.addServerMessage( |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
943 | self.trUtf8("Critical"), |
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
|
944 | self.trUtf8("The given nickname is already in use.")) |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
946 | def __changeNick(self, nick): |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
948 | Private slot to use 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
|
949 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
950 | @param nick nick name to use (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
|
951 | """ |
2279
cbf90feec16f
Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2273
diff
changeset
|
952 | if nick and nick != self.__nickName: |
2271
7dd914b6eb7d
Some corrections and a little addition to the IRC window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2268
diff
changeset
|
953 | self.__send("NICK " + nick) |
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
|
954 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
955 | def __setChannelTypePrefixes(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
|
956 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
957 | Private method to set the channel type 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
|
958 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
959 | @param prefixes channel prefix characters (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
|
960 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
961 | self.__channelTypePrefixes = 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
|
962 | |
2256
d07e2e6f3c56
Implemented support for IRC WHOIS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2255
diff
changeset
|
963 | def isChannelName(self, name): |
2227
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
964 | """ |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
965 | Public method to check, if the given name is a channel 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
|
966 | |
2960
9453efa25fd5
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2528
diff
changeset
|
967 | @param name name to check (string) |
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
|
968 | @return flag indicating a channel name (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
|
969 | """ |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
970 | if not 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
|
971 | 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
|
972 | |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
973 | if self.__channelTypePrefixes: |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
974 | return name[0] in self.__channelTypePrefixes |
b7aceb255831
First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
975 | 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
|
976 | return name[0] in "#&" |
2246
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
977 | |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
978 | def __away(self, isAway): |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
979 | """ |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
980 | Private slot handling the change of the away state. |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
981 | |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
982 | @param isAway flag indicating the current away state (boolean) |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
983 | """ |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
984 | if isAway and self.__identityName: |
2992
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
985 | identity = self.__ircNetworkManager.getIdentity( |
dbdf27746da5
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2960
diff
changeset
|
986 | self.__identityName) |
2246
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
987 | if identity.rememberAwayPosition(): |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
988 | for channel in self.__channelList: |
fdf22a29fbf4
Removed the "Auto Away" stuff because there is no universal way to check the computer for user inactivity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2245
diff
changeset
|
989 | channel.setMarkerLine() |