#include "ircuser.h"
#include "ircchannel.h"
+#include "logger.h"
#include <QDebug>
// many nets define their own WHOIS fields. we fetch those not in need of special attention here:
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", "[Whois] " + params.join(" "), prefix);
} else {
- emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", cmd + " " + params.join(" "), prefix);
+ if(networkConnection()->coreSession()->ircListHelper()->requestInProgress(network()->networkId()))
+ networkConnection()->coreSession()->ircListHelper()->reportError(params.join(" "));
+ else
+ emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", cmd + " " + params.join(" "), prefix);
}
}
//qDebug() << prefix <<":"<<cmd<<params;
emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix);
IrcChannel *channel = network()->ircChannel(params[0]);
+ if(!channel) {
+ // we received mode information for a channel we're not in. that means probably we've just been kicked out or something like that
+ // anyways: we don't have a place to store the data --> discard the info.
+ return;
+ }
+
QString modes = params[1];
bool add = true;
int paramOffset = 2;
return;
QString target = serverDecode(params[0]);
- if(prefix.isEmpty() || target == "AUTH")
+ if(prefix.isEmpty() || target == "AUTH") {
target = "";
- else if(!network()->isChannelName(target))
- target = nickFromMask(prefix);
+ } else {
+ if(!target.isEmpty() && network()->prefixes().contains(target[0]))
+ target = target.mid(1);
+ if(!network()->isChannelName(target))
+ target = nickFromMask(prefix);
+ }
networkConnection()->ctcpHandler()->parse(Message::Notice, prefix, target, params[1]);
}
? QByteArray("")
: params[1];
- // are we the target?
- if(network()->isMyNick(target))
- target = nickFromMask(ircuser->nick());
+ if(!network()->isChannelName(target))
+ target = nickFromMask(prefix);
// it's possible to pack multiple privmsgs into one param using ctcp
// - > we let the ctcpHandler do the work
/* RPL_??? - "<channel> <creation time (unix)>" */
void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
+ Q_UNUSED(params)
+#ifdef __GNUC__
+# warning "Implement handle329 (Channel creation time)"
+#endif
// FIXME implement this...
}
return;
QString channel = serverDecode(params[0]);
- network()->ircChannel(channel)->setTopic(QString());
+ IrcChannel *chan = network()->ircChannel(channel);
+ if(chan)
+ chan->setTopic(QString());
+
emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("No topic is set for %1.").arg(channel));
}
QString channel = serverDecode(params[0]);
QString topic = channelDecode(channel, params[1]);
- network()->ircChannel(channel)->setTopic(topic);
+ IrcChannel *chan = network()->ircChannel(channel);
+ if(chan)
+ chan->setTopic(topic);
+
emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Topic for %1 is \"%2\"").arg(channel, topic));
}
/* RPL_NAMREPLY */
void IrcServerHandler::handle353(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
- if(!checkParamCount("IrcServerHandler::handle353()", params, 2))
+ if(!checkParamCount("IrcServerHandler::handle353()", params, 3))
return;
// param[0] is either "=", "*" or "@" indicating a public, private or secret channel
bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams) {
if(params.count() < minParams) {
- qWarning() << qPrintable(methodName) << "requieres" << minParams << "parameters but received only" << params.count() << serverDecode(params);
+ qWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params);
return false;
} else {
return true;