projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing BR #369 (handle onotice/omsg properly, add /notice command)
[quassel.git]
/
src
/
core
/
ircserverhandler.cpp
diff --git
a/src/core/ircserverhandler.cpp
b/src/core/ircserverhandler.cpp
index
b6879bb
..
25e5c44
100644
(file)
--- a/
src/core/ircserverhandler.cpp
+++ b/
src/core/ircserverhandler.cpp
@@
-48,7
+48,7
@@
IrcServerHandler::~IrcServerHandler() {
void IrcServerHandler::handleServerMsg(QByteArray msg) {
try {
if(msg.isEmpty()) {
void IrcServerHandler::handleServerMsg(QByteArray msg) {
try {
if(msg.isEmpty()) {
- q
u
Warning() << "Received empty string from server!";
+ qWarning() << "Received empty string from server!";
return;
}
return;
}
@@
-68,7
+68,7
@@
void IrcServerHandler::handleServerMsg(QByteArray msg) {
QList<QByteArray> params = msg.split(' ');
if(!trailing.isEmpty()) params << trailing;
if(params.count() < 1) {
QList<QByteArray> params = msg.split(' ');
if(!trailing.isEmpty()) params << trailing;
if(params.count() < 1) {
- q
u
Warning() << "Received invalid string from server!";
+ qWarning() << "Received invalid string from server!";
return;
}
return;
}
@@
-79,7
+79,7
@@
void IrcServerHandler::handleServerMsg(QByteArray msg) {
foo.remove(0, 1);
prefix = foo;
if(params.count() < 1) {
foo.remove(0, 1);
prefix = foo;
if(params.count() < 1) {
- q
u
Warning() << "Received invalid string from server!";
+ qWarning() << "Received invalid string from server!";
return;
}
foo = serverDecode(params.takeFirst());
return;
}
foo = serverDecode(params.takeFirst());
@@
-92,7
+92,7
@@
void IrcServerHandler::handleServerMsg(QByteArray msg) {
uint num = cmd.toUInt();
if(num > 0) {
if(params.count() == 0) {
uint num = cmd.toUInt();
if(num > 0) {
if(params.count() == 0) {
- q
u
Warning() << "Message received from server violates RFC and is ignored!";
+ qWarning() << "Message received from server violates RFC and is ignored!";
return;
}
params.removeFirst();
return;
}
params.removeFirst();
@@
-244,7
+244,7
@@
void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
else
channel->removeUserMode(ircUser, QString(modes[c]));
} else {
else
channel->removeUserMode(ircUser, QString(modes[c]));
} else {
- q
u
Warning() << "Received MODE with too few parameters:" << serverDecode(params);
+ qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
}
paramOffset++;
} else {
}
paramOffset++;
} else {
@@
-255,7
+255,7
@@
void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
if(paramOffset < params.count()) {
value = params[paramOffset];
} else {
if(paramOffset < params.count()) {
value = params[paramOffset];
} else {
- q
u
Warning() << "Received MODE with too few parameters:" << serverDecode(params);
+ qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
}
paramOffset++;
}
}
paramOffset++;
}
@@
-304,7
+304,7
@@
void IrcServerHandler::handleNick(const QString &prefix, const QList<QByteArray>
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
- q
u
Warning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
+ qWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
return;
}
QString newnick = serverDecode(params[0]);
return;
}
QString newnick = serverDecode(params[0]);
@@
-326,10
+326,14
@@
void IrcServerHandler::handleNotice(const QString &prefix, const QList<QByteArra
return;
QString target = serverDecode(params[0]);
return;
QString target = serverDecode(params[0]);
- if(prefix.isEmpty() || target == "AUTH")
+ if(prefix.isEmpty() || target == "AUTH")
{
target = "";
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]);
}
networkConnection()->ctcpHandler()->parse(Message::Notice, prefix, target, params[1]);
}
@@
-341,7
+345,7
@@
void IrcServerHandler::handlePart(const QString &prefix, const QList<QByteArray>
IrcUser *ircuser = network()->updateNickFromMask(prefix);
QString channel = serverDecode(params[0]);
if(!ircuser) {
IrcUser *ircuser = network()->updateNickFromMask(prefix);
QString channel = serverDecode(params[0]);
if(!ircuser) {
- q
u
Warning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
+ qWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
return;
}
return;
}
@@
-383,12
+387,12
@@
void IrcServerHandler::handlePrivmsg(const QString &prefix, const QList<QByteArr
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
IrcUser *ircuser = network()->updateNickFromMask(prefix);
if(!ircuser) {
- q
u
Warning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
+ qWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
return;
}
if(params.isEmpty()) {
return;
}
if(params.isEmpty()) {
- q
u
Warning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
+ qWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
return;
}
return;
}
@@
-398,9
+402,8
@@
void IrcServerHandler::handlePrivmsg(const QString &prefix, const QList<QByteArr
? QByteArray("")
: 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
// it's possible to pack multiple privmsgs into one param using ctcp
// - > we let the ctcpHandler do the work
@@
-796,6
+799,10
@@
void IrcServerHandler::handle324(const QString &prefix, const QList<QByteArray>
/* RPL_??? - "<channel> <creation time (unix)>" */
void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
/* 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...
}
// FIXME implement this...
}
@@
-806,7
+813,10
@@
void IrcServerHandler::handle331(const QString &prefix, const QList<QByteArray>
return;
QString channel = serverDecode(params[0]);
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));
}
emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("No topic is set for %1.").arg(channel));
}
@@
-818,7
+828,10
@@
void IrcServerHandler::handle332(const QString &prefix, const QList<QByteArray>
QString channel = serverDecode(params[0]);
QString topic = channelDecode(channel, params[1]);
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));
}
emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Topic for %1 is \"%2\"").arg(channel, topic));
}
@@
-860,7
+873,7
@@
void IrcServerHandler::handle352(const QString &prefix, const QList<QByteArray>
/* RPL_NAMREPLY */
void IrcServerHandler::handle353(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
/* 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
return;
// param[0] is either "=", "*" or "@" indicating a public, private or secret channel
@@
-869,7
+882,7
@@
void IrcServerHandler::handle353(const QString &prefix, const QList<QByteArray>
IrcChannel *channel = network()->ircChannel(channelname);
if(!channel) {
IrcChannel *channel = network()->ircChannel(channelname);
if(!channel) {
- q
u
Warning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
+ qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
return;
}
return;
}
@@
-953,7
+966,7
@@
void IrcServerHandler::tryNextNick(const QString &errnick) {
bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams) {
if(params.count() < minParams) {
bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> ¶ms, int minParams) {
if(params.count() < minParams) {
- q
u
Warning() << qPrintable(methodName) << "requires" << 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;
return false;
} else {
return true;