X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircserverhandler.cpp;fp=src%2Fcore%2Fircserverhandler.cpp;h=efe1e532634c5cc0b1ef000f6f2426905ded2d80;hp=debe2efb355f21b9ea2cd4f8f8cafdec35900af3;hb=615c5621f63360ef11c9cc3519c0462d8b5ec85b;hpb=e49f87a6227dc6f82c17126a886cfc83ccf5e3ed diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index debe2efb..efe1e532 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -429,198 +429,6 @@ void IrcServerHandler::handle005(const QString &prefix, const QList network()->determinePrefixes(); } -/* -WHOIS-Message: - Replies 311 - 313, 317 - 319 are all replies generated in response to a WHOIS message. - and 301 (RPL_AWAY) - " :" -WHO-Message: - Replies 352 and 315 paired are used to answer a WHO message. - -WHOWAS-Message: - Replies 314 and 369 are responses to a WHOWAS message. - -*/ - -/* RPL_WHOISSERVICE - " is registered nick" */ -void IrcServerHandler::handle307(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle307()", params, 1)) - return; - - QString whoisServiceReply = serverDecode(params).join(" "); - IrcUser *ircuser = network()->ircUser(serverDecode(params[0])); - if(ircuser) { - ircuser->setWhoisServiceReply(whoisServiceReply); - } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(whoisServiceReply)); -} - -/* RPL_SUSERHOST - " is available for help." */ -void IrcServerHandler::handle310(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle310()", params, 1)) - return; - - QString suserHost = serverDecode(params).join(" "); - IrcUser *ircuser = network()->ircUser(serverDecode(params[0])); - if(ircuser) { - ircuser->setSuserHost(suserHost); - } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(suserHost)); -} - -/* RPL_WHOISUSER - " * :" */ -void IrcServerHandler::handle311(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle311()", params, 3)) - return; - - _whois = true; - IrcUser *ircuser = network()->ircUser(serverDecode(params[0])); - if(ircuser) { - ircuser->setUser(serverDecode(params[1])); - ircuser->setHost(serverDecode(params[2])); - ircuser->setRealName(serverDecode(params.last())); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is %2 (%3)") .arg(ircuser->nick()).arg(ircuser->hostmask()).arg(ircuser->realName())); - } else { - QString host = QString("%1!%2@%3").arg(serverDecode(params[0])).arg(serverDecode(params[1])).arg(serverDecode(params[2])); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is %2 (%3)") .arg(serverDecode(params[0])).arg(host).arg(serverDecode(params.last()))); - } -} - -/* RPL_WHOISSERVER - " :" */ -void IrcServerHandler::handle312(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle312()", params, 2)) - return; - - IrcUser *ircuser = network()->ircUser(serverDecode(params[0])); - if(ircuser) { - ircuser->setServer(serverDecode(params[1])); - } - - QString returnString = tr("%1 is online via %2 (%3)").arg(serverDecode(params[0])).arg(serverDecode(params[1])).arg(serverDecode(params.last())); - if(_whois) { - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(returnString)); - } else { - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whowas] %1").arg(returnString)); - } -} - -/* RPL_WHOISOPERATOR - " :is an IRC operator" */ -void IrcServerHandler::handle313(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle313()", params, 1)) - return; - - IrcUser *ircuser = network()->ircUser(serverDecode(params[0])); - if(ircuser) { - ircuser->setIrcOperator(params.last()); - } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(serverDecode(params).join(" "))); -} - -/* RPL_WHOWASUSER - " * :" */ -void IrcServerHandler::handle314(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle314()", params, 3)) - return; - - QString nick = serverDecode(params[0]); - QString hostmask = QString("%1@%2").arg(serverDecode(params[1])).arg(serverDecode(params[2])); - QString realName = serverDecode(params.last()); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whowas] %1 was %2 (%3)").arg(nick).arg(hostmask).arg(realName)); -} - -/* RPL_ENDOFWHO: " :End of WHO list" */ -void IrcServerHandler::handle315(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle315()", params, 1)) - return; - - QStringList p = serverDecode(params); - if(network()->setAutoWhoDone(p[0])) { - return; // stay silent - } - p.takeLast(); // should be "End of WHO list" - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] End of /WHO list for %1").arg(p.join(" "))); -} - -/* RPL_WHOISIDLE - " :seconds idle" - (real life: " :seconds idle, signon time) */ -void IrcServerHandler::handle317(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle317()", params, 2)) - return; - - QString nick = serverDecode(params[0]); - IrcUser *ircuser = network()->ircUser(nick); - - QDateTime now = QDateTime::currentDateTime(); - int idleSecs = serverDecode(params[1]).toInt(); - idleSecs *= -1; - - if(ircuser) { - ircuser->setIdleTime(now.addSecs(idleSecs)); - if(params.size() > 3) { // if we have more then 3 params we have the above mentioned "real life" situation - int loginTime = serverDecode(params[2]).toInt(); - ircuser->setLoginTime(QDateTime::fromTime_t(loginTime)); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is logged in since %2").arg(ircuser->nick()).arg(ircuser->loginTime().toString())); - } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is idling for %2 (%3)").arg(ircuser->nick()).arg(secondsToString(ircuser->idleTime().secsTo(now))).arg(ircuser->idleTime().toString())); - } else { - QDateTime idleSince = now.addSecs(idleSecs); - if (params.size() > 3) { // we have a signon time - int loginTime = serverDecode(params[2]).toInt(); - QDateTime datetime = QDateTime::fromTime_t(loginTime); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is logged in since %2").arg(nick).arg(datetime.toString())); - } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is idling for %2 (%3)").arg(nick).arg(secondsToString(idleSince.secsTo(now))).arg(idleSince.toString())); - } -} - -/* RPL_ENDOFWHOIS - " :End of WHOIS list" */ -void IrcServerHandler::handle318(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - _whois = false; - QStringList parameter = serverDecode(params); - parameter.removeFirst(); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(parameter.join(" "))); -} - -/* RPL_WHOISCHANNELS - " :*( ( "@" / "+" ) " " )" */ -void IrcServerHandler::handle319(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix) - if(!checkParamCount("IrcServerHandler::handle319()", params, 2)) - return; - - QString nick = serverDecode(params.first()); - QStringList op; - QStringList voice; - QStringList user; - foreach (QString channel, serverDecode(params.last()).split(" ")) { - if(channel.startsWith("@")) - op.append(channel.remove(0,1)); - else if(channel.startsWith("+")) - voice.append(channel.remove(0,1)); - else - user.append(channel); - } - if(!user.isEmpty()) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is a user on channels: %2").arg(nick).arg(user.join(" "))); - if(!voice.isEmpty()) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 has voice on channels: %2").arg(nick).arg(voice.join(" "))); - if(!op.isEmpty()) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is an operator on channels: %2").arg(nick).arg(op.join(" "))); -} - -/* RPL_WHOISVIRT - " is identified to services" */ -void IrcServerHandler::handle320(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1").arg(serverDecode(params).join(" "))); -} - /* RPL_LIST - " <# visible> :" */ void IrcServerHandler::handle322(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix) @@ -688,18 +496,6 @@ void IrcServerHandler::handle329(const QString &prefix, const QList emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Channel %1 created on %2").arg(channel, time.toString())); } -/* RPL_WHOISACCOUNT: " :is authed as */ -void IrcServerHandler::handle330(const QString &prefix, const QList ¶ms) { - Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle330()", params, 3)) - return; - - QString nick = serverDecode(params[0]); - QString account = serverDecode(params[1]); - - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is authed as %2").arg(nick).arg(account)); -} - /* RPL_NOTOPIC */ void IrcServerHandler::handle331(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix);