eric6/Network/IRC/IrcNetworkManager.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 7960
e8fc383322f7
permissions
-rw-r--r--

Updated copyright for 2021.

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
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2012 - 2021 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 data structures and their manager.
b7aceb255831 First 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
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
10 import copy
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
12 from PyQt5.QtCore import pyqtSignal, QObject, QCoreApplication
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import Utilities
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from Utilities.AutoSaver import AutoSaver
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from Utilities.crypto import pwConvert
b7aceb255831 First 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 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
18
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
20 class IrcIdentity(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
21 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Class implementing the IRC identity object.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
24 DefaultIdentityName = "0default"
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
25 DefaultIdentityDisplay = QCoreApplication.translate(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
26 "IrcIdentity", "Default Identity")
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
27
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
28 DefaultAwayMessage = QCoreApplication.translate(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
29 "IrcIdentity", "Gone away for now.")
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
30 DefaultQuitMessage = QCoreApplication.translate(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
31 "IrcIdentity", "IRC for eric6 IDE")
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
32 DefaultPartMessage = QCoreApplication.translate(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
33 "IrcIdentity", "IRC for eric6 IDE")
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
34
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
35 def __init__(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
36 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 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
38
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @param name name of the identity (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
40 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
41 super(IrcIdentity, self).__init__()
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
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 self.__name = name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__realName = ""
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__nickNames = []
b7aceb255831 First 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 self.__serviceName = ""
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__password = ""
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
48 self.__ident = Utilities.getUserName()
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
49
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
50 self.__rememberPosOnAway = True
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
51 self.__awayMessage = IrcIdentity.DefaultAwayMessage
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
52
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
53 self.__quitMessage = IrcIdentity.DefaultQuitMessage
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
54 self.__partMessage = IrcIdentity.DefaultPartMessage
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
55
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def save(self, settings):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Public method to save the identity 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
59
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 @param settings reference to the settings object (QSettings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 # no need to save the name because that is the group key
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
63 settings.setValue("Ident", self.__ident)
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
64 settings.setValue("RealName", self.__realName)
b7aceb255831 First 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 settings.setValue("NickNames", self.__nickNames)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 settings.setValue("ServiceName", self.__serviceName)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 settings.setValue("Password", self.__password)
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
68 settings.setValue("QuitMessage", self.__quitMessage)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
69 settings.setValue("PartMessage", self.__partMessage)
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
70 settings.setValue("RememberAwayPosition", self.__rememberPosOnAway)
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
71 settings.setValue("AwayMessage", self.__awayMessage)
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
72
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 def load(self, settings):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 Public method to load the identity 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
76
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 @param settings reference to the settings object (QSettings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
79 self.__ident = settings.value("Ident", Utilities.getUserName())
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
80 self.__realName = settings.value("RealName", "")
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
81 self.__nickNames = Preferences.toList(settings.value("NickNames", []))
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
82 self.__serviceName = settings.value("ServiceName", "")
b7aceb255831 First 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.__password = settings.value("Password", "")
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
84 self.__quitMessage = settings.value(
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
85 "QuitMessage", IrcIdentity.DefaultQuitMessage)
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
86 self.__partMessage = settings.value(
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
87 "PartMessage", IrcIdentity.DefaultPartMessage)
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
88 self.__rememberPosOnAway = Preferences.toBool(
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
89 settings.value("RememberAwayPosition", True))
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
90 self.__awayMessage = settings.value(
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
91 "AwayMessage", IrcIdentity.DefaultAwayMessage)
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
92
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
93 def setName(self, name):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
94 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
95 Public method to set the identity name.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
96
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
97 @param name identity name (string)
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
98 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
99 self.__name = name
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
100
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
101 def getName(self):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Public method to get the identity 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
104
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 @return identity name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
b7aceb255831 First 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 return self.__name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
109 def setIdent(self, name):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
110 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
111 Public method to set the real identity name.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
112
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
113 @param name real identity name (string)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
114 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
115 self.__ident = name
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
116
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
117 def getIdent(self):
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
118 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
119 Public method to get the real identity name.
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
120
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
121 @return real identity name (string)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
122 """
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
123 return self.__ident
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
124
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
125 def setRealName(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
126 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 Public method to set the real name of the identity.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 @param name real name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.__realName = 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
132
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 def getRealName(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
134 """
b7aceb255831 First 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 Public method to get the real 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
136
b7aceb255831 First 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 @return real name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 """
b7aceb255831 First 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 return self.__realName
b7aceb255831 First 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
b7aceb255831 First 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 def setNickNames(self, names):
b7aceb255831 First 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 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 Public method to set the nick names of the identity.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
145 @param names nick names (list of 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
146 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.__nickNames = names[:]
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 def getNickNames(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
150 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 Public method to get the nick names.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 @return nick names (list of 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
154 """
b7aceb255831 First 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 return self.__nickNames
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 def setServiceName(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
158 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
159 Public method to set the service name of the identity used for
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
160 identification.
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 @param name service name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
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 self.__serviceName = 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
165
b7aceb255831 First 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 def getServiceName(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
167 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
168 Public method to get the service name of the identity used for
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
169 identification.
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 @return service name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 return self.__serviceName
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 def setPassword(self, 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
176 """
b7aceb255831 First 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 Public method to set a new 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
178
b7aceb255831 First 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 password password to set (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
180 """
b7aceb255831 First 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 self.__password = pwConvert(password, encode=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
182
b7aceb255831 First 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 def getPassword(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
184 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 Public method to get the 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
186
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 @return password (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
188 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 return pwConvert(self.__password, encode=False)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
190
2240
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
191 def setQuitMessage(self, message):
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
192 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
193 Public method to set the QUIT message.
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
194
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
195 @param message QUIT message (string)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
196 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
197 if message:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
198 self.__quitMessage = message
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
199 else:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
200 self.__quitMessage = IrcIdentity.DefaultQuitMessage
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
201
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
202 def getQuitMessage(self):
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
203 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
204 Public method to get the QUIT message.
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
205
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
206 @return QUIT message (string)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
207 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
208 return self.__quitMessage
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
209
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
210 def setPartMessage(self, message):
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
211 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
212 Public method to set the PART message.
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
213
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
214 @param message PART message (string)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
215 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
216 if message:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
217 self.__partMessage = message
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
218 else:
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
219 self.__partMessage = IrcIdentity.DefaultPartMessage
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
220
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
221 def getPartMessage(self):
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
222 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
223 Public method to get the PART message.
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
224
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
225 @return PART message (string)
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
226 """
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
227 return self.__partMessage
11445430c553 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2239
diff changeset
228
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
229 def setRememberAwayPosition(self, remember):
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
230 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
231 Public method to set to remember the chat position upon AWAY.
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
232
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
233 @param remember flag indicating to remember the chat position (boolean)
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
234 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
235 self.__rememberPosOnAway = remember
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
236
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
237 def rememberAwayPosition(self):
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
238 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
239 Public method to get a flag indicating to remember the chat position
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
240 upon AWAY.
2243
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
241
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
242 @return flag indicating to remember the chat position (boolean)
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
243 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
244 return self.__rememberPosOnAway
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
245
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
246 def setAwayMessage(self, message):
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
247 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
248 Public method to set the AWAY message.
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
249
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
250 @param message AWAY message (string)
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
251 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
252 if message:
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
253 self.__awayMessage = message
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
254 else:
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
255 self.__awayMessage = IrcIdentity.DefaultAwayMessage
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
256
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
257 def getAwayMessage(self):
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
258 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
259 Public method to get the AWAY message.
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
260
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
261 @return AWAY message (string)
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
262 """
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
263 return self.__awayMessage
c0323a43d966 Continued with the IRC management and added a few more TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2241
diff changeset
264
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
265 @classmethod
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
266 def createDefaultIdentity(cls):
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
267 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
268 Class method to create the default identity.
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
269
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
270 @return default identity (IrcIdentity)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
271 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
272 userName = Utilities.getUserName()
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
273 realName = Utilities.getRealName()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
274 if not realName:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
275 realName = "eric IDE chat"
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
276 identity = IrcIdentity(IrcIdentity.DefaultIdentityName)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
277 identity.setNickNames([userName, userName + "_", userName + "__"])
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
278 identity.setRealName(realName)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
279 identity.setIdent(userName)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
280 return identity
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
281
b7aceb255831 First 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
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
283 class IrcServer(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
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 Class implementing the IRC identity object.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
b7aceb255831 First 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 DefaultPort = 6667
2241
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
288 DefaultSslPort = 6697
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
290 def __init__(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
291 """
b7aceb255831 First 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 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
293
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 @param name 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
295 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
296 super(IrcServer, self).__init__()
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
297
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 self.__server = 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
299 self.__port = IrcServer.DefaultPort
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 self.__ssl = 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
301 self.__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
302
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 def save(self, settings):
b7aceb255831 First 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 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 Public method to save the server 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
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 @param settings reference to the settings object (QSettings)
b7aceb255831 First 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 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
309 settings.setValue("Name", self.__server)
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 settings.setValue("Port", self.__port)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 settings.setValue("SSL", self.__ssl)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 settings.setValue("Password", self.__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
313
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 def load(self, settings):
b7aceb255831 First 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 """
b7aceb255831 First 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 Public method to load the server 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
317
b7aceb255831 First 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 @param settings reference to the settings object (QSettings)
b7aceb255831 First 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 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
320 self.__server = settings.value("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
321 self.__port = int(settings.value("Port", IrcServer.DefaultPort))
b7aceb255831 First 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 self.__ssl = Preferences.toBool(settings.value("SSL", 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
323 self.__password = settings.value("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
324
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
325 def getName(self):
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
326 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 Public method to get the server 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
328
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @return server name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 return self.__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
332
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
333 def setName(self, name):
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
334 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
335 Public method to set the server name.
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
336
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
337 @param name server name (string)
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
338 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
339 self.__server = name
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
340
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
341 def getPort(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
342 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 Public method to get the server port number.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 @return port number (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
346 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 return self.__port
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 def setPort(self, port):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 Public method to set the server port number.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
353 @param port server port number (integer)
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
354 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 self.__port = port
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 def useSSL(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
358 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 Public method to check for SSL usage.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 @return flag indicating SSL usage (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
362 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 return self.__ssl
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 def setUseSSL(self, on):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 Public method to set the SSL usage.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 @param on flag indicating SSL usage (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
370 """
b7aceb255831 First 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 self.__ssl = on
b7aceb255831 First 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
b7aceb255831 First 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 def setPassword(self, 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
374 """
b7aceb255831 First 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 Public method to set a new 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
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
377 @param password password to set (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
378 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 self.__password = pwConvert(password, encode=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
380
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 def getPassword(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
382 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 Public method to get the 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
384
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 @return password (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
386 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 return pwConvert(self.__password, encode=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
388
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
390 class IrcChannel(object):
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
391 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
392 Class implementing the IRC channel object.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
393 """
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
394 def __init__(self, name):
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
395 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
396 Constructor
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
397
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
398 @param name name of the network (string)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
399 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
400 super(IrcChannel, self).__init__()
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
401
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
402 self.__name = name
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
403 self.__key = ""
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
404 self.__autoJoin = False
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
405
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
406 def save(self, settings):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
407 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
408 Public method to save the channel data.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
409
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
410 @param settings reference to the settings object (QSettings)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
411 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
412 # no need to save the channel name because that is the group key
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
413 settings.setValue("Key", self.__key)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
414 settings.setValue("AutoJoin", self.__autoJoin)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
415
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
416 def load(self, settings):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
417 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
418 Public method to load the network data.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
419
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
420 @param settings reference to the settings object (QSettings)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
421 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
422 self.__key = settings.value("Key", "")
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
423 self.__autoJoin = Preferences.toBool(settings.value("AutoJoin", False))
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
424
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
425 def getName(self):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
426 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
427 Public method to get the channel name.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
428
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
429 @return channel name (string)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
430 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
431 return self.__name
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
432
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
433 def setKey(self, key):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
434 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
435 Public method to set a new channel key.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
436
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
437 @param key channel key to set (string)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
438 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
439 self.__key = pwConvert(key, encode=True)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
440
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
441 def getKey(self):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
442 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
443 Public method to get the channel key.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
444
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
445 @return channel key (string)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
446 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
447 return pwConvert(self.__key, encode=False)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
448
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
449 def autoJoin(self):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
450 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
451 Public method to check the auto join status.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
452
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2279
diff changeset
453 @return flag indicating if the channel should be
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
454 joined automatically (boolean)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
455 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
456 return self.__autoJoin
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
457
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
458 def setAutoJoin(self, enable):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
459 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
460 Public method to set the auto join status of the channel.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
461
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2279
diff changeset
462 @param enable flag indicating if the channel should be
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
463 joined automatically (boolean)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
464 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
465 self.__autoJoin = enable
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
466
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
467
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
468 class IrcNetwork(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
469 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
470 Class implementing the IRC network 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
471 """
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
472 def __init__(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
473 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 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
475
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 @param name name of the network (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
477 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
478 super(IrcNetwork, self).__init__()
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
479
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 self.__name = name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 self.__identity = ""
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
482 self.__server = None
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
483 self.__channels = {}
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
484 self.__autoConnect = 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
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 def save(self, settings):
b7aceb255831 First 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 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 Public method to save the network 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
489
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 @param settings reference to the settings object (QSettings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 # no need to save the network name because that is the group key
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 settings.setValue("Identity", self.__identity)
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
494 settings.setValue("AutoConnect", self.__autoConnect)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
495
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
496 settings.beginGroup("Server")
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
497 self.__server.save(settings)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
498 settings.endGroup()
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
499
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
500 settings.beginGroup("Channels")
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
501 for key in self.__channels:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
502 settings.beginGroup(key)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
503 self.__channels[key].save(settings)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
504 settings.endGroup()
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
505 settings.endGroup()
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
506
b7aceb255831 First 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 def load(self, settings):
b7aceb255831 First 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 """
b7aceb255831 First 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 Public method to load the network 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
510
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 @param settings reference to the settings object (QSettings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 self.__identity = settings.value("Identity", "")
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
514 self.__autoConnect = Preferences.toBool(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
515 settings.value("AutoConnect", False))
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
516
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
517 settings.beginGroup("Server")
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
518 self.__server = IrcServer("")
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
519 self.__server.load(settings)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
520 settings.endGroup()
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
521
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
522 settings.beginGroup("Channels")
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
523 for key in settings.childGroups():
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
524 self.__channels[key] = IrcChannel(key)
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
525 settings.beginGroup(key)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
526 self.__channels[key].load(settings)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
527 settings.endGroup()
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
528 settings.endGroup()
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
529
2238
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
530 def setName(self, name):
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
531 """
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
532 Public method to set the network name.
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
533
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
534 @param name network name (string)
2238
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
535 """
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
536 self.__name = name
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
537
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
538 def getName(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
539 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 Public method to get the network 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
541
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 @return network name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
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 return self.__name
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
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 def setIdentityName(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
547 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 Public method to set the name of the identity.
b7aceb255831 First 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
b7aceb255831 First 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 @param name identity name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 """
b7aceb255831 First 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 self.__identity = 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
553
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 def getIdentityName(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
555 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 Public method to get the name of the identity.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 @return identity name (string)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 """
b7aceb255831 First 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 return self.__identity
b7aceb255831 First 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
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
562 def getServerName(self):
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
563 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
564 Public method to get the server name.
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
565
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
566 @return server name (string)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
567 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
568 if self.__server:
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
569 return self.__server.getName()
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
570 else:
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
571 return ""
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
572
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
573 def getServer(self):
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
574 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
575 Public method to get the server object.
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
576
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
577 @return reference to the server (IrcServer)
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 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
579 return self.__server
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
580
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
581 def setServer(self, server):
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
582 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
583 Public method to set the server.
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
584
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
585 @param server server object to set (IrcServer)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
586 """
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
587 self.__server = server
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 def setChannels(self, channels):
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 """
b7aceb255831 First 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 Public method to set the list of channels.
b7aceb255831 First 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
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
593 @param channels list of channels for the network (list of IrcChannel)
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
594 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
595 self.__channels = {}
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
596 for channel in channels:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
597 self.__channels[channel.getName()] = 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
598
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 def getChannels(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
600 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
601 Public method to get the channels.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
602
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
603 @return list of channels for the network (list of IrcChannel)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
604 """
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
605 return list(copy.deepcopy(self.__channels).values())
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
606
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
607 def getChannelNames(self):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
608 """
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 Public method to get the list of channels.
b7aceb255831 First 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
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
611 @return list of channel names (list of 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
612 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
613 return list(sorted(self.__channels.keys()))
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
614
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
615 def getChannel(self, channelName):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
616 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
617 Public method to get a channel.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
618
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
619 @param channelName name of the channel to retrieve (string)
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
620 @return reference to the channel (IrcChannel)
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
621 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
622 if channelName in self.__channels:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
623 return self.__channels[channelName]
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
624 else:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
625 return None
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
626
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
627 def setChannel(self, 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
628 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
629 Public method to set a channel.
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
630
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
631 @param channel channel object to set (IrcChannel)
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
632 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
633 channelName = channel.getName()
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
634 if channelName in self.__channels:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
635 self.__channels[channelName] = channel
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
636
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
637 def addChannel(self, channel):
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
638 """
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
639 Public method to add a 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
640
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
641 @param channel channel object to add (IrcChannel)
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
642 """
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
643 channelName = channel.getName()
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
644 if channelName not in self.__channels:
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
645 self.__channels[channelName] = channel
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
646
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
647 def deleteChannel(self, channelName):
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
648 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
649 Public method to delete the given channel.
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
650
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
651 @param channelName name of the channel to be deleted (string)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
652 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
653 if channelName in self.__channels:
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
654 del self.__channels[channelName]
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
655
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
656 def setAutoConnect(self, enable):
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
657 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
658 Public method to set the auto connect flag.
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
659
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
660 @param enable flag indicate to connect to the network at start-up.
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
661 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
662 self.__autoConnect = enable
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
663
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
664 def autoConnect(self):
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
665 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
666 Public method to check, if the network should be connected to at
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
667 start-up.
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
668
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
669 @return flag indicating an auto connect (boolean)
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
670 """
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
671 return self.__autoConnect
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
672
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
673 @classmethod
2241
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
674 def createDefaultNetwork(cls, ssl=False):
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
675 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
676 Class method to create the default network.
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
677
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
678 @param ssl flag indicating to create a SSL network configuration
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
679 (boolean)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
680 @return default network object (IrcNetwork)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
681 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
682 # network
2241
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
683 if ssl:
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
684 networkName = "Freenode (SSL)"
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
685 else:
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
686 networkName = "Freenode"
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
687 network = IrcNetwork(networkName)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
688 network.setIdentityName(IrcIdentity.DefaultIdentityName)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
689
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
690 # server
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
691 serverName = "chat.freenode.net"
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
692 server = IrcServer(serverName)
2241
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
693 if ssl:
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
694 server.setPort(IrcServer.DefaultSslPort)
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
695 server.setUseSSL(True)
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
696 else:
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
697 server.setPort(IrcServer.DefaultPort)
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
698 network.setServer(server)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
699
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
700 # channel
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
701 channel = IrcChannel("#eric-ide")
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
702 channel.setAutoJoin(False)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
703 network.addChannel(channel)
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
704
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
705 # auto connect
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
706 network.setAutoConnect(False)
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
707
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
708 return network
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
b7aceb255831 First 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
b7aceb255831 First 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 class IrcNetworkManager(QObject):
b7aceb255831 First 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 """
b7aceb255831 First 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 Class implementing the IRC identity object.
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
714
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
715 @signal dataChanged() emitted after some data has changed
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
716 @signal networksChanged() emitted after a network object has changed
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
717 @signal identitiesChanged() emitted after an identity object has changed
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 """
b7aceb255831 First 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 dataChanged = pyqtSignal()
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
720 networksChanged = pyqtSignal()
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
721 identitiesChanged = pyqtSignal()
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
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 __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
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 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
726
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 @param parent reference to the parent object (QObject)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
729 super(IrcNetworkManager, 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
730
b7aceb255831 First 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.__loaded = 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
732 self.__saveTimer = AutoSaver(self, self.save)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 self.__settings = Preferences.Prefs.settings
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 self.__networks = {}
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 self.__identities = {}
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 self.dataChanged.connect(self.__saveTimer.changeOccurred)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 def close(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
742 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 Public method to close the open search engines manager.
b7aceb255831 First 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 """
b7aceb255831 First 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 self.__saveTimer.saveIfNeccessary()
b7aceb255831 First 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
b7aceb255831 First 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 def save(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
748 """
b7aceb255831 First 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 Public slot to save the IRC 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
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 not self.__loaded:
b7aceb255831 First 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 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
753
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 # save IRC 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
755 self.__settings.beginGroup("IRC")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 # identities
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
758 self.__settings.remove("Identities")
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 self.__settings.beginGroup("Identities")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 for key in self.__identities:
b7aceb255831 First 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 self.__settings.beginGroup(key)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 self.__identities[key].save(self.__settings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 # networks
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
767 self.__settings.remove("Networks")
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
768 self.__settings.beginGroup("Networks")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 for key in self.__networks:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 self.__settings.beginGroup(key)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 self.__networks[key].save(self.__settings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 def __load(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
778 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 Private slot to load the IRC 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
780 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 if self.__loaded:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 return
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 # load IRC 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
785 self.__settings.beginGroup("IRC")
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 # identities
b7aceb255831 First 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 self.__settings.beginGroup("Identities")
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
789 for key in self.__settings.childGroups():
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
790 self.__identities[key] = IrcIdentity(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
791 self.__settings.beginGroup(key)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 self.__identities[key].load(self.__settings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 # networks
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 self.__settings.beginGroup("Networks")
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2236
diff changeset
798 for key in self.__settings.childGroups():
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2234
diff changeset
799 self.__networks[key] = IrcNetwork(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
800 self.__settings.beginGroup(key)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 self.__networks[key].load(self.__settings)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 self.__settings.endGroup()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
807 if not self.__identities or not self.__networks:
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
808 # data structures got corrupted; load defaults
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 self.__loadDefaults()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
811 if IrcIdentity.DefaultIdentityName not in self.__identities:
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
812 self.__loadDefaults(identityOnly=True)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
813
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
814 self.__loaded = 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
815
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
816 def __loadDefaults(self, identityOnly=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
817 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 Private method to load default values.
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
819
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
820 @param identityOnly flag indicating to just load the default
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
821 identity (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
822 """
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
823 if not identityOnly:
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
824 self.__networks = {}
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
825 self.__identities = {}
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
826
b7aceb255831 First 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 # identity
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
828 identity = IrcIdentity.createDefaultIdentity()
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
829 self.__identities[identity.getName()] = identity
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
831 if not identityOnly:
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
832 network = IrcNetwork.createDefaultNetwork()
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
833 self.__networks[network.getName()] = network
2241
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
834 network = IrcNetwork.createDefaultNetwork(True)
030924019d88 Implemented SSL support for IRC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2240
diff changeset
835 self.__networks[network.getName()] = network
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
836
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 self.dataChanged.emit()
b7aceb255831 First 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
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
839 ##################################################################
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
840 ## Identity related methods below
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
841 ##################################################################
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
842
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
843 def getIdentity(self, name, create=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
844 """
b7aceb255831 First 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 Public method to get an identity object.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 @param name name of the identity to get (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
848 @param create flag indicating to create a new object,
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 if none exists (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
850 @return reference to the identity (IrcIdentity)
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 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
853 return None
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 if not self.__loaded:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 self.__load()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 if name in self.__identities:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 return self.__identities[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
860 elif create:
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
861 ircId = IrcIdentity(name)
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
862 self.__identities[name] = ircId
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
863
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 self.dataChanged.emit()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
866 return ircId
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
867 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
868 return None
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869
2239
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
870 def getIdentities(self):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
871 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
872 Public method to get a copy of all identities.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
873
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
874 @return dictionary of all identities (dict of IrcIdentity)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
875 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
876 return copy.deepcopy(self.__identities)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
877
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
878 def setIdentities(self, identities):
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
879 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
880 Public method to set the identities.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
881
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
882 @param identities dictionary of all identities (dict of IrcIdentity)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
883 """
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
884 self.__identities = copy.deepcopy(identities)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
885 self.identityChanged()
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
886
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
887 # Check all networks, if the identity they use is still available.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
888 # If it isn't, change them to use the default identity.
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
889 for network in self.__networks.values():
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
890 if network.getIdentityName() not in self.__identities:
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
891 network.setIdentityName(IrcIdentity.DefaultIdentityName)
a47b50e80a20 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2238
diff changeset
892
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
893 def getIdentityNames(self):
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
894 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
895 Public method to get the names of all identities.
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
896
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
897 @return names of all identities (list of string)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
898 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
899 return list(self.__identities.keys())
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
900
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
901 def addIdentity(self, identity):
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
902 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
903 Public method to add a new identity.
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
904
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
905 @param identity reference to the identity to add (IrcIdentity)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
906 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
907 name = identity.getName()
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
908 self.__identities[name] = identity
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
909 self.identityChanged()
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
910
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
911 def deleteIdentity(self, name):
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
912 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
913 Public method to delete the given identity.
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
914
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
915 @param name name of the identity to delete (string)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
916 """
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
917 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
918 name in self.__identities and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
919 name != IrcIdentity.DefaultIdentityName
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
920 ):
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
921 del self.__identities[name]
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
922 self.identityChanged()
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
923
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
924 def renameIdentity(self, oldName, newName):
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
925 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
926 Public method to rename an identity.
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
927
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
928 @param oldName old name of the identity (string)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
929 @param newName new name of the identity (string)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
930 """
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
931 if oldName in self.__identities:
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2279
diff changeset
932 self.__identities[newName] = self.__identities[oldName]
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
933 del self.__identities[oldName]
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
934
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
935 for network in self.__networks:
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
936 if network.getIdentityName() == oldName:
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
937 network.setIdentityName(newName)
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
938
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
939 self.identityChanged()
2231
241df9311ade Prepared configuration of IRC identities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2227
diff changeset
940
2227
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 def identityChanged(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
942 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 Public method to indicate a change of an identity object.
b7aceb255831 First 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 """
b7aceb255831 First 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 self.dataChanged.emit()
2279
cbf90feec16f Fixed a non-fatal issue in the IRC widget related to changing an identity.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2246
diff changeset
946 self.identitiesChanged.emit()
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
947
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
948 ##################################################################
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
949 ## Network related methods below
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
950 ##################################################################
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
951
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
952 def getNetwork(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
953 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 Public method to get a network object.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 @param name name of the network (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
957 @return reference to the network object (IrcNetwork)
b7aceb255831 First 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 if not self.__loaded:
b7aceb255831 First 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 self.__load()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 if name in self.__networks:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 return self.__networks[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
964 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
965 return None
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966
2238
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
967 def setNetwork(self, network, networkName=""):
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 """
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
969 Public method to set a network.
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
970
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
971 @param network network object to set (IrcNetwork)
2238
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
972 @param networkName name the network was known for (string)
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
973 """
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
974 name = network.getName()
2238
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
975 if networkName and name != networkName:
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
976 # the network name has changed
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
977 self.deleteNetwork(networkName)
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
978 self.addNetwork(network)
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
979 elif name in self.__networks:
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
980 self.__networks[name] = network
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
981 self.networkChanged()
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
982
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
983 def addNetwork(self, network):
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
984 """
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
985 Public method to add a network.
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
986
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
987 @param network network object to add (IrcNetwork)
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
988 """
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
989 name = network.getName()
9977d3081ab6 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2237
diff changeset
990 if name not in self.__networks:
2236
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
991 self.__networks[name] = network
e30d5f978919 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2235
diff changeset
992 self.networkChanged()
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
993
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
994 def deleteNetwork(self, name):
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
995 """
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
996 Public method to delete the given network.
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
997
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
998 @param name name of the network to delete (string)
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
999 """
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
1000 if name in self.__networks:
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
1001 del self.__networks[name]
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
1002 self.networkChanged()
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
1003
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
1004 def networkChanged(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
1005 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 Public method to indicate a change of a network object.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 self.dataChanged.emit()
2232
47290dad6d0b Started implementing the IRC network management dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2231
diff changeset
1009 self.networksChanged.emit()
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
1010
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 def getNetworkNames(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
1012 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 Public method to get a list of all known network names.
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 @return list of network names (list of 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
1016 """
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 if not self.__loaded:
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 self.__load()
b7aceb255831 First commit of the simple IRC client for eric. It is usable but not yet complete.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019
2234
1e33501a0d33 Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2232
diff changeset
1020 return list(sorted(self.__networks.keys()))

eric ide

mercurial