Corrected a few issues in the Cooperation function introduced during the IPv6 extension. 5_2_x

Wed, 26 Dec 2012 15:42:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 26 Dec 2012 15:42:32 +0100
branch
5_2_x
changeset 2287
886b1fd60739
parent 2283
9d75b64621e0
child 2288
b84ded2e62a4

Corrected a few issues in the Cooperation function introduced during the IPv6 extension.
(grafted from a6fc5bda1de9cfac493883337743f346ed24ba67)

Cooperation/ChatWidget.py file | annotate | diff | comparison | revisions
Cooperation/ChatWidget.ui file | annotate | diff | comparison | revisions
Cooperation/Connection.py file | annotate | diff | comparison | revisions
Cooperation/CooperationClient.py file | annotate | diff | comparison | revisions
--- a/Cooperation/ChatWidget.py	Wed Dec 26 11:58:43 2012 +0100
+++ b/Cooperation/ChatWidget.py	Wed Dec 26 15:42:32 2012 +0100
@@ -640,7 +640,7 @@
         self.chatEdit.append(
             QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":")
         self.chatEdit.append(self.trUtf8("* {0} has been kicked.\n").format(
-            itm.text().split(":")[0]))
+            itm.text().split("@")[0]))
         self.chatEdit.setTextColor(color)
     
     def __banUser(self):
@@ -655,7 +655,7 @@
         self.chatEdit.append(
             QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":")
         self.chatEdit.append(self.trUtf8("* {0} has been banned.\n").format(
-            itm.text().split(":")[0]))
+            itm.text().split("@")[0]))
         self.chatEdit.setTextColor(color)
     
     def __banKickUser(self):
@@ -670,5 +670,5 @@
         self.chatEdit.append(
             QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":")
         self.chatEdit.append(self.trUtf8("* {0} has been banned and kicked.\n").format(
-            itm.text().split(":")[0]))
+            itm.text().split("@")[0]))
         self.chatEdit.setTextColor(color)
--- a/Cooperation/ChatWidget.ui	Wed Dec 26 11:58:43 2012 +0100
+++ b/Cooperation/ChatWidget.ui	Wed Dec 26 15:42:32 2012 +0100
@@ -217,7 +217,7 @@
            </sizepolicy>
           </property>
           <property name="toolTip">
-           <string>Enter the host and port to connect to in the form &quot;host:port&quot;</string>
+           <string>Enter the host and port to connect to in the form &quot;host@port&quot;</string>
           </property>
           <property name="editable">
            <bool>true</bool>
--- a/Cooperation/Connection.py	Wed Dec 26 11:58:43 2012 +0100
+++ b/Cooperation/Connection.py	Wed Dec 26 15:42:32 2012 +0100
@@ -8,7 +8,7 @@
 """
 
 from PyQt4.QtCore import pyqtSignal, QTimer, QTime, QByteArray
-from PyQt4.QtNetwork import QTcpSocket
+from PyQt4.QtNetwork import QTcpSocket, QHostInfo
 
 from E5Gui import E5MessageBox
 from E5Gui.E5Application import e5App
@@ -174,9 +174,10 @@
                 return
             self.__serverPort = int(serverPort)
             
+            hostInfo = QHostInfo.fromName(self.peerAddress().toString())
             self.__username = "{0}@{1}@{2}".format(
                 user,
-                self.peerAddress().toString(),
+                hostInfo.hostName(),
                 self.peerPort()
             )
             self.__currentDataType = Connection.Undefined
@@ -189,7 +190,7 @@
             
             bannedName = "{0}@{1}".format(
                 user,
-                self.peerAddress().toString()
+                hostInfo.hostName(),
             )
             Preferences.syncPreferences()
             if bannedName in Preferences.getCooperation("BannedUsers"):
@@ -207,7 +208,7 @@
                     self.trUtf8("New Connection"),
                     self.trUtf8("""<p>Accept connection from """
                                 """<strong>{0}@{1}</strong>?</p>""").format(
-                        user, self.peerAddress().toString()),
+                        user, hostInfo.hostName()),
                     yesDefault=True)
                 if not res:
                     self.abort()
--- a/Cooperation/CooperationClient.py	Wed Dec 26 11:58:43 2012 +0100
+++ b/Cooperation/CooperationClient.py	Wed Dec 26 15:42:32 2012 +0100
@@ -339,7 +339,7 @@
         @param nick nick name in the format of self.nickName() (string)
         """
         Preferences.syncPreferences()
-        user = nick.split("@")[0]
+        user = nick.rsplit("@")[0]
         bannedUsers = Preferences.getCooperation("BannedUsers")[:]
         if user not in bannedUsers:
             bannedUsers.append(user)

eric ide

mercurial