-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index d1b70a5..2b77414 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -34,8 +34,12 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { | |||
34 | { 3, FUNC(parseNumerical003) }, // RPL_CREATED | 34 | { 3, FUNC(parseNumerical003) }, // RPL_CREATED |
35 | { 4, FUNC(parseNumerical004) }, // RPL_MYINFO | 35 | { 4, FUNC(parseNumerical004) }, // RPL_MYINFO |
36 | { 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL | 36 | { 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL |
37 | { 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT | 37 | { 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT |
38 | { 252, FUNC(parseNumericalStats) }, // RPL_LUSEROP | ||
39 | { 265, FUNC(parseNumericalStats) }, // RPL_LOCALUSERS | ||
40 | { 266, FUNC(parseNumericalStats) }, // RPL_GLOBALUSERS | ||
41 | { 250, FUNC(parseNumericalStats) }, // RPL_STATSCONN | ||
38 | { 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS | 42 | { 254, FUNC(nullFunc)}, // RPL_LUSERCHANNELS |
39 | { 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME | 43 | { 255, FUNC(parseNumericalStats) }, // RPL_LUSERNAME |
40 | { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC | 44 | { 332, FUNC(parseNumericalTopic) }, // RPL_TOPIC |
41 | { 333, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME | 45 | { 333, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME |
@@ -99,9 +103,9 @@ void IRCMessageParser::parseLiteralNotice(IRCMessage *message) { | |||
99 | emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters())); | 103 | emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters())); |
100 | } | 104 | } |
101 | 105 | ||
102 | void IRCMessageParser::parseLiteralJoin(IRCMessage *message) { | 106 | void IRCMessageParser::parseLiteralJoin(IRCMessage *message) { |
103 | QString channelName = message->param(0); | 107 | QString channelName = message->param(0).lower(); |
104 | IRCPerson mask(message->prefix()); | 108 | IRCPerson mask(message->prefix()); |
105 | IRCChannel *channel = m_session->getChannel(channelName); | 109 | IRCChannel *channel = m_session->getChannel(channelName); |
106 | if (!channel) { | 110 | if (!channel) { |
107 | /* We joined */ | 111 | /* We joined */ |
@@ -137,9 +141,9 @@ void IRCMessageParser::parseLiteralJoin(IRCMessage *message) { | |||
137 | } | 141 | } |
138 | } | 142 | } |
139 | 143 | ||
140 | void IRCMessageParser::parseLiteralPart(IRCMessage *message) { | 144 | void IRCMessageParser::parseLiteralPart(IRCMessage *message) { |
141 | QString channelName = message->param(0); | 145 | QString channelName = message->param(0).lower(); |
142 | IRCChannel *channel = m_session->getChannel(channelName); | 146 | IRCChannel *channel = m_session->getChannel(channelName); |
143 | IRCPerson mask(message->prefix()); | 147 | IRCPerson mask(message->prefix()); |
144 | if (channel) { | 148 | if (channel) { |
145 | if (mask.nick() == m_session->m_server->nick()) { | 149 | if (mask.nick() == m_session->m_server->nick()) { |
@@ -180,9 +184,9 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { | |||
180 | output.addParam(person); | 184 | output.addParam(person); |
181 | emit outputReady(output); | 185 | emit outputReady(output); |
182 | } else if (message->param(0).at(0) == '#') { | 186 | } else if (message->param(0).at(0) == '#') { |
183 | /* IRC Channel message detected, verify sender, channel and display it */ | 187 | /* IRC Channel message detected, verify sender, channel and display it */ |
184 | IRCChannel *channel = m_session->getChannel(message->param(0)); | 188 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); |
185 | if (channel) { | 189 | if (channel) { |
186 | IRCPerson mask(message->prefix()); | 190 | IRCPerson mask(message->prefix()); |
187 | IRCChannelPerson *person = channel->getPerson(mask.nick()); | 191 | IRCChannelPerson *person = channel->getPerson(mask.nick()); |
188 | if (person) { | 192 | if (person) { |
@@ -193,9 +197,9 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { | |||
193 | } else { | 197 | } else { |
194 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); | 198 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); |
195 | } | 199 | } |
196 | } else { | 200 | } else { |
197 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0))); | 201 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0).lower())); |
198 | } | 202 | } |
199 | } else { | 203 | } else { |
200 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); | 204 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); |
201 | } | 205 | } |
@@ -246,9 +250,9 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) { | |||
246 | } | 250 | } |
247 | 251 | ||
248 | void IRCMessageParser::parseLiteralTopic(IRCMessage *message) { | 252 | void IRCMessageParser::parseLiteralTopic(IRCMessage *message) { |
249 | IRCPerson mask(message->prefix()); | 253 | IRCPerson mask(message->prefix()); |
250 | IRCChannel *channel = m_session->getChannel(message->param(0)); | 254 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); |
251 | if (channel) { | 255 | if (channel) { |
252 | IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\""); | 256 | IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\""); |
253 | output.addParam(channel); | 257 | output.addParam(channel); |
254 | emit outputReady(output); | 258 | emit outputReady(output); |
@@ -276,9 +280,9 @@ void IRCMessageParser::parseCTCPVersion(IRCMessage *message) { | |||
276 | void IRCMessageParser::parseCTCPAction(IRCMessage *message) { | 280 | void IRCMessageParser::parseCTCPAction(IRCMessage *message) { |
277 | IRCPerson mask(message->prefix()); | 281 | IRCPerson mask(message->prefix()); |
278 | QString dest = message->ctcpDestination(); | 282 | QString dest = message->ctcpDestination(); |
279 | if (dest.startsWith("#")) { | 283 | if (dest.startsWith("#")) { |
280 | IRCChannel *channel = m_session->getChannel(dest); | 284 | IRCChannel *channel = m_session->getChannel(dest.lower()); |
281 | if (channel) { | 285 | if (channel) { |
282 | IRCChannelPerson *person = channel->getPerson(mask.nick()); | 286 | IRCChannelPerson *person = channel->getPerson(mask.nick()); |
283 | if (person) { | 287 | if (person) { |
284 | IRCOutput output(OUTPUT_CHANACTION, "*" + mask.nick() + message->param(0)); | 288 | IRCOutput output(OUTPUT_CHANACTION, "*" + mask.nick() + message->param(0)); |
@@ -311,9 +315,9 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) { | |||
311 | void IRCMessageParser::parseLiteralMode(IRCMessage *message) { | 315 | void IRCMessageParser::parseLiteralMode(IRCMessage *message) { |
312 | IRCPerson mask(message->prefix()); | 316 | IRCPerson mask(message->prefix()); |
313 | 317 | ||
314 | if (message->param(0).startsWith("#")) { | 318 | if (message->param(0).startsWith("#")) { |
315 | IRCChannel *channel = m_session->getChannel(message->param(0)); | 319 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); |
316 | if (channel) { | 320 | if (channel) { |
317 | QString temp, parameters = message->allParameters().right(message->allParameters().length() - channel->channelname().length() - 1); | 321 | QString temp, parameters = message->allParameters().right(message->allParameters().length() - channel->channelname().length() - 1); |
318 | QTextIStream stream(¶meters); | 322 | QTextIStream stream(¶meters); |
319 | bool set = FALSE; | 323 | bool set = FALSE; |
@@ -382,9 +386,9 @@ void IRCMessageParser::parseLiteralMode(IRCMessage *message) { | |||
382 | } | 386 | } |
383 | 387 | ||
384 | void IRCMessageParser::parseLiteralKick(IRCMessage *message) { | 388 | void IRCMessageParser::parseLiteralKick(IRCMessage *message) { |
385 | IRCPerson mask(message->prefix()); | 389 | IRCPerson mask(message->prefix()); |
386 | IRCChannel *channel = m_session->getChannel(message->param(0)); | 390 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); |
387 | if (channel) { | 391 | if (channel) { |
388 | IRCChannelPerson *person = channel->getPerson(message->param(1)); | 392 | IRCChannelPerson *person = channel->getPerson(message->param(1)); |
389 | if (person) { | 393 | if (person) { |
390 | if (person->person->nick() == m_session->m_server->nick()) { | 394 | if (person->person->nick() == m_session->m_server->nick()) { |
@@ -433,9 +437,9 @@ void IRCMessageParser::parseNumericalStats(IRCMessage *message) { | |||
433 | } | 437 | } |
434 | 438 | ||
435 | void IRCMessageParser::parseNumericalNames(IRCMessage *message) { | 439 | void IRCMessageParser::parseNumericalNames(IRCMessage *message) { |
436 | /* Name list sent when joining a channel */ | 440 | /* Name list sent when joining a channel */ |
437 | IRCChannel *channel = m_session->getChannel(message->param(2)); | 441 | IRCChannel *channel = m_session->getChannel(message->param(2).lower()); |
438 | if (channel != 0) { | 442 | if (channel != 0) { |
439 | QString people = message->param(3); | 443 | QString people = message->param(3); |
440 | QTextIStream stream(&people); | 444 | QTextIStream stream(&people); |
441 | QString temp; | 445 | QString temp; |
@@ -477,9 +481,9 @@ void IRCMessageParser::parseNumericalNames(IRCMessage *message) { | |||
477 | } | 481 | } |
478 | 482 | ||
479 | void IRCMessageParser::parseNumericalEndOfNames(IRCMessage *message) { | 483 | void IRCMessageParser::parseNumericalEndOfNames(IRCMessage *message) { |
480 | /* Done syncing to channel */ | 484 | /* Done syncing to channel */ |
481 | IRCChannel *channel = m_session->getChannel(message->param(1)); | 485 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); |
482 | if (channel) { | 486 | if (channel) { |
483 | channel->setHasPeople(TRUE); | 487 | channel->setHasPeople(TRUE); |
484 | /* Yes, we want the names before anything happens inside the GUI */ | 488 | /* Yes, we want the names before anything happens inside the GUI */ |
485 | IRCOutput output(OUTPUT_SELFJOIN, tr("You joined channel ") + channel->channelname()); | 489 | IRCOutput output(OUTPUT_SELFJOIN, tr("You joined channel ") + channel->channelname()); |
@@ -500,9 +504,9 @@ void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) { | |||
500 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); | 504 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); |
501 | } | 505 | } |
502 | 506 | ||
503 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { | 507 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { |
504 | IRCChannel *channel = m_session->getChannel(message->param(1)); | 508 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); |
505 | if (channel) { | 509 | if (channel) { |
506 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\"")); | 510 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\"")); |
507 | output.addParam(channel); | 511 | output.addParam(channel); |
508 | emit outputReady(output); | 512 | emit outputReady(output); |