void MyIrcSession::on_quit(IrcMessage *message) { IrcQuitMessage *m = (IrcQuitMessage *) message; for(std::list<std::string>::const_iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) { bool flags = 0; std::string nickname = TO_UTF8(m->sender().name()); flags = correctNickname(nickname); LOG4CXX_INFO(logger, user << ": " << nickname << " quit " << (*it) + suffix); np->handleParticipantChanged(user, nickname, (*it) + suffix,(int) flags, pbnetwork::STATUS_NONE, TO_UTF8(m->reason())); } }
void MyIrcSession::on_quit(IrcMessage *message) { IrcQuitMessage *m = (IrcQuitMessage *) message; std::string nickname = TO_UTF8(m->sender().name()); bool op = correctNickname(nickname); for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) { if (!hasIRCBuddy(it->second->getChannel(), nickname)) { continue; } removeIRCBuddy(it->second->getChannel(), nickname); LOG4CXX_INFO(logger, user << ": " << nickname << " quit " << it->second->getChannel() + suffix); np->handleParticipantChanged(user, nickname, it->second->getChannel() + suffix, op, pbnetwork::STATUS_NONE, TO_UTF8(m->reason())); } }
void tst_IrcMessage::testQuitMessage() { QFETCH(bool, valid); QFETCH(QByteArray, data); QFETCH(QString, reason); IrcConnection connection; IrcMessage* message = IrcMessage::fromData(data, &connection); QCOMPARE(message->type(), IrcMessage::Quit); QCOMPARE(message->command(), QString("QUIT")); QCOMPARE(message->property("valid").toBool(), valid); QCOMPARE(message->property("reason").toString(), reason); IrcQuitMessage* quitMessage = qobject_cast<IrcQuitMessage*>(message); QVERIFY(quitMessage); QCOMPARE(quitMessage->isValid(), valid); QCOMPARE(quitMessage->reason(), reason); }