summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
authorwazlaf <wazlaf>2002-09-29 19:54:12 (UTC)
committer wazlaf <wazlaf>2002-09-29 19:54:12 (UTC)
commit1dd254c95a582c2c86c816516a1b4433d8142d8a (patch) (side-by-side diff)
treea3225293a4b399494a04e5bb07154bd673ba0acf /noncore/net/opieirc/ircmessageparser.cpp
parentf91ea4e068f38e9df17b06c87cd8635628837a4f (diff)
downloadopie-1dd254c95a582c2c86c816516a1b4433d8142d8a.zip
opie-1dd254c95a582c2c86c816516a1b4433d8142d8a.tar.gz
opie-1dd254c95a582c2c86c816516a1b4433d8142d8a.tar.bz2
some more message types supported to make this work more smoothly with freenode.net
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 5c70753..d1b70a5 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -15,6 +15,7 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
{ "ERROR:", FUNC(parseLiteralError) },
{ "MODE", FUNC(parseLiteralMode) },
{ "KICK", FUNC(parseLiteralKick) },
+ { "TOPIC", FUNC(parseLiteralTopic) },
{ 0 , 0 }
};
@@ -36,6 +37,8 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
{ 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT
{ 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS
{ 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME
+ { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC
+ { 333, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME
{ 353, FUNC(parseNumericalNames) }, // RPL_NAMREPLY
{ 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
{ 375, FUNC(parseNumericalStats) }, // RPL_MOTDSTART
@@ -191,7 +194,7 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender")));
}
} else {
- emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel")));
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0)));
}
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
@@ -242,6 +245,18 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
}
}
+void IRCMessageParser::parseLiteralTopic(IRCMessage *message) {
+ IRCPerson mask(message->prefix());
+ IRCChannel *channel = m_session->getChannel(message->param(0));
+ if (channel) {
+ IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\"");
+ output.addParam(channel);
+ emit outputReady(output);
+ } else {
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?")));
+ }
+}
+
void IRCMessageParser::parseLiteralError(IRCMessage *message) {
emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
}
@@ -484,3 +499,19 @@ void IRCMessageParser::parseNumericalNicknameInUse(IRCMessage *) {
void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname")));
}
+
+void IRCMessageParser::parseNumericalTopic(IRCMessage *message) {
+ IRCChannel *channel = m_session->getChannel(message->param(1));
+ if (channel) {
+ IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\""));
+ output.addParam(channel);
+ emit outputReady(output);
+ } else {
+ IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + message->param(1) + " is \"" + message->param(2) + "\""));
+ output.addParam(0);
+ emit outputReady(output);
+ }
+}
+
+void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *message) {
+}