}
}
-/* RPL_ISUPPORT */
-// TODO Complete 005 handling, also use sensible defaults for non-sent stuff
-void IrcServerHandler::handle005(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- const int numParams = params.size();
- if(numParams == 0) {
- emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Received RPL_ISUPPORT (005) without parameters!"), prefix);
- return;
- }
-
- emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", serverDecode(params).join(" "), prefix);
-
- QString rpl_isupport_suffix = serverDecode(params.last());
- if(!rpl_isupport_suffix.toLower().contains("are supported by this server")) {
- emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Received non RFC compliant RPL_ISUPPORT: this can lead to unexpected behavior!"), prefix);
- }
-
- QString rawSupport;
- QString key, value;
- for(int i = 0; i < numParams - 1; i++) {
- QString rawSupport = serverDecode(params[i]);
- QString key = rawSupport.section("=", 0, 0);
- QString value = rawSupport.section("=", 1);
- network()->addSupport(key, value);
- }
-
- /* determine our prefixes here to get an accurate result */
- network()->determinePrefixes();
-}
-
-/* RPL_LIST - "<channel> <# visible> :<topic>" */
-void IrcServerHandler::handle322(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix)
- QString channelName;
- quint32 userCount = 0;
- QString topic;
-
- int paramCount = params.count();
- switch(paramCount) {
- case 3:
- topic = serverDecode(params[2]);
- case 2:
- userCount = serverDecode(params[1]).toUInt();
- case 1:
- channelName = serverDecode(params[0]);
- default:
- break;
- }
- if(!coreSession()->ircListHelper()->addChannel(network()->networkId(), channelName, userCount, topic))
- emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Channel %1 has %2 users. Topic is: %3").arg(channelName).arg(userCount).arg(topic));
-}
-
-/* RPL_LISTEND ":End of LIST" */
-void IrcServerHandler::handle323(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix)
- Q_UNUSED(params)
-
- if(!coreSession()->ircListHelper()->endOfChannelList(network()->networkId()))
- emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("End of channel list"));
-}
-
/* RPL_CHANNELMODEIS - "<channel> <mode> <mode params>" */
void IrcServerHandler::handle324(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
handleMode(prefix, params);
}
-/* RPL_??? - "<channel> <homepage> */
-void IrcServerHandler::handle328(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle328()", params, 2))
- return;
-
- QString channel = serverDecode(params[0]);
- QString homepage = serverDecode(params[1]);
-
- emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Homepage for %1 is %2").arg(channel, homepage));
-}
-
-
-/* RPL_??? - "<channel> <creation time (unix)>" */
-void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle329()", params, 2))
- return;
-
- QString channel = serverDecode(params[0]);
- uint unixtime = params[1].toUInt();
- if(!unixtime) {
- qWarning() << Q_FUNC_INFO << "received invalid timestamp:" << params[1];
- return;
- }
- QDateTime time = QDateTime::fromTime_t(unixtime);
-
- emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Channel %1 created on %2").arg(channel, time.toString()));
-}
-
-/* RPL_NOTOPIC */
-void IrcServerHandler::handle331(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle331()", params, 1))
- return;
-
- QString channel = serverDecode(params[0]);
- IrcChannel *chan = network()->ircChannel(channel);
- if(chan)
- chan->setTopic(QString());
-
- emit displayMsg(Message::Topic, BufferInfo::ChannelBuffer, channel, tr("No topic is set for %1.").arg(channel));
-}
-
-/* RPL_TOPIC */
-void IrcServerHandler::handle332(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle332()", params, 2))
- return;
-
- QString channel = serverDecode(params[0]);
- QByteArray rawTopic = params[1];
-#ifdef HAVE_QCA2
- rawTopic = decrypt(channel, rawTopic, true);
-#endif
- QString topic = channelDecode(channel, rawTopic);
-
- IrcChannel *chan = network()->ircChannel(channel);
- if(chan)
- chan->setTopic(topic);
-
- emit displayMsg(Message::Topic, BufferInfo::ChannelBuffer, channel, tr("Topic for %1 is \"%2\"").arg(channel, topic));
-}
-
-/* Topic set by... */
-void IrcServerHandler::handle333(const QString &prefix, const QList<QByteArray> ¶ms) {
- Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle333()", params, 3))
- return;
-
- QString channel = serverDecode(params[0]);
- emit displayMsg(Message::Topic, BufferInfo::ChannelBuffer, channel,
- 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> ¶ms) {
Q_UNUSED(prefix);