[Konversation-devel] [Bug 112074] /topic does not show topic of a channel I'm not in

Eike Hein sho at eikehein.com
Sat Jan 7 10:02:54 CET 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=112074         
sho eikehein com changed:

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



------- Additional Comments From sho eikehein com  2006-01-07 10:02 -------
SVN commit 495133 by hein:

Have /topic <channel> make a honest attempt at retrieving <channel>'s 
topic regardless of whether or not we are on <channel>.
Some ircds will not allow us to do that, which is why we implemented
442 (ERR_NOTONCHANNEL) allowing us to fail gracefully (i.e. with a 
pretty and localizable error message).
BUG:112074


 M  +35 -7     inputfilter.cpp  
 M  +1 -1      outputfilter.cpp  
 M  +6 -0      server.cpp  
 M  +1 -0      server.h  


--- trunk/extragear/network/konversation/src/inputfilter.cpp #495132:495133
 @ -800,9 +800,22  @
             // Topic set messages
             case RPL_TOPIC:
             {
-                // Update channel window
                 QString topic = Konversation::removeIrcMarkup(trailing);
-                server->setChannelTopic(parameterList[1],topic);
+
+                // FIXME: This is an abuse of the automaticRequest system: We're
+                // using it in an inverted manner, i.e. the automaticRequest is 
+                // set to true by a manual invocation of /topic. Bad bad bad -
+                // needs rethinking of automaticRequest.
+                if(getAutomaticRequest("TOPIC",parameterList[1])==0)
+                {
+                    // Update channel window
+                    server->setChannelTopic(parameterList[1],topic);
+                }
+                else
+                {
+                    server->appendMessageToFrontmost(i18n("Topic"),i18n("The channel topic for %1 is: \"%2\"").arg(parameterList[1]).arg(topic));
+                }
+
                 break;
             }
             case RPL_TOPICSETBY:
 @ -810,12 +823,27  @
                 // Inform user who set the topic and when
                 QDateTime when;
                 when.setTime_t(parameterList[3].toUInt());
-                server->appendCommandMessageToChannel(parameterList[1],i18n("Topic"),
-                    i18n("Topic was set by %1 on %2.")
-                    .arg(parameterList[2]).arg(when.toString(Qt::LocalDate))
-                    );
 
-                emit topicAuthor(parameterList[1],parameterList[2]);
+                // See FIXME in RPL_TOPIC
+                if(getAutomaticRequest("TOPIC",parameterList[1])==0)
+                {
+                    server->appendCommandMessageToChannel(parameterList[1],i18n("Topic"),
+                        i18n("The topic was set by %1 on %2.")
+                        .arg(parameterList[2]).arg(when.toString(Qt::LocalDate))
+                        );
+
+                    emit topicAuthor(parameterList[1],parameterList[2]);
+                }
+                else
+                {
+                    server->appendMessageToFrontmost(i18n("Topic"),i18n("The topic for %1 was set by %2 on %3.")
+                        .arg(parameterList[1])
+                        .arg(parameterList[2])
+                        .arg(when.toString(Qt::LocalDate))
+                        );
+                    setAutomaticRequest("TOPIC",parameterList[1],false);
+                }
+
                 break;
             }
             case ERR_NOSUCHNICK:
--- trunk/extragear/network/konversation/src/outputfilter.cpp #495132:495133
 @ -405,7 +405,7  @
                 // if no topic given, retrieve topic
                 if(topic.isEmpty())
                 {
-                    result.toServer = "TOPIC " + channel;
+                    m_server->requestTopic(channel);
                 }
                 // otherwise set topic there
                 else
--- trunk/extragear/network/konversation/src/server.cpp #495132:495133
 @ -1670,6 +1670,12  @
     queue("USERHOST "+nicks);
 }
 
+void Server::requestTopic(const QString& channel)
+{
+    inputFilter.setAutomaticRequest("TOPIC", channel, true);
+    queue("TOPIC "+channel);
+}
+
 void Server::resolveUserhost(const QString& nickname)
 {
     inputFilter.setAutomaticRequest("WHOIS", nickname, true);
--- trunk/extragear/network/konversation/src/server.h #495132:495133
 @ -415,6 +415,7  @
         void requestWhois(const QString& nickname);
         void requestWho(const QString& channel);
         void requestUserhost(const QString& nicks);
+        void requestTopic(const QString& channel);
         void resolveUserhost(const QString& nickname);
         void addRawLog(bool show);
         void closeRawLog();


More information about the Konversation-devel mailing list