[Konversation-devel] [Bug 131399] Finding unused nicks doesn't nick maximum nick length into account
Eike Hein
sho at eikehein.com
Wed Jul 26 23:41:00 CEST 2006
------- 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=131399
sho eikehein com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From sho eikehein com 2006-07-26 23:40 -------
SVN commit 566733 by hein:
Retire the "append underscore to last used nick after unsuccessfully
going through the identity's list of nicknames" behavior, which even-
tually runs into the NICKLEN wall. Instead, ask the user to enter a
new nick, or cancel the connection attempt on opt-out.
Patch by Raphael Kubo da Costa, and mentored by me.
BUG:131399
M +33 -18 inputfilter.cpp
M +7 -3 server.cpp
--- trunk/extragear/network/konversation/src/inputfilter.cpp #566732:566733
@ -716,7 +716,6 @
else
{
property = *it;
- // value = "";
}
if (property=="PREFIX")
{
@ -724,7 +723,7 @
if(pos==-1)
{
server->setPrefixes (QString::null, value);
- // XXX if ) isn't in the string, NOTHING should be there. anyone got a server
+ // XXX if ) isn't in the string, NOTHING should be there. anyone got a server
if (value.length() || property.length())
server->appendStatusMessage("","XXX Server sent bad PREFIX in RPL_ISUPPORT, please report.");
}
@ -740,9 +739,7 @
else if (property == "CAPAB")
{
// Disable as we don't use this for anything yet
-#if 0
- server->queue("CAPAB IDENTIFY-MSG");
-#endif
+ //server->queue("CAPAB IDENTIFY-MSG");
}
else
{
@ -969,15 +966,24 @
}
else // not connected yet, so try to find a nick that's not in use
{
- // Get the next nick from the list
- QString newNick=server->getNextNickname();
- // Update Server window
- server->obtainNickInfo(server->getNickname()) ;
- server->renameNick(server->getNickname(), newNick);
- // Show message
- server->appendMessageToFrontmost(i18n("Nick"),i18n("Nickname already in use. Trying %1.").arg(newNick));
- // Send nickchange request to the server
- server->queue("NICK "+newNick);
+ // Get the next nick from the list or ask for a new one
+ QString newNick = server->getNextNickname();
+
+ // The user chose to disconnect
+ if (newNick.isNull())
+ {
+ server->disconnect();
+ }
+ else
+ {
+ // Update Server window
+ server->obtainNickInfo(server->getNickname()) ;
+ server->renameNick(server->getNickname(), newNick);
+ // Show message
+ server->appendMessageToFrontmost(i18n("Nick"), i18n("Nickname already in use. Trying %1.").arg(newNick));
+ // Send nickchange request to the server
+ server->queue("NICK "+newNick);
+ }
}
break;
}
@ -990,10 +996,19 @
else // Find a new nick as in ERR_NICKNAMEINUSE
{
QString newNick = server->getNextNickname();
- server->obtainNickInfo(server->getNickname()) ;
- server->renameNick(server->getNickname(), newNick);
- server->appendMessageToFrontmost(i18n("Nick"), i18n("Erroneus nickname. Changing nick to %1." ).arg(newNick)) ;
- server->queue("NICK "+newNick);
+
+ // The user chose to disconnect
+ if (newNick.isNull())
+ {
+ server->disconnect();
+ }
+ else
+ {
+ server->obtainNickInfo(server->getNickname()) ;
+ server->renameNick(server->getNickname(), newNick);
+ server->appendMessageToFrontmost(i18n("Nick"), i18n("Erroneus nickname. Changing nick to %1." ).arg(newNick)) ;
+ server->queue("NICK "+newNick);
+ }
}
break;
}
--- trunk/extragear/network/konversation/src/server.cpp #566732:566733
@ -23,6 +23,7 @
#include <klocale.h>
#include <kdebug.h>
#include <kfiledialog.h>
+#include <kinputdialog.h>
#include <kmessagebox.h>
#include <kresolver.h>
#include <ksocketdevice.h>
@ -926,10 +927,13 @
QString Server::getNextNickname()
{
QString newNick = getIdentity()->getNickname(++tryNickNumber);
+
+ if (newNick.isNull())
+ {
+ QString inputText = i18n("No nicknames from the \"%1\" identity were accepted by the connection \"%2\".\nPlease enter a new one or press Cancel to disconnect:").arg(getIdentity()->getName()).arg(getServerGroup());
+ newNick = KInputDialog::getText(i18n("Nickname error"), inputText, QString::null);
+ }
- if(newNick.isEmpty())
- newNick = getNickname()+'_';
-
return newNick;
}
More information about the Konversation-devel
mailing list