void dlgIRC::onMessageReceived( IrcMessage* msg ) { switch( msg->type() ) { case IrcMessage::Type::Join: { IrcJoinMessage *rmsg = static_cast<IrcJoinMessage*>(msg); slot_joined( rmsg->sender().name(), rmsg->channel() ); break; } case IrcMessage::Type::Notice: { IrcNoticeMessage *rmsg = static_cast<IrcNoticeMessage*>(msg); irc_gotMsg( rmsg->sender().name(), rmsg->target(), rmsg->message() ); break; } case IrcMessage::Type::Private: { IrcPrivateMessage *rmsg = static_cast<IrcPrivateMessage*>(msg); irc_gotMsg( rmsg->sender().name(), rmsg->target(), rmsg->message() ); break; } case IrcMessage::Type::Numeric: { IrcNumericMessage *rmsg = static_cast<IrcNumericMessage*>(msg); irc_gotMsg3( rmsg->sender().name(), rmsg->code(), rmsg->parameters() ); break; } case IrcMessage::Type::Part: { IrcPartMessage *rmsg = static_cast<IrcPartMessage*>(msg); slot_parted( rmsg->sender().name(), rmsg->channel(), rmsg->reason() ); break; } case IrcMessage::Type::Unknown: irc_gotMsg2( msg->sender().name(), msg->parameters() ); break; } /* Nick IrcNickMessage Quit IrcQuitMessage Topic IrcTopicMessage Invite IrcInviteMessage Kick IrcKickMessage Mode IrcModeMessage Ping IrcPingMessage Pong IrcPongMessage Error IrcErrorMessage */ }
void tst_IrcMessage::testPartMessage() { QFETCH(bool, valid); QFETCH(QByteArray, data); QFETCH(QString, channel); QFETCH(QString, reason); IrcConnection connection; IrcMessage* message = IrcMessage::fromData(data, &connection); QCOMPARE(message->type(), IrcMessage::Part); QCOMPARE(message->command(), QString("PART")); QCOMPARE(message->property("valid").toBool(), valid); QCOMPARE(message->property("channel").toString(), channel); QCOMPARE(message->property("reason").toString(), reason); IrcPartMessage* partMessage = qobject_cast<IrcPartMessage*>(message); QVERIFY(partMessage); QCOMPARE(partMessage->isValid(), valid); QCOMPARE(partMessage->channel(), channel); QCOMPARE(partMessage->reason(), reason); }
void MyIrcSession::on_parted(IrcMessage *message) { IrcPartMessage *m = (IrcPartMessage *) message; bool flags = 0; std::string nickname = TO_UTF8(m->sender().name()); flags = correctNickname(nickname); LOG4CXX_INFO(logger, user << ": " << nickname << " parted " << TO_UTF8(m->channel()) + suffix); np->handleParticipantChanged(user, nickname, TO_UTF8(m->channel()) + suffix,(int) flags, pbnetwork::STATUS_NONE, TO_UTF8(m->reason())); }