[Konversation-devel] [Bug 85528] infinite loop when nick in use

ismail cartman donmez ismail at uludag.org.tr
Tue Sep 27 09:50:09 CEST 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=85528         
ismail uludag org tr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From ismail uludag org tr  2005-09-27 09:50 -------
SVN commit 464393 by cartman:

Really fix nickname in use infinite loop.
BUG:85528



 M  +9 -2      identity.cpp  
 M  +2 -2      identity.h  
 M  +4 -9      server.cpp  


--- trunk/extragear/network/konversation/src/identity.cpp #464392:464393
 @ -80,9 +80,16  @
 void Identity::setIdent(const QString& newIdent)        { ident=newIdent; }
 QString Identity::getIdent() const                      { return ident; }
 
-void Identity::setNickname(int index,const QString& newName) { nicknameList[index]=newName; }
-QString Identity::getNickname(int index) const          { return nicknameList[index]; }
+void Identity::setNickname(uint index,const QString& newName) { nicknameList[index]=newName; }
 
+QString Identity::getNickname(uint index) const 
+{
+  if(index < nicknameList.count())
+    return nicknameList[index];
+  else
+    return QString::null;
+}
+
 void Identity::setBot(const QString& newBot)            { bot=newBot; }
 QString Identity::getBot() const                        { return bot; }
 
--- trunk/extragear/network/konversation/src/identity.h #464392:464393
 @ -46,8 +46,8  @
         void setIdent(const QString& ident);
         QString getIdent() const;
 
-        void setNickname(int index,const QString& nick);
-        QString getNickname(int index) const;
+        void setNickname(uint index,const QString& nick);
+        QString getNickname(uint index) const;
 
         void setBot(const QString& bot);
         QString getBot() const;
--- trunk/extragear/network/konversation/src/server.cpp #464392:464393
 @ -990,16 +990,11  @
 
 QString Server::getNextNickname()
 {
-    QString newNick = getNickname();
+    QString newNick = getIdentity()->getNickname(++tryNickNumber);
 
-    if(tryNickNumber != 4)
-    {
-        tryNickNumber++;
-        if (tryNickNumber == 4)
-            newNick = getNickname()+"_";
-        else
-            newNick = getIdentity()->getNickname(tryNickNumber);
-    }
+    if(newNick.isEmpty())
+       newNick = getNickname()+"_";
+
     return newNick;
 }


More information about the Konversation-devel mailing list