[Konversation-devel] [Bug 112074] /topic does not show topic of a channel I'm not in
Eike Hein
hein at kde.org
Thu Jul 1 16:19:08 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=112074
--- Comment #2 from Eike Hein <hein kde org> 2010-07-01 16:19:07 ---
commit 6a0653c03220abaa8a089db34cecac4a06172cb9
Author: Eike Hein <hein at kde.org>
Date: Sat Jan 7 09:02:42 2006 +0000
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
svn path=/trunk/extragear/network/konversation/; revision=495133
diff --git a/src/inputfilter.cpp b/src/inputfilter.cpp
index f8585a6..d852f3d 100644
--- a/src/inputfilter.cpp
+++ b/src/inputfilter.cpp
@@ -800,9 +800,22 @@ void InputFilter::parseServerCommand(const QString
&prefix, const QString &comma
// 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 @@ void InputFilter::parseServerCommand(const QString
&prefix, const QString &comma
// 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:
diff --git a/src/outputfilter.cpp b/src/outputfilter.cpp
index eeb4264..09cfff9 100644
--- a/src/outputfilter.cpp
+++ b/src/outputfilter.cpp
@@ -405,7 +405,7 @@ namespace Konversation
// if no topic given, retrieve topic
if(topic.isEmpty())
{
- result.toServer = "TOPIC " + channel;
+ m_server->requestTopic(channel);
}
// otherwise set topic there
else
diff --git a/src/server.cpp b/src/server.cpp
index 71a5588..fe538dd 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1670,6 +1670,12 @@ void Server::requestUserhost(const QString& nicks)
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);
diff --git a/src/server.h b/src/server.h
index 5d9fd5f..612e431 100644
--- a/src/server.h
+++ b/src/server.h
@@ -415,6 +415,7 @@ class Server : public QObject
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();
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Konversation-devel
mailing list