summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp100
1 files changed, 58 insertions, 42 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index cfad2c1..9c1492c 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -1,11 +1,13 @@
1#include <qtextstream.h> 1#include <qtextstream.h>
2#include <qdatetime.h> 2#include <qdatetime.h>
3 3
4#include "ircmessageparser.h" 4#include "ircmessageparser.h"
5#include "ircversion.h" 5#include "ircversion.h"
6#include "ircchannelperson.h"
7//#include "transferreceiver.h"
6 8
7/* Lookup table for literal commands */ 9/* Lookup table for literal commands */
8IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { 10IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
9 { "PING", FUNC(parseLiteralPing) }, 11 { "PING", FUNC(parseLiteralPing) },
10 { "NOTICE", FUNC(parseLiteralNotice) }, 12 { "NOTICE", FUNC(parseLiteralNotice) },
11 { "JOIN", FUNC(parseLiteralJoin) }, 13 { "JOIN", FUNC(parseLiteralJoin) },
@@ -23,12 +25,13 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
23 25
24/* Lookup table for literal commands */ 26/* Lookup table for literal commands */
25IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = { 27IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = {
26 { "PING", FUNC(parseCTCPPing) }, 28 { "PING", FUNC(parseCTCPPing) },
27 { "VERSION", FUNC(parseCTCPVersion) }, 29 { "VERSION", FUNC(parseCTCPVersion) },
28 { "ACTION", FUNC(parseCTCPAction) }, 30 { "ACTION", FUNC(parseCTCPAction) },
31 { "DCC", FUNC(parseCTCPDCC) },
29 { 0 , 0 } 32 { 0 , 0 }
30}; 33};
31 34
32/* Lookup table for numerical commands 35/* Lookup table for numerical commands
33 * According to: 36 * According to:
34 * http://www.faqs.org/rfcs/rfc1459.html 37 * http://www.faqs.org/rfcs/rfc1459.html
@@ -47,16 +50,17 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
47 { 253, QT_TR_NOOP("There are %1 unknown connection(s)"), "1", 0 }, // RPL_LUSERUNKNOWN 50 { 253, QT_TR_NOOP("There are %1 unknown connection(s)"), "1", 0 }, // RPL_LUSERUNKNOWN
48 { 254, QT_TR_NOOP("There are %1 channels formed"), "1", 0 }, // RPL_LUSERCHANNELS 51 { 254, QT_TR_NOOP("There are %1 channels formed"), "1", 0 }, // RPL_LUSERCHANNELS
49 { 255, "%1", "1", 0 }, // RPL_LUSERME 52 { 255, "%1", "1", 0 }, // RPL_LUSERME
50 { 263, QT_TR_NOOP("Please wait a while and try again"), 0, 0 }, // RPL_TRYAGAIN 53 { 263, QT_TR_NOOP("Please wait a while and try again"), 0, 0 }, // RPL_TRYAGAIN
51 { 265, "%1", "1", 0 }, // RPL_LOCALUSERS 54 { 265, "%1", "1", 0 }, // RPL_LOCALUSERS
52 { 266, "%1", "1", 0 }, // RPL_GLOBALUSERS 55 { 266, "%1", "1", 0 }, // RPL_GLOBALUSERS
53 { 311, QT_TR_NOOP("Whois %1 (%2@%3)\nReal name: %4"), "1:3,5" }, // RPL_WHOISUSER 56 { 311, QT_TR_NOOP("Whois %1 (%2@%3)\nReal name: %4"), "1:3,5", 0 }, // RPL_WHOISUSER
54 { 312, QT_TR_NOOP("%1 is using server %2"), "1,2", 0 }, // RPL_WHOISSERVER 57 { 312, QT_TR_NOOP("%1 is using server %2"), "1,2", 0 }, // RPL_WHOISSERVER
55 { 317, 0, 0, FUNC(parseNumericalWhoisIdle) }, // RPL_WHOISIDLE 58 { 317, 0, 0, FUNC(parseNumericalWhoisIdle) }, // RPL_WHOISIDLE
56 { 318, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOIS 59 { 318, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOIS
60 { 319, QT_TR_NOOP("%1 is on channels: %2"), "1,2", 0 }, // RPL_WHOISCHANNELS
57 { 320, "%1 %2", "1,2", 0}, // RPL_WHOISVIRT 61 { 320, "%1 %2", "1,2", 0}, // RPL_WHOISVIRT
58 { 332, 0, 0, FUNC(parseNumericalTopic) }, // RPL_TOPIC 62 { 332, 0, 0, FUNC(parseNumericalTopic) }, // RPL_TOPIC
59 { 333, 0, 0, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME*/ 63 { 333, 0, 0, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME*/
60 { 353, QT_TR_NOOP("Names for %1: %2"), "2,3", FUNC(parseNumericalNames) }, // RPL_NAMREPLY 64 { 353, QT_TR_NOOP("Names for %1: %2"), "2,3", FUNC(parseNumericalNames) }, // RPL_NAMREPLY
61 { 366, "%1 :%2", "1,2", FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES 65 { 366, "%1 :%2", "1,2", FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
62 { 369, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOWAS 66 { 369, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOWAS
@@ -64,13 +68,13 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
64 { 375, "%1", "1", 0 }, // RPL_MOTDSTART 68 { 375, "%1", "1", 0 }, // RPL_MOTDSTART
65 { 376, "%1", "1", 0 }, // RPL_ENDOFMOTD 69 { 376, "%1", "1", 0 }, // RPL_ENDOFMOTD
66 { 377, "%1", "1", 0 }, // RPL_MOTD2 70 { 377, "%1", "1", 0 }, // RPL_MOTD2
67 { 378, "%1", "1", 0 }, // RPL_MOTD3 71 { 378, "%1", "1", 0 }, // RPL_MOTD3
68 { 391, QT_TR_NOOP("Time on server %1 is %2"), "1,2", 0 }, // RPL_TIME 72 { 391, QT_TR_NOOP("Time on server %1 is %2"), "1,2", 0 }, // RPL_TIME
69 { 401, QT_TR_NOOP("Channel or nick %1 doesn't exists"), "1", 0 }, // ERR_NOSUCHNICK 73 { 401, QT_TR_NOOP("Channel or nick %1 doesn't exists"), "1", 0 }, // ERR_NOSUCHNICK
70 { 406, QT_TR_NOOP("There is no history information for %1"), "1" }, // ERR_WASNOSUCHNICK 74 { 406, QT_TR_NOOP("There is no history information for %1"), "1", 0 }, // ERR_WASNOSUCHNICK
71 { 409, "%1", "1", 0 }, // ERR_NOORIGIN 75 { 409, "%1", "1", 0 }, // ERR_NOORIGIN
72 { 411, "%1", "1", 0 }, // ERR_NORECIPIENT 76 { 411, "%1", "1", 0 }, // ERR_NORECIPIENT
73 { 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND 77 { 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND
74 { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_ERR_UNKNOWNCOMMAND 78 { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_ERR_UNKNOWNCOMMAND
75 { 422, "%1", "1", 0 }, // ERR_NOMOTD 79 { 422, "%1", "1", 0 }, // ERR_NOMOTD
76 { 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE 80 { 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE
@@ -96,13 +100,13 @@ void IRCMessageParser::parse(IRCMessage *message) {
96 } 100 }
97 } 101 }
98 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled numeric command: %1").arg( QString::number(message->commandNumber()) ))); 102 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled numeric command: %1").arg( QString::number(message->commandNumber()) )));
99 } else if (message->isCTCP()) { 103 } else if (message->isCTCP()) {
100 for (int i=0; ctcpParserProcTable[i].commandName; i++) { 104 for (int i=0; ctcpParserProcTable[i].commandName; i++) {
101 if (message->ctcpCommand() == ctcpParserProcTable[i].commandName) { 105 if (message->ctcpCommand() == ctcpParserProcTable[i].commandName) {
102 (this->*(ctcpParserProcTable[i].proc))(message); 106 parseCTCP(message, i);
103 return; 107 return;
104 } 108 }
105 } 109 }
106 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled ctcp command: %1").arg( message->ctcpCommand())) ); 110 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled ctcp command: %1").arg( message->ctcpCommand())) );
107 } else { 111 } else {
108 for (int i=0; literalParserProcTable[i].commandName; i++) { 112 for (int i=0; literalParserProcTable[i].commandName; i++) {
@@ -131,15 +135,22 @@ void IRCMessageParser::parseNumerical(IRCMessage *message, int position) {
131 } 135 }
132 136
133 if(numericalParserProcTable[position].proc) 137 if(numericalParserProcTable[position].proc)
134 (this->*(numericalParserProcTable[position].proc))(message); 138 (this->*(numericalParserProcTable[position].proc))(message);
135} 139}
136 140
141void IRCMessageParser::parseCTCP(IRCMessage *message, int position) {
142 if(ctcpParserProcTable[position].proc)
143 (this->*(ctcpParserProcTable[position].proc))(message);
144}
145
146
147
137void IRCMessageParser::parseNumericalServerName(IRCMessage *message) { 148void IRCMessageParser::parseNumericalServerName(IRCMessage *message) {
138 emit outputReady(IRCOutput(OUTPUT_TITLE, tr("Connected to")+" <b>" + message->prefix() + "</b>")); 149 emit outputReady(IRCOutput(OUTPUT_TITLE, tr("Connected to")+" <b>" + message->prefix() + "</b>"));
139 /* Register EFFECTIVE nickname, some networks (as irc-hispano) uses nick:password 150 /* Register EFFECTIVE nickname, some networks (as irc-hispano) use nick:password
140 * for authentication and the parser gets confused */ 151 * for authentication and the parser gets confused */
141 m_session->m_server->setNick(message->param(0)); 152 m_session->m_server->setNick(message->param(0));
142 153
143} 154}
144 155
145void IRCMessageParser::parseNumericalServerFeatures(IRCMessage *message) { 156void IRCMessageParser::parseNumericalServerFeatures(IRCMessage *message) {
@@ -186,20 +197,18 @@ void IRCMessageParser::parseLiteralJoin(IRCMessage *message) {
186 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nonexistant channel join - desynchronized?"))); 197 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nonexistant channel join - desynchronized?")));
187 } 198 }
188 } else { 199 } else {
189 /* Someone else joined */ 200 /* Someone else joined */
190 if (mask.nick() != m_session->m_server->nick()) { 201 if (mask.nick() != m_session->m_server->nick()) {
191 if (!channel->getPerson(mask.nick())) { 202 if (!channel->getPerson(mask.nick())) {
192 IRCChannelPerson *chanperson = new IRCChannelPerson();
193 IRCPerson *person = m_session->getPerson(mask.nick()); 203 IRCPerson *person = m_session->getPerson(mask.nick());
194 if (!person) { 204 if (!person) {
195 person = new IRCPerson(message->prefix()); 205 person = new IRCPerson(message->prefix());
196 m_session->addPerson(person); 206 m_session->addPerson(person);
197 } 207 }
198 chanperson->flags = 0; 208 IRCChannelPerson *chanperson = new IRCChannelPerson(person);
199 chanperson->person = person;
200 channel->addPerson(chanperson); 209 channel->addPerson(chanperson);
201 IRCOutput output(OUTPUT_OTHERJOIN ,tr("%1 joined channel %2").arg( mask.nick() ).arg( channelName )); 210 IRCOutput output(OUTPUT_OTHERJOIN ,tr("%1 joined channel %2").arg( mask.nick() ).arg( channelName ));
202 output.addParam(channel); 211 output.addParam(channel);
203 output.addParam(chanperson); 212 output.addParam(chanperson);
204 emit outputReady(output); 213 emit outputReady(output);
205 } else { 214 } else {
@@ -352,13 +361,13 @@ void IRCMessageParser::parseLiteralTopic(IRCMessage *message) {
352void IRCMessageParser::parseLiteralError(IRCMessage *message) { 361void IRCMessageParser::parseLiteralError(IRCMessage *message) {
353 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); 362 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
354} 363}
355 364
356void IRCMessageParser::parseCTCPPing(IRCMessage *message) { 365void IRCMessageParser::parseCTCPPing(IRCMessage *message) {
357 IRCPerson mask(message->prefix()); 366 IRCPerson mask(message->prefix());
358 m_session->m_connection->sendCTCP(mask.nick(), "PING " + message->allParameters()); 367 m_session->m_connection->sendCTCPReply(mask.nick(), "PING", message->allParameters());
359 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING from ")+mask.nick())); 368 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING from ")+mask.nick()));
360 369
361 //IRCPerson mask(message->prefix()); 370 //IRCPerson mask(message->prefix());
362 QString dest = message->ctcpDestination(); 371 QString dest = message->ctcpDestination();
363 if (dest.startsWith("#")) { 372 if (dest.startsWith("#")) {
364 IRCChannel *channel = m_session->getChannel(dest.lower()); 373 IRCChannel *channel = m_session->getChannel(dest.lower());
@@ -392,14 +401,22 @@ void IRCMessageParser::parseCTCPPing(IRCMessage *message) {
392 } 401 }
393 402
394} 403}
395 404
396void IRCMessageParser::parseCTCPVersion(IRCMessage *message) { 405void IRCMessageParser::parseCTCPVersion(IRCMessage *message) {
397 IRCPerson mask(message->prefix()); 406 IRCPerson mask(message->prefix());
398 m_session->m_connection->sendCTCP(mask.nick(), "VERSION " APP_VERSION " " APP_COPYSTR); 407 IRCOutput output(OUTPUT_CTCP);
399 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP VERSION from ")+mask.nick())); 408 if(message->isCTCPRequest()) {
409 m_session->m_connection->sendCTCPReply(mask.nick(), "VERSION", APP_VERSION " " APP_COPYSTR);
410 output.setMessage(tr("Received a CTCP VERSION request from ") + mask.nick());
411 }
412
413 else {
414 output.setMessage("Received CTCP VERSION reply from " + mask.nick() + ":" + message->param(0));
415 }
416 emit outputReady(output);
400} 417}
401 418
402void IRCMessageParser::parseCTCPAction(IRCMessage *message) { 419void IRCMessageParser::parseCTCPAction(IRCMessage *message) {
403 IRCPerson mask(message->prefix()); 420 IRCPerson mask(message->prefix());
404 QString dest = message->ctcpDestination(); 421 QString dest = message->ctcpDestination();
405 if (dest.startsWith("#")) { 422 if (dest.startsWith("#")) {
@@ -431,12 +448,22 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) {
431 } else { 448 } else {
432 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP ACTION with bad recipient"))); 449 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP ACTION with bad recipient")));
433 } 450 }
434 } 451 }
435} 452}
436 453
454void IRCMessageParser::parseCTCPDCC(IRCMessage *message) {
455 QStringList params = QStringList::split(' ', message->param(0).stripWhiteSpace());
456 if( params.count() != 5) {
457 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from ") + IRCPerson(message->prefix()).nick()));
458 return;
459 }
460
461 //TransferReceiver *foo = new TransferReceiver(params[2].toUInt(), params[3].toUInt(), params[1], params[4].toUInt());
462}
463
437void IRCMessageParser::parseLiteralMode(IRCMessage *message) { 464void IRCMessageParser::parseLiteralMode(IRCMessage *message) {
438 IRCPerson mask(message->prefix()); 465 IRCPerson mask(message->prefix());
439 466
440 if (message->param(0).startsWith("#")) { 467 if (message->param(0).startsWith("#")) {
441 IRCChannel *channel = m_session->getChannel(message->param(0).lower()); 468 IRCChannel *channel = m_session->getChannel(message->param(0).lower());
442 if (channel) { 469 if (channel) {
@@ -445,60 +472,50 @@ void IRCMessageParser::parseLiteralMode(IRCMessage *message) {
445 bool set = FALSE; 472 bool set = FALSE;
446 while (!stream.atEnd()) { 473 while (!stream.atEnd()) {
447 stream >> temp; 474 stream >> temp;
448 if (temp.startsWith("+")) { 475 if (temp.startsWith("+")) {
449 set = TRUE; 476 set = TRUE;
450 temp = temp.right(1); 477 temp = temp.right(1);
451 } else if (temp.startsWith("-")) { 478 }
479 else
480 if (temp.startsWith("-")) {
452 set = FALSE; 481 set = FALSE;
453 temp = temp.right(1); 482 temp = temp.right(1);
454 } else { 483 }
484 else {
455 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change has unknown type"))); 485 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change has unknown type")));
456 return; 486 return;
457 } 487 }
458 if (temp == "o") { 488 if (temp == "o") {
459 stream >> temp; 489 stream >> temp;
460 IRCChannelPerson *person = channel->getPerson(temp); 490 IRCChannelPerson *person = channel->getPerson(temp);
461 if (person) { 491 if (person) {
462 if (set) { 492 IRCOutput output(OUTPUT_CHANPERSONMODE, person->setOp(mask.nick(), set));
463 person->flags |= PERSON_FLAG_OP;
464 IRCOutput output(OUTPUT_CHANPERSONMODE, mask.nick() + tr(" gives channel operator status to " + person->person->nick()));
465 output.addParam(channel);
466 output.addParam(person);
467 emit outputReady(output);
468 } else {
469 person->flags &= 0xFFFF - PERSON_FLAG_OP;
470 IRCOutput output(OUTPUT_CHANPERSONMODE, mask.nick() + tr(" removes channel operator status from " + person->person->nick()));
471 output.addParam(channel); 493 output.addParam(channel);
472 output.addParam(person); 494 output.addParam(person);
473 emit outputReady(output); 495 emit outputReady(output);
474 } 496 }
475 } else { 497 else {
476 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown person - Desynchronized?"))); 498 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown person - Desynchronized?")));
477 } 499 }
478 } else if (temp == "v") { 500 }
501 else
502 if (temp == "v") {
479 stream >> temp; 503 stream >> temp;
480 IRCChannelPerson *person = channel->getPerson(temp); 504 IRCChannelPerson *person = channel->getPerson(temp);
481 if (person) { 505 if (person) {
482 if (set) { 506 IRCOutput output(OUTPUT_CHANPERSONMODE, person->setVoice(mask.nick(), set));
483 person->flags |= PERSON_FLAG_VOICE;
484 IRCOutput output(OUTPUT_CHANPERSONMODE, mask.nick() + tr(" gives voice to " + person->person->nick()));
485 output.addParam(channel);
486 output.addParam(person);
487 emit outputReady(output);
488 } else {
489 person->flags &= 0xFFFF - PERSON_FLAG_VOICE;
490 IRCOutput output(OUTPUT_CHANPERSONMODE, mask.nick() + tr(" removes voice from " + person->person->nick()));
491 output.addParam(channel); 507 output.addParam(channel);
492 output.addParam(person); 508 output.addParam(person);
493 emit outputReady(output); 509 emit outputReady(output);
494 } 510 }
495 } else { 511 else {
496 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown person - Desynchronized?"))); 512 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown person - Desynchronized?")));
497 } 513 }
498 } else { 514 }
515 else {
499 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown flag"))); 516 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown flag")));
500 } 517 }
501 } 518 }
502 } else { 519 } else {
503 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown kannel - Desynchronized?"))); 520 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change with unknown kannel - Desynchronized?")));
504 } 521 }
@@ -510,21 +527,21 @@ void IRCMessageParser::parseLiteralMode(IRCMessage *message) {
510void IRCMessageParser::parseLiteralKick(IRCMessage *message) { 527void IRCMessageParser::parseLiteralKick(IRCMessage *message) {
511 IRCPerson mask(message->prefix()); 528 IRCPerson mask(message->prefix());
512 IRCChannel *channel = m_session->getChannel(message->param(0).lower()); 529 IRCChannel *channel = m_session->getChannel(message->param(0).lower());
513 if (channel) { 530 if (channel) {
514 IRCChannelPerson *person = channel->getPerson(message->param(1)); 531 IRCChannelPerson *person = channel->getPerson(message->param(1));
515 if (person) { 532 if (person) {
516 if (person->person->nick() == m_session->m_server->nick()) { 533 if (person->nick() == m_session->m_server->nick()) {
517 m_session->removeChannel(channel); 534 m_session->removeChannel(channel);
518 IRCOutput output(OUTPUT_SELFKICK, tr("You were kicked from ") + channel->channelname() + tr(" by ") + mask.nick() + " (" + message->param(2) + ")"); 535 IRCOutput output(OUTPUT_SELFKICK, tr("You were kicked from ") + channel->channelname() + tr(" by ") + mask.nick() + " (" + message->param(2) + ")");
519 output.addParam(channel); 536 output.addParam(channel);
520 emit outputReady(output); 537 emit outputReady(output);
521 } else { 538 } else {
522 /* someone else got kicked */ 539 /* someone else got kicked */
523 channel->removePerson(person); 540 channel->removePerson(person);
524 IRCOutput output(OUTPUT_OTHERKICK, person->person->nick() + tr(" was kicked from ") + channel->channelname() + tr(" by ") + mask.nick()+ " (" + message->param(2) + ")"); 541 IRCOutput output(OUTPUT_OTHERKICK, person->nick() + tr(" was kicked from ") + channel->channelname() + tr(" by ") + mask.nick()+ " (" + message->param(2) + ")");
525 output.addParam(channel); 542 output.addParam(channel);
526 output.addParam(person); 543 output.addParam(person);
527 emit outputReady(output); 544 emit outputReady(output);
528 } 545 }
529 } else { 546 } else {
530 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person kick - desynchronized?"))); 547 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person kick - desynchronized?")));
@@ -550,30 +567,29 @@ void IRCMessageParser::parseNumericalNames(IRCMessage *message) {
550 QString nick; 567 QString nick;
551 /* Parse person flags */ 568 /* Parse person flags */
552 if (flagch == '@' || flagch == '+' || flagch=='%' || flagch == '*') { 569 if (flagch == '@' || flagch == '+' || flagch=='%' || flagch == '*') {
553 570
554 nick = temp.right(temp.length()-1); 571 nick = temp.right(temp.length()-1);
555 switch (flagch) { 572 switch (flagch) {
556 case '@': flag = PERSON_FLAG_OP; break; 573 case '@': flag = IRCChannelPerson::PERSON_FLAG_OP; break;
557 case '+': flag = PERSON_FLAG_VOICE; break; 574 case '+': flag = IRCChannelPerson::PERSON_FLAG_VOICE; break;
558 case '%': flag = PERSON_FLAG_HALFOP; break; 575 case '%': flag = IRCChannelPerson::PERSON_FLAG_HALFOP; break;
559 default : flag = 0; break; 576 default : flag = 0; break;
560 } 577 }
561 } else { 578 } else {
562 nick = temp; 579 nick = temp;
563 } 580 }
564 581
565 IRCChannelPerson *chan_person = new IRCChannelPerson();
566 IRCPerson *person = m_session->getPerson(nick); 582 IRCPerson *person = m_session->getPerson(nick);
567 if (person == 0) { 583 if (person == 0) {
568 person = new IRCPerson(); 584 person = new IRCPerson();
569 person->setNick(nick); 585 person->setNick(nick);
570 m_session->addPerson(person); 586 m_session->addPerson(person);
571 } 587 }
572 chan_person->person = person; 588 IRCChannelPerson *chan_person = new IRCChannelPerson(person);
573 chan_person->flags = flag; 589 chan_person->setFlags(flag);
574 channel->addPerson(chan_person); 590 channel->addPerson(chan_person);
575 } 591 }
576 } else { 592 } else {
577 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel"))); 593 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel")));
578 } 594 }
579} 595}