From: Manuel Nickschas Date: Fri, 8 Oct 2010 14:31:24 +0000 (+0200) Subject: Event backend porting X-Git-Tag: 0.8-beta1~92 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5ff4265bbd3a682a6d6542480760eaf4a2b85d77 Event backend porting RPL_INVITING (341), RPL_WHOREPLY (352), RPL_NAMREPLY (353), RPL_ENDOFWHOWAS (369) --- diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 048913ff..3b5ad27e 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -390,6 +390,61 @@ void CoreSessionEventProcessor::processIrcEvent332(IrcEvent *e) { chan->setTopic(e->params()[1]); } +/* RPL_WHOREPLY: " + ( "H" / "G" > ["*"] [ ( "@" / "+" ) ] : " */ +void CoreSessionEventProcessor::processIrcEvent352(IrcEvent *e) { + if(!checkParamCount(e, 6)) + return; + + QString channel = e->params()[0]; + IrcUser *ircuser = e->network()->ircUser(e->params()[4]); + if(ircuser) { + ircuser->setUser(e->params()[1]); + ircuser->setHost(e->params()[2]); + + bool away = e->params()[5].startsWith("G"); + ircuser->setAway(away); + ircuser->setServer(e->params()[3]); + ircuser->setRealName(e->params().last().section(" ", 1)); + } + + if(coreNetwork(e)->isAutoWhoInProgress(channel)) + e->setFlag(EventManager::Silent); +} + +/* RPL_NAMREPLY */ +void CoreSessionEventProcessor::processIrcEvent353(IrcEvent *e) { + if(!checkParamCount(e, 3)) + return; + + // param[0] is either "=", "*" or "@" indicating a public, private or secret channel + // we don't use this information at the time beeing + QString channelname = e->params()[1]; + + IrcChannel *channel = e->network()->ircChannel(channelname); + if(!channel) { + qWarning() << Q_FUNC_INFO << "Received unknown target channel:" << channelname; + return; + } + + QStringList nicks; + QStringList modes; + + foreach(QString nick, e->params()[2].split(' ')) { + QString mode; + + if(e->network()->prefixes().contains(nick[0])) { + mode = e->network()->prefixToMode(nick[0]); + nick = nick.mid(1); + } + + nicks << nick; + modes << mode; + } + + channel->joinIrcUsers(nicks, modes); +} + /* template void CoreSessionEventProcessor::processIrcEvent(IrcEvent *e) { if(!checkParamCount(e, 1)) diff --git a/src/core/coresessioneventprocessor.h b/src/core/coresessioneventprocessor.h index 5c3907b3..7c533e46 100644 --- a/src/core/coresessioneventprocessor.h +++ b/src/core/coresessioneventprocessor.h @@ -67,6 +67,8 @@ public: Q_INVOKABLE void processIrcEvent323(IrcEvent *event); // RPL_LISTEND Q_INVOKABLE void processIrcEvent331(IrcEvent *event); // RPL_NOTOPIC Q_INVOKABLE void processIrcEvent332(IrcEvent *event); // RPL_TOPIC + Q_INVOKABLE void processIrcEvent352(IrcEvent *event); // RPL_WHOREPLY + Q_INVOKABLE void processIrcEvent353(IrcEvent *event); // RPL_NAMREPLY // Q_INVOKABLE void processIrcEvent(IrcEvent *event); diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index 9135d485..94c967de 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -404,6 +404,26 @@ void EventStringifier::processIrcEvent333(IrcEvent *e) { .arg(e->params()[1], QDateTime::fromTime_t(e->params()[2].toInt()).toString()), QString(), channel); } +/* RPL_INVITING - " */ +void EventStringifier::processIrcEvent341(IrcEvent *e) { + if(!checkParamCount(e, 2)) + return; + + QString channel = e->params()[1]; + displayMsg(e, Message::Server, tr("%1 has been invited to %2").arg(e->params().first(), channel), QString(), channel); +} + +/* RPL_WHOREPLY: " + ( "H" / "G" > ["*"] [ ( "@" / "+" ) ] : " */ +void EventStringifier::processIrcEvent352(IrcEvent *e) { + displayMsg(e, Message::Server, tr("[Who] %1").arg(e->params().join(" "))); +} + +/* RPL_ENDOFWHOWAS - " :End of WHOWAS" */ +void EventStringifier::processIrcEvent369(IrcEvent *e) { + displayMsg(e, Message::Server, tr("End of /WHOWAS")); +} + // template /* diff --git a/src/core/eventstringifier.h b/src/core/eventstringifier.h index 3de23f98..c31842ee 100644 --- a/src/core/eventstringifier.h +++ b/src/core/eventstringifier.h @@ -76,6 +76,10 @@ public: Q_INVOKABLE void processIrcEvent331(IrcEvent *event); // RPL_NOTOPIC Q_INVOKABLE void processIrcEvent332(IrcEvent *event); // RPL_TOPIC Q_INVOKABLE void processIrcEvent333(IrcEvent *event); // RPL_??? (topic set by) + Q_INVOKABLE void processIrcEvent341(IrcEvent *event); // RPL_INVITING + Q_INVOKABLE void processIrcEvent352(IrcEvent *event); // RPL_WHOREPLY + Q_INVOKABLE void processIrcEvent369(IrcEvent *event); // RPL_ENDOFWHOWAS + // Q_INVOKABLE void processIrcEvent(IrcEvent *event); diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 363b0f15..dfb30098 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -405,87 +405,6 @@ void IrcServerHandler::handle324(const QString &prefix, const QList handleMode(prefix, params); } -/* RPL_INVITING - " */ -void IrcServerHandler::handle341(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle341()", params, 2)) - return; - - QString nick = serverDecode(params[0]); - - IrcChannel *channel = network()->ircChannel(serverDecode(params[1])); - if(!channel) { - qWarning() << "IrcServerHandler::handle341(): unknown channel:" << params[1]; - return; - } - - emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel->name(), tr("%1 has been invited to %2").arg(nick).arg(channel->name())); -} - -/* RPL_WHOREPLY: " - ( "H" / "G" > ["*"] [ ( "@" / "+" ) ] : " */ -void IrcServerHandler::handle352(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle352()", params, 6)) - return; - - QString channel = serverDecode(params[0]); - IrcUser *ircuser = network()->ircUser(serverDecode(params[4])); - if(ircuser) { - ircuser->setUser(serverDecode(params[1])); - ircuser->setHost(serverDecode(params[2])); - - bool away = serverDecode(params[5]).startsWith("G") ? true : false; - ircuser->setAway(away); - ircuser->setServer(serverDecode(params[3])); - ircuser->setRealName(serverDecode(params.last()).section(" ", 1)); - } - - if(!network()->isAutoWhoInProgress(channel)) { - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); - } -} - -/* RPL_NAMREPLY */ -void IrcServerHandler::handle353(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle353()", params, 3)) - return; - - // param[0] is either "=", "*" or "@" indicating a public, private or secret channel - // we don't use this information at the time beeing - QString channelname = serverDecode(params[1]); - - IrcChannel *channel = network()->ircChannel(channelname); - if(!channel) { - qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname; - return; - } - - QStringList nicks; - QStringList modes; - - foreach(QString nick, serverDecode(params[2]).split(' ')) { - QString mode = QString(); - - if(network()->prefixes().contains(nick[0])) { - mode = network()->prefixToMode(nick[0]); - nick = nick.mid(1); - } - - nicks << nick; - modes << mode; - } - - channel->joinIrcUsers(nicks, modes); -} - -/* RPL_ENDOFWHOWAS - " :End of WHOWAS" */ -void IrcServerHandler::handle369(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whowas] %1").arg(serverDecode(params).join(" "))); -} - /* ERR_ERRONEUSNICKNAME */ void IrcServerHandler::handle432(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix); diff --git a/src/core/ircserverhandler.h b/src/core/ircserverhandler.h index f8305473..94416a09 100644 --- a/src/core/ircserverhandler.h +++ b/src/core/ircserverhandler.h @@ -41,10 +41,6 @@ public slots: void handlePrivmsg(const QString &prefix, const QList ¶ms); void handleQuit(const QString &prefix, const QList ¶ms); void handle324(const QString &prefix, const QList ¶ms); // RPL_CHANNELMODEIS - void handle341(const QString &prefix, const QList ¶ms); // RPL_INVITING - void handle352(const QString &prefix, const QList ¶ms); // RPL_WHOREPLY - void handle353(const QString &prefix, const QList ¶ms); // RPL_NAMREPLY - void handle369(const QString &prefix, const QList ¶ms); // RPL_ENDOFWHOWAS void handle432(const QString &prefix, const QList ¶ms); // ERR_ERRONEUSNICKNAME void handle433(const QString &prefix, const QList ¶ms); // ERR_NICKNAMEINUSE void handle437(const QString &prefix, const QList ¶ms); // ERR_UNAVAILRESOURCE