Bug 98701 - nick password not registering in some cases (described)
Summary: nick password not registering in some cases (described)
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-06 16:29 UTC by david powell
Modified: 2010-07-01 16:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description david powell 2005-02-06 16:29:49 UTC
Version:           .15 (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

ok  hope this is not confusing 

state ok first 
startup and connect then nick auto register is ok 
change nick , and back and nick auto registers ok 

now
get disconnected and reconnect (alternate nic on reconnect )
change nick back then nick register is ok i think (have to remeber next time it happens)

but bug is :-
if disconnected and program closed, 
(nick still in actave on server)
restart and connect (will not register primiary nick)
when nick drops off server ( primary nick) and you change nick back to it 
auto nick register dose not work 
have to manualy do /msg nickserv identify <password>
Comment 1 Ismail Donmez 2005-03-30 18:24:57 UTC
CVS commit by cartman: 

React to nickserv messages asking for identify. Currently identifies *twice*
at startup. Will fix it.
BUG:98701


  M +14 -9     inputfilter.cpp   1.197
  M +16 -9     server.cpp   1.447
  M +3 -1      server.h   1.196


--- kdeextragear-2/konversation/konversation/inputfilter.cpp  #1.196:1.197
@@ -381,9 +381,14 @@ void InputFilter::parseClientCommand(con
                 else
                 {
-                    if(trailing.lower() == "password accepted - you are now recognized" 
+                  
+                  if(trailing.startsWith("If this is your nick")) // Nickserv
+                    {
+                      // Identify command if specified
+                      server->registerWithServices();
+                    }
+                  else if(trailing.lower() == "password accepted - you are now recognized" 
                         || trailing.lower() == "you have already identified") 
                     {
                         NickInfoPtr nickInfo = server->getNickInfo(server->getNickname());
-                        Q_ASSERT(nickInfo);
                         if(nickInfo)
                             nickInfo->setIdentified(true);

--- kdeextragear-2/konversation/konversation/server.cpp  #1.446:1.447
@@ -746,11 +746,11 @@ void Server::connectionEstablished(const
      // get first notify very early
     startNotifyTimer(1000);
-    // register with services
-    if(!botPassword.isEmpty() && !bot.isEmpty())
-      queue("PRIVMSG "+bot+" :identify "+botPassword);
+    // Register with services
+    registerWithServices();
     // get own ip by userhost
     requestUserhost(nickname);
 
-    if(rejoinChannels) {
+    if(rejoinChannels)
+      {
       rejoinChannels = false;
       autoRejoinChannels();
@@ -761,4 +761,10 @@ void Server::connectionEstablished(const
 }
 
+void Server::registerWithServices()
+{
+  if(!botPassword.isEmpty() && !bot.isEmpty())
+    queue("PRIVMSG "+bot+" :identify "+botPassword);
+}
+
 void Server::gotOwnResolvedHostByWelcome(KResolverResults res)
 {
@@ -2428,4 +2434,5 @@ void Server::renameNickInfo(NickInfoPtr 
     QString lcNickname = nickInfo->getNickname().lower();
     nickInfo->setNickname(newname);
+    nickInfo->setIdentified(false);
     QString lcNewname = newname.lower();
     // Rename the key in m_allNicks list.
@@ -2756,5 +2763,5 @@ QString Server::parseWildcards(const QSt
     out.append(toParse.mid(index,found-index)); // append part before the %
     index = found + 1; // skip the part before, including %
-    if (index >= toParse.length())
+    if (index >= (int)toParse.length())
       break; // % was the last char (not valid)
     toExpand = toParse.at(index++);

--- kdeextragear-2/konversation/konversation/server.h  #1.195:1.196
@@ -335,4 +335,6 @@ class Server : public QObject
     QString allowedChannelModes() const { return m_allowedChannelModes; }
     
+    void registerWithServices();
+    
   signals:
     void nicknameChanged(const QString&);
Comment 2 Ismail Donmez 2010-07-01 16:01:39 UTC
commit a7354a00bddf8b57704f1ac73a7e03119374fb69
Author: İsmail Dönmez <ismail@kde.org>
Date:   Wed Mar 30 16:24:49 2005 +0000

    React to nickserv messages asking for identify. Currently identifies *twice*
    at startup. Will fix it.
    BUG:98701
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=401953

diff --git a/konversation/inputfilter.cpp b/konversation/inputfilter.cpp
index 7632066..976d01d 100644
--- a/konversation/inputfilter.cpp
+++ b/konversation/inputfilter.cpp
@@ -336,7 +336,7 @@ void InputFilter::parseClientCommand(const QString &prefix, const QString &comma
     }
     else if(command=="notice")
     {
-        if(!isIgnore(prefix,Ignore::Notice))
+      if(!isIgnore(prefix,Ignore::Notice))
         {
             // Channel notice?
             if(isAChannel(parameterList[0]))
@@ -380,15 +380,20 @@ void InputFilter::parseClientCommand(const QString &prefix, const QString &comma
                 // No, so it was a normal notice
                 else
                 {
-                    if(trailing.lower() == "password accepted - you are now recognized" 
-                        || trailing.lower() == "you have already identified") 
+		  
+		  if(trailing.startsWith("If this is your nick")) // Nickserv
+		    {
+		      // Identify command if specified
+		      server->registerWithServices();
+		    }
+		  else if(trailing.lower() == "password accepted - you are now recognized" 
+		     || trailing.lower() == "you have already identified") 
                     {
-                        NickInfoPtr nickInfo = server->getNickInfo(server->getNickname());
-                        Q_ASSERT(nickInfo);
-                        if(nickInfo)
-                            nickInfo->setIdentified(true);
+		      NickInfoPtr nickInfo = server->getNickInfo(server->getNickname());
+		      if(nickInfo)
+			nickInfo->setIdentified(true);
                     }
-                    server->appendMessageToFrontmost(i18n("Notice"), i18n("-%1- %2").arg(sourceNick).arg(trailing));
+		  server->appendMessageToFrontmost(i18n("Notice"), i18n("-%1- %2").arg(sourceNick).arg(trailing));
                 }
             }
         }
diff --git a/konversation/server.cpp b/konversation/server.cpp
index 9f6ccbe..8aa007e 100644
--- a/konversation/server.cpp
+++ b/konversation/server.cpp
@@ -745,21 +745,27 @@ void Server::connectionEstablished(const QString& ownHost)
     m_serverISON = new ServerISON(this);
      // get first notify very early
     startNotifyTimer(1000);
-    // register with services
-    if(!botPassword.isEmpty() && !bot.isEmpty())
-      queue("PRIVMSG "+bot+" :identify "+botPassword);
+    // Register with services
+    registerWithServices();
     // get own ip by userhost
     requestUserhost(nickname);
-
-    if(rejoinChannels) {
-      rejoinChannels = false;
-      autoRejoinChannels();
-    }
+    
+    if(rejoinChannels)
+      {
+	rejoinChannels = false;
+	autoRejoinChannels();
+      }
   }
   else
     kdDebug() << "alreadyConnected==true! How did that happen?" << endl;
 }
 
+void Server::registerWithServices()
+{
+  if(!botPassword.isEmpty() && !bot.isEmpty())
+    queue("PRIVMSG "+bot+" :identify "+botPassword);
+}
+
 void Server::gotOwnResolvedHostByWelcome(KResolverResults res)
 {
   if ( res.error() == KResolver::NoError && !res.isEmpty() ) {
@@ -2427,6 +2433,7 @@ void Server::renameNickInfo(NickInfoPtr nickInfo, const QString& newname)
     // Get existing lowercase nickname and rename nickname in the NickInfo object.
     QString lcNickname = nickInfo->getNickname().lower();
     nickInfo->setNickname(newname);
+    nickInfo->setIdentified(false);
     QString lcNewname = newname.lower();
     // Rename the key in m_allNicks list.
     m_allNicks.remove(lcNickname);
@@ -2755,7 +2762,7 @@ QString Server::parseWildcards(const QString& toParse,
   while ((found = toParse.find('%',index)) != -1) {
     out.append(toParse.mid(index,found-index)); // append part before the %
     index = found + 1; // skip the part before, including %
-    if (index >= toParse.length())
+    if (index >= (int)toParse.length())
       break; // % was the last char (not valid)
     toExpand = toParse.at(index++);
     if (toExpand == 's') {
diff --git a/konversation/server.h b/konversation/server.h
index d7adc12..6984cc0 100644
--- a/konversation/server.h
+++ b/konversation/server.h
@@ -333,6 +333,8 @@ class Server : public QObject
 
     void setAllowedChannelModes(const QString& modes) { m_allowedChannelModes = modes; }
     QString allowedChannelModes() const { return m_allowedChannelModes; }
+
+    void registerWithServices();
     
   signals:
     void nicknameChanged(const QString&);
@@ -416,7 +418,7 @@ class Server : public QObject
     void showSSLDialog();
     void sendToAllChannels(const QString& text);
     void notifyTimeout();
-    
+
   protected slots:
 
     void preShellCommandExited(KProcess*);