summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index a2be5a4..4038673 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -17,24 +17,25 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
17 { "MODE", FUNC(parseLiteralMode) }, 17 { "MODE", FUNC(parseLiteralMode) },
18 { "KICK", FUNC(parseLiteralKick) }, 18 { "KICK", FUNC(parseLiteralKick) },
19 { 0 , 0 } 19 { 0 , 0 }
20}; 20};
21 21
22/* Lookup table for literal commands */ 22/* Lookup table for literal commands */
23IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = { 23IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = {
24 { "PING", FUNC(parseCTCPPing) }, 24 { "PING", FUNC(parseCTCPPing) },
25 { "VERSION", FUNC(parseCTCPVersion) }, 25 { "VERSION", FUNC(parseCTCPVersion) },
26 { "ACTION", FUNC(parseCTCPAction) }, 26 { "ACTION", FUNC(parseCTCPAction) },
27 { 0 , 0 } 27 { 0 , 0 }
28}; 28};
29
29/* Lookup table for numerical commands */ 30/* Lookup table for numerical commands */
30IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { 31IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
31 { 1, FUNC(parseNumerical001) }, // RPL_WELCOME 32 { 1, FUNC(parseNumerical001) }, // RPL_WELCOME
32 { 2, FUNC(parseNumerical002) }, // RPL_YOURHOST 33 { 2, FUNC(parseNumerical002) }, // RPL_YOURHOST
33 { 3, FUNC(parseNumerical003) }, // RPL_CREATED 34 { 3, FUNC(parseNumerical003) }, // RPL_CREATED
34 { 4, FUNC(parseNumerical004) }, // RPL_MYINFO 35 { 4, FUNC(parseNumerical004) }, // RPL_MYINFO
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
39 { 353, FUNC(parseNumericalNames) }, // RPL_NAMREPLY 40 { 353, FUNC(parseNumericalNames) }, // RPL_NAMREPLY
40 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES 41 { 366, FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
@@ -219,29 +220,31 @@ void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
219} 220}
220 221
221void IRCMessageParser::parseLiteralQuit(IRCMessage *message) { 222void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
222 IRCPerson mask(message->prefix()); 223 IRCPerson mask(message->prefix());
223 IRCPerson *person = m_session->getPerson(mask.nick()); 224 IRCPerson *person = m_session->getPerson(mask.nick());
224 if (person) { 225 if (person) {
225 QList<IRCChannel> channels; 226 QList<IRCChannel> channels;
226 m_session->getChannelsByPerson(person, channels); 227 m_session->getChannelsByPerson(person, channels);
227 QListIterator<IRCChannel> it(channels); 228 QListIterator<IRCChannel> it(channels);
228 for (;it.current(); ++it) { 229 for (;it.current(); ++it) {
229 IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick()); 230 IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick());
230 it.current()->removePerson(chanperson); 231 it.current()->removePerson(chanperson);
232 delete chanperson;
231 } 233 }
232 m_session->removePerson(person); 234 m_session->removePerson(person);
233 IRCOutput output(OUTPUT_QUIT, mask.nick() + tr(" has quit ") + "(" + message->param(0) + ")"); 235 IRCOutput output(OUTPUT_QUIT, mask.nick() + tr(" has quit ") + "(" + message->param(0) + ")");
234 output.addParam(person); 236 output.addParam(person);
235 emit outputReady(output); 237 emit outputReady(output);
238 delete person;
236 } else { 239 } else {
237 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); 240 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?")));
238 } 241 }
239} 242}
240 243
241void IRCMessageParser::parseLiteralError(IRCMessage *message) { 244void IRCMessageParser::parseLiteralError(IRCMessage *message) {
242 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); 245 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
243} 246}
244 247
245void IRCMessageParser::parseCTCPPing(IRCMessage *message) { 248void IRCMessageParser::parseCTCPPing(IRCMessage *message) {
246 IRCPerson mask(message->prefix()); 249 IRCPerson mask(message->prefix());
247 m_session->m_connection->sendCTCP(mask.nick(), "PING " + message->allParameters()); 250 m_session->m_connection->sendCTCP(mask.nick(), "PING " + message->allParameters());