summaryrefslogtreecommitdiff
authorwazlaf <wazlaf>2002-09-29 19:54:12 (UTC)
committer wazlaf <wazlaf>2002-09-29 19:54:12 (UTC)
commit1dd254c95a582c2c86c816516a1b4433d8142d8a (patch) (unidiff)
treea3225293a4b399494a04e5bb07154bd673ba0acf
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 (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp33
-rw-r--r--noncore/net/opieirc/ircmessageparser.h3
-rw-r--r--noncore/net/opieirc/ircoutput.h3
-rw-r--r--noncore/net/opieirc/ircservertab.cpp12
4 files changed, 49 insertions, 2 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
@@ -14,8 +14,9 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
14 { "ERROR", FUNC(parseLiteralError) }, 14 { "ERROR", FUNC(parseLiteralError) },
15 { "ERROR:", FUNC(parseLiteralError) }, 15 { "ERROR:", FUNC(parseLiteralError) },
16 { "MODE", FUNC(parseLiteralMode) }, 16 { "MODE", FUNC(parseLiteralMode) },
17 { "KICK", FUNC(parseLiteralKick) }, 17 { "KICK", FUNC(parseLiteralKick) },
18 { "TOPIC", FUNC(parseLiteralTopic) },
18 { 0 , 0 } 19 { 0 , 0 }
19}; 20};
20 21
21/* Lookup table for literal commands */ 22/* Lookup table for literal commands */
@@ -35,8 +36,10 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
35 { 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL 36 { 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL
36 { 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT 37 { 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT
37 { 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS 38 { 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS
38 { 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME 39 { 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME
40 { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC
41 { 333, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME
39 { 353, FUNC(parseNumericalNames) }, // RPL_NAMREPLY 42 { 353, FUNC(parseNumericalNames) }, // RPL_NAMREPLY
40 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES 43 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
41 { 375, FUNC(parseNumericalStats) }, // RPL_MOTDSTART 44 { 375, FUNC(parseNumericalStats) }, // RPL_MOTDSTART
42 { 372, FUNC(parseNumericalStats) }, // RPL_MOTD 45 { 372, FUNC(parseNumericalStats) }, // RPL_MOTD
@@ -190,9 +193,9 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
190 } else { 193 } else {
191 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); 194 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender")));
192 } 195 }
193 } else { 196 } else {
194 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel"))); 197 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0)));
195 } 198 }
196 } else { 199 } else {
197 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); 200 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
198 } 201 }
@@ -241,8 +244,20 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
241 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); 244 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?")));
242 } 245 }
243} 246}
244 247
248void IRCMessageParser::parseLiteralTopic(IRCMessage *message) {
249 IRCPerson mask(message->prefix());
250 IRCChannel *channel = m_session->getChannel(message->param(0));
251 if (channel) {
252 IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\"");
253 output.addParam(channel);
254 emit outputReady(output);
255 } else {
256 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?")));
257 }
258}
259
245void IRCMessageParser::parseLiteralError(IRCMessage *message) { 260void IRCMessageParser::parseLiteralError(IRCMessage *message) {
246 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); 261 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
247} 262}
248 263
@@ -483,4 +498,20 @@ void IRCMessageParser::parseNumericalNicknameInUse(IRCMessage *) {
483 498
484void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) { 499void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) {
485 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); 500 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname")));
486} 501}
502
503void IRCMessageParser::parseNumericalTopic(IRCMessage *message) {
504 IRCChannel *channel = m_session->getChannel(message->param(1));
505 if (channel) {
506 IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\""));
507 output.addParam(channel);
508 emit outputReady(output);
509 } else {
510 IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + message->param(1) + " is \"" + message->param(2) + "\""));
511 output.addParam(0);
512 emit outputReady(output);
513 }
514}
515
516void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *message) {
517}
diff --git a/noncore/net/opieirc/ircmessageparser.h b/noncore/net/opieirc/ircmessageparser.h
index f774047..c4dd96c 100644
--- a/noncore/net/opieirc/ircmessageparser.h
+++ b/noncore/net/opieirc/ircmessageparser.h
@@ -71,8 +71,9 @@ private:
71 void parseLiteralQuit(IRCMessage *message); 71 void parseLiteralQuit(IRCMessage *message);
72 void parseLiteralError(IRCMessage *message); 72 void parseLiteralError(IRCMessage *message);
73 void parseLiteralMode(IRCMessage *message); 73 void parseLiteralMode(IRCMessage *message);
74 void parseLiteralKick(IRCMessage *message); 74 void parseLiteralKick(IRCMessage *message);
75 void parseLiteralTopic(IRCMessage *message);
75 void parseNumerical001(IRCMessage *message); 76 void parseNumerical001(IRCMessage *message);
76 void parseNumerical002(IRCMessage *message); 77 void parseNumerical002(IRCMessage *message);
77 void parseNumerical003(IRCMessage *message); 78 void parseNumerical003(IRCMessage *message);
78 void parseNumerical004(IRCMessage *message); 79 void parseNumerical004(IRCMessage *message);
@@ -81,8 +82,10 @@ private:
81 void parseNumericalNames(IRCMessage *message); 82 void parseNumericalNames(IRCMessage *message);
82 void parseNumericalEndOfNames(IRCMessage *message); 83 void parseNumericalEndOfNames(IRCMessage *message);
83 void parseNumericalNicknameInUse(IRCMessage *message); 84 void parseNumericalNicknameInUse(IRCMessage *message);
84 void parseNumericalNoSuchNick(IRCMessage *message); 85 void parseNumericalNoSuchNick(IRCMessage *message);
86 void parseNumericalTopic(IRCMessage *message);
87 void parseNumericalTopicWhoTime(IRCMessage *message);
85 void parseCTCPPing(IRCMessage *message); 88 void parseCTCPPing(IRCMessage *message);
86 void parseCTCPVersion(IRCMessage *message); 89 void parseCTCPVersion(IRCMessage *message);
87 void parseCTCPAction(IRCMessage *message); 90 void parseCTCPAction(IRCMessage *message);
88protected: 91protected:
diff --git a/noncore/net/opieirc/ircoutput.h b/noncore/net/opieirc/ircoutput.h
index e8cc524..9c0b8bb 100644
--- a/noncore/net/opieirc/ircoutput.h
+++ b/noncore/net/opieirc/ircoutput.h
@@ -43,9 +43,10 @@ enum IRCOutputType {
43 OUTPUT_SELFKICK = 12, /* parameters : channel (IRCChannel) */ 43 OUTPUT_SELFKICK = 12, /* parameters : channel (IRCChannel) */
44 OUTPUT_OTHERKICK = 13, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */ 44 OUTPUT_OTHERKICK = 13, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */
45 OUTPUT_CHANACTION = 14, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */ 45 OUTPUT_CHANACTION = 14, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */
46 OUTPUT_QUERYACTION = 15, /* parameters : person (IRCPerson) */ 46 OUTPUT_QUERYACTION = 15, /* parameters : person (IRCPerson) */
47 OUTPUT_CHANPERSONMODE = 16 /* parameters : channel (IRCCHannel) person (IRCChannelPerson) */ 47 OUTPUT_CHANPERSONMODE = 16, /* parameters : channel (IRCCHannel) person (IRCChannelPerson) */
48 OUTPUT_TOPIC = 17 /* parameters : channel (IRCChannel) */
48}; 49};
49 50
50/* The IRCOutput class is used as a kind of message which is sent by the 51/* The IRCOutput class is used as a kind of message which is sent by the
51 IRC parser to inform the GUI of changes. This could for example be a 52 IRC parser to inform the GUI of changes. This could for example be a
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 4be60ef..aea58a3 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -218,8 +218,20 @@ void IRCServerTab::display(IRCOutput output) {
218 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 218 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
219 channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>"); 219 channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>");
220 } 220 }
221 break; 221 break;
222 case OUTPUT_TOPIC: {
223 IRCChannel *channel = (IRCChannel *) output.getParam(0);
224 if (channel) {
225 IRCChannelTab *channelTab = getTabForChannel(channel);
226 if (channelTab) {
227 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
228 return;
229 }
230 }
231 appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
232 }
233 break;
222 case OUTPUT_QUIT: { 234 case OUTPUT_QUIT: {
223 QString nick = ((IRCPerson *)output.getParam(0))->nick(); 235 QString nick = ((IRCPerson *)output.getParam(0))->nick();
224 QListIterator<IRCChannelTab> it(m_channelTabs); 236 QListIterator<IRCChannelTab> it(m_channelTabs);
225 for (; it.current(); ++it) { 237 for (; it.current(); ++it) {