fixes #580 - nick-dropdown is updated even if nickchange fails
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 11 Mar 2009 16:51:21 +0000 (17:51 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 11 Mar 2009 18:20:50 +0000 (19:20 +0100)
src/qtui/inputwidget.cpp

index 3c7bec5..d4ca832 100644 (file)
@@ -204,8 +204,11 @@ void InputWidget::updateNickSelector() const {
     return;
 
   IrcUser *me = net->me();
-  if(me)
-    nicks[nickIdx] = net->myNick() + QString(" (+%1)").arg(me->userModes());
+  if(me) {
+    nicks[nickIdx] = net->myNick();
+    if(!me->userModes().isEmpty())
+      nicks[nickIdx] += QString(" (+%1)").arg(me->userModes());
+  }
       
   ui.ownNick->addItems(nicks);
 
@@ -219,7 +222,11 @@ void InputWidget::changeNick(const QString &newNick) const {
   const Network *net = currentNetwork();
   if(!net || net->isMyNick(newNick))
     return;
-  emit userInput(currentBufferInfo(), QString("/nick %1").arg(newNick));
+
+  // we reset the nick selecter as we have no confirmation yet, that this will succeed.
+  // if the action succeeds it will be properly updated anyways.
+  updateNickSelector();
+  emit userInput(BufferInfo::fakeStatusBuffer(net->networkId()), QString("/nick %1").arg(newNick));
 }
 
 void InputWidget::sendText(QString text) {