209
208
ctcpArgument = konv_app->doAutoreplace(ctcpArgument, false);
211
210
// If it was a ctcp action, build an action string
212
if (ctcpCommand == "action" && isChan)
211
if (ctcpCommand == "action" && isChan && hasArg)
214
if (!isIgnore(prefix, Ignore::Channel))
213
if (!isIgnore(prefix,Ignore::Channel))
216
215
Channel* channel = server->getChannelByName( parameterList.value(0) );
225
224
if (sourceNick != server->getNickname())
227
if (hasArg && ctcpArgument.toLower().contains(QRegExp("(^|[^\\d\\w])"
226
if (ctcpArgument.toLower().contains(QRegExp("(^|[^\\d\\w])"
228
227
+ QRegExp::escape(server->loweredNickname())
229
228
+ "([^\\d\\w]|$)")))
240
239
// If it was a ctcp action, build an action string
241
else if (ctcpCommand == "action" && !isChan)
240
else if (ctcpCommand == "action" && !isChan && hasArg)
243
242
// Check if we ignore queries from this nick
244
if (!isIgnore(prefix, Ignore::Query))
243
if (!isIgnore(prefix,Ignore::Query))
246
245
NickInfoPtr nickinfo = server->obtainNickInfo(sourceNick);
247
246
nickinfo->setHostmask(sourceHostmask);
250
249
query = server->addQuery(nickinfo, false /* we didn't initiate this*/ );
252
251
// send action to query
253
query->appendAction(sourceNick, ctcpArgument);
252
query->appendAction(sourceNick,ctcpArgument);
255
if (sourceNick != server->getNickname() && query)
254
if(sourceNick != server->getNickname() && query)
256
256
konv_app->notificationHandler()->queryMessage(query, sourceNick, ctcpArgument);
310
311
// Do not internationalize the below version string
311
reply = QString("Konversation %1 Build %2 (C) 2002-2010 by the Konversation team")
312
.arg(QString(KONVI_VERSION))
313
.arg(QString::number(COMMIT));
312
reply = QString("Konversation %1 (C) 2002-2010 by the Konversation team")
313
.arg(QString(KONVI_VERSION));
316
316
server->ctcpReply(sourceNick,"VERSION "+reply);
441
441
else if (ctcpCommand=="clientinfo" && !isChan)
443
if (!isIgnore(prefix, Ignore::CTCP))
445
server->appendMessageToFrontmost(i18n("CTCP"),
446
i18n("Received CTCP-%1 request from %2, sending answer.",
447
QString::fromLatin1("CLIENTINFO"), sourceNick)
449
server->ctcpReply(sourceNick,QString("CLIENTINFO ACTION CLIENTINFO DCC PING TIME VERSION"));
443
server->appendMessageToFrontmost(i18n("CTCP"),
444
i18n("Received CTCP-%1 request from %2, sending answer.",
445
QString::fromLatin1("CLIENTINFO"), sourceNick)
447
server->ctcpReply(sourceNick,QString("CLIENTINFO ACTION CLIENTINFO DCC PING TIME VERSION"));
452
449
else if (ctcpCommand=="time" && !isChan)
454
if (!isIgnore(prefix, Ignore::CTCP))
456
server->appendMessageToFrontmost(i18n("CTCP"),
457
i18n("Received CTCP-%1 request from %2, sending answer.",
458
QString::fromLatin1("TIME"), sourceNick)
460
server->ctcpReply(sourceNick,QString("TIME ")+QDateTime::currentDateTime().toString());
451
server->appendMessageToFrontmost(i18n("CTCP"),
452
i18n("Received CTCP-%1 request from %2, sending answer.",
453
QString::fromLatin1("TIME"), sourceNick)
455
server->ctcpReply(sourceNick,QString("TIME ")+QDateTime::currentDateTime().toString());
464
458
// No known CTCP request, give a general message
520
514
int dateArrived=QDateTime::currentDateTime().toTime_t();
521
515
int dateSent=reply.toInt();
522
516
int time = dateArrived-dateSent;
523
QString unit = i18np("second", "seconds", time);
517
QString unit = "seconds";
525
522
server->appendMessageToFrontmost(i18n("CTCP"),
526
523
i18n("Received CTCP-PING reply from %1: %2 %3.",
623
620
// Join the channel
624
621
server->joinChannel(channelName, sourceHostmask);
623
server->resetNickList(channelName);
626
625
// Upon JOIN we're going to receive some NAMES input from the server which
627
626
// we need to be able to tell apart from manual invocations of /names
628
627
setAutomaticRequest("NAMES",channelName,true);
1124
1123
server->appendCommandMessageToChannel(parameterList.value(1), i18n("Topic"),
1125
1124
i18n("The topic was set by %1 on %2.",
1126
1125
parameterList.value(2), KGlobal::locale()->formatDateTime(when, KLocale::ShortDate)),
1132
1130
server->appendMessageToFrontmost(i18n("Topic"),i18n("The topic for %1 was set by %2 on %3.",
1133
1131
parameterList.value(1),
1134
1132
parameterList.value(2),
1135
KGlobal::locale()->formatDateTime(when, KLocale::ShortDate)),
1133
KGlobal::locale()->formatDateTime(when, KLocale::ShortDate))
1137
1135
setAutomaticRequest("TOPIC",parameterList.value(1), false);
1139
1137
emit topicAuthor(parameterList.value(1), parameterList.value(2), when);
1474
case RPL_WHOISSECURE:
1478
if (getAutomaticRequest("WHOIS", parameterList.value(1)) == 0)
1479
server->appendMessageToFrontmost(i18n("Whois"), i18n("%1 is using a secure connection.", parameterList.value(1)));
1483
1464
// Sample WHO response
1484
1465
//"/WHO #lounge"
1485
1466
//[21:39] [352] #lounge jasmine bots.worldforge.org irc.worldforge.org jasmine H 0 jasmine
1944
1925
case RPL_BANLIST:
1946
//:calvino.freenode.net 367 argonel #konversation fooish!~a@example.com argonel!argkde4@konversation/developer/argonel 1269464382
1949
1929
if (getAutomaticRequest("BANLIST", parameterList.value(1)))
1951
server->addBan(parameterList.value(1), parameterList.join(" ").section(' ', 2, 4)); //<-- QString::Section handles out of bounds end parameter
1931
server->addBan(parameterList.value(1), parameterList.join(" ").section(' ', 2, 4));
1955
1935
QDateTime when;
1957
when.setTime_t(parameterList.value(4).toUInt());
1959
when = QDateTime::currentDateTime(); //use todays date instead of Jan 1 1970
1961
QString setter(parameterList.value(3, i18nc("The server didn't respond with the identity of the ban creator, so we say unknown (in brackets to avoid confusion with a real nickname)", "(unknown)")).section('!', 0, 0));
1936
when.setTime_t(parameterList.value(4).toUInt());
1963
1938
server->appendMessageToFrontmost(i18n("BanList:%1", parameterList.value(1)),
1964
1939
i18nc("BanList message: e.g. *!*@aol.com set by MrGrim on <date>", "%1 set by %2 on %3",
1965
parameterList.value(2), setter, KGlobal::locale()->formatDateTime(when, KLocale::ShortDate))
1940
parameterList.value(2), parameterList.value(3).section('!', 0, 0), KGlobal::locale()->formatDateTime(when, KLocale::ShortDate))
2009
1984
server->pongReceived();
2011
else if (getAutomaticRequest("WHOIS", parameterList.value(1)) == 1) //Inhibit message if this was an automatic request
2013
setAutomaticRequest("WHOIS", parameterList.value(1), false);
2017
server->appendMessageToFrontmost(i18n("Error"), i18n("No such server: %1.", parameterList.value(1)));