summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 90280d7..ecc7e9a 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -280,12 +280,46 @@ void IRCMessageParser::parseLiteralError(IRCMessage *message) {
280} 280}
281 281
282void IRCMessageParser::parseCTCPPing(IRCMessage *message) { 282void IRCMessageParser::parseCTCPPing(IRCMessage *message) {
283 IRCPerson mask(message->prefix()); 283 IRCPerson mask(message->prefix());
284 m_session->m_connection->sendCTCP(mask.nick(), "PING " + message->allParameters()); 284 m_session->m_connection->sendCTCP(mask.nick(), "PING " + message->allParameters());
285 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING from ")+mask.nick())); 285 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING from ")+mask.nick()));
286
287 //IRCPerson mask(message->prefix());
288 QString dest = message->ctcpDestination();
289 if (dest.startsWith("#")) {
290 IRCChannel *channel = m_session->getChannel(dest.lower());
291 if (channel) {
292 IRCChannelPerson *person = channel->getPerson(mask.nick());
293 if (person) {
294 IRCOutput output(OUTPUT_CHANACTION, tr("Received a CTCP PING from ")+ mask.nick()) ;
295 output.addParam(channel);
296 output.addParam(person);
297 emit outputReady(output);
298 } else {
299 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown person - Desynchronized?")));
300 }
301 } else {
302 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown channel - Desynchronized?")));
303 }
304 } else {
305 if (message->ctcpDestination() == m_session->m_server->nick()) {
306 IRCPerson *person = m_session->getPerson(mask.nick());
307 if (!person) {
308 /* Person not yet known, create and add to the current session */
309 person = new IRCPerson(message->prefix());
310 m_session->addPerson(person);
311 }
312 IRCOutput output(OUTPUT_QUERYACTION, tr("Received a CTCP PING from ")+ mask.nick() );
313 output.addParam(person);
314 emit outputReady(output);
315 } else {
316 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with bad recipient")));
317 }
318 }
319
286} 320}
287 321
288void IRCMessageParser::parseCTCPVersion(IRCMessage *message) { 322void IRCMessageParser::parseCTCPVersion(IRCMessage *message) {
289 IRCPerson mask(message->prefix()); 323 IRCPerson mask(message->prefix());
290 m_session->m_connection->sendCTCP(mask.nick(), APP_VERSION " " APP_COPYSTR); 324 m_session->m_connection->sendCTCP(mask.nick(), APP_VERSION " " APP_COPYSTR);
291 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP VERSION from ")+mask.nick())); 325 emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP VERSION from ")+mask.nick()));