Force parsing of PREFIX in RPL_ISUPPORT. Fixes #936
[quassel.git] / src / core / ircserverhandler.cpp
index 534229c..32a40f0 100644 (file)
@@ -197,6 +197,21 @@ void IrcServerHandler::defaultHandler(QString cmd, const QString &prefix, const
 //******************************/
 // IRC SERVER HANDLER
 //******************************/
+void IrcServerHandler::handleInvite(const QString &prefix, const QList<QByteArray> &params) {
+  if(!checkParamCount("IrcServerHandler::handleInvite()", params, 2))
+    return;
+//   qDebug() << "IrcServerHandler::handleInvite()" << prefix << params;
+
+  IrcUser *ircuser = network()->updateNickFromMask(prefix);
+  if(!ircuser) {
+    return;
+  }
+
+  QString channel = serverDecode(params[1]);
+
+  emit displayMsg(Message::Invite, BufferInfo::StatusBuffer, "", tr("%1 invited you to channel %2").arg(ircuser->nick()).arg(channel));
+}
+
 void IrcServerHandler::handleJoin(const QString &prefix, const QList<QByteArray> &params) {
   if(!checkParamCount("IrcServerHandler::handleJoin()", params, 1))
     return;
@@ -635,6 +650,9 @@ void IrcServerHandler::handle005(const QString &prefix, const QList<QByteArray>
     QString value = rawSupport.section("=", 1);
     network()->addSupport(key, value);
   }
+
+  /* determine our prefixes here to get an accurate result */
+  network()->determinePrefixes();
 }
 
 /* RPL_UMODEIS - "<user_modes> [<user_mode_params>]" */
@@ -783,7 +801,8 @@ void IrcServerHandler::handle311(const QString &prefix, const QList<QByteArray>
     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 {
-    emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Whois] %1 is %2 (%3)") .arg(serverDecode(params[1])).arg(serverDecode(params[2])).arg(serverDecode(params.last())));
+    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())));
   }
 }
 
@@ -1024,6 +1043,23 @@ void IrcServerHandler::handle333(const QString &prefix, const QList<QByteArray>
                   tr("Topic set by %1 on %2") .arg(serverDecode(params[1]), QDateTime::fromTime_t(channelDecode(channel, params[2]).toUInt()).toString()));
 }
 
+/* RPL_INVITING - "<nick> <channel>*/
+void IrcServerHandler::handle341(const QString &prefix, const QList<QByteArray> &params) {
+  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: "<channel> <user> <host> <server> <nick>
               ( "H" / "G" > ["*"] [ ( "@" / "+" ) ] :<hopcount> <real name>" */
 void IrcServerHandler::handle352(const QString &prefix, const QList<QByteArray> &params) {