author | skyhusker <skyhusker> | 2005-02-01 19:12:34 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-02-01 19:12:34 (UTC) |
commit | 17a8d1d5d2d9ec7a5e09da00e055d566fbd85353 (patch) (unidiff) | |
tree | 7e645b05a471b9139303e3ceb34a45514ed475c0 | |
parent | e8eee0b7b169c5ed79f0eb9e0a76df06ec3fdcb4 (diff) | |
download | opie-17a8d1d5d2d9ec7a5e09da00e055d566fbd85353.zip opie-17a8d1d5d2d9ec7a5e09da00e055d566fbd85353.tar.gz opie-17a8d1d5d2d9ec7a5e09da00e055d566fbd85353.tar.bz2 |
Added proper action on ctcp ping reply
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index 9c1492c..ad9de2b 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -343,50 +343,58 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) { | |||
343 | delete person; | 343 | delete person; |
344 | } else { | 344 | } else { |
345 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); | 345 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); |
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | void IRCMessageParser::parseLiteralTopic(IRCMessage *message) { | 349 | void IRCMessageParser::parseLiteralTopic(IRCMessage *message) { |
350 | IRCPerson mask(message->prefix()); | 350 | IRCPerson mask(message->prefix()); |
351 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); | 351 | IRCChannel *channel = m_session->getChannel(message->param(0).lower()); |
352 | if (channel) { | 352 | if (channel) { |
353 | IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\""); | 353 | IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\""); |
354 | output.addParam(channel); | 354 | output.addParam(channel); |
355 | emit outputReady(output); | 355 | emit outputReady(output); |
356 | } else { | 356 | } else { |
357 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?"))); | 357 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?"))); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | void IRCMessageParser::parseLiteralError(IRCMessage *message) { | 361 | void IRCMessageParser::parseLiteralError(IRCMessage *message) { |
362 | emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); | 362 | emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); |
363 | } | 363 | } |
364 | 364 | ||
365 | void IRCMessageParser::parseCTCPPing(IRCMessage *message) { | 365 | void IRCMessageParser::parseCTCPPing(IRCMessage *message) { |
366 | IRCPerson mask(message->prefix()); | 366 | IRCPerson mask(message->prefix()); |
367 | if(message->isCTCPReply()) { | ||
368 | unsigned int sentTime = message->param(0).toUInt(); | ||
369 | QDateTime tm; | ||
370 | tm.setTime_t(0); | ||
371 | unsigned int receivedTime = tm.secsTo(QDateTime::currentDateTime()); | ||
372 | emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING reply from %1: %2 seconds").arg(mask.nick()).arg(receivedTime-sentTime))); | ||
373 | return; | ||
374 | } | ||
367 | m_session->m_connection->sendCTCPReply(mask.nick(), "PING", message->allParameters()); | 375 | m_session->m_connection->sendCTCPReply(mask.nick(), "PING", message->allParameters()); |
368 | emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING from ") + mask.nick())); | 376 | emit outputReady(IRCOutput(OUTPUT_CTCP, tr("Received a CTCP PING request from %1").arg(mask.nick()))); |
369 | 377 | ||
370 | //IRCPerson mask(message->prefix()); | 378 | //IRCPerson mask(message->prefix()); |
371 | QString dest = message->ctcpDestination(); | 379 | QString dest = message->ctcpDestination(); |
372 | if (dest.startsWith("#")) { | 380 | if (dest.startsWith("#")) { |
373 | IRCChannel *channel = m_session->getChannel(dest.lower()); | 381 | IRCChannel *channel = m_session->getChannel(dest.lower()); |
374 | if (channel) { | 382 | if (channel) { |
375 | IRCChannelPerson *person = channel->getPerson(mask.nick()); | 383 | IRCChannelPerson *person = channel->getPerson(mask.nick()); |
376 | if (person) { | 384 | if (person) { |
377 | IRCOutput output(OUTPUT_CHANACTION, tr("Received a CTCP PING from ")+ mask.nick()) ; | 385 | IRCOutput output(OUTPUT_CHANACTION, tr("Received a CTCP PING from ")+ mask.nick()) ; |
378 | output.addParam(channel); | 386 | output.addParam(channel); |
379 | output.addParam(person); | 387 | output.addParam(person); |
380 | emit outputReady(output); | 388 | emit outputReady(output); |
381 | } else { | 389 | } else { |
382 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown person - Desynchronized?"))); | 390 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown person - Desynchronized?"))); |
383 | } | 391 | } |
384 | } else { | 392 | } else { |
385 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown channel - Desynchronized?"))); | 393 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP PING with unknown channel - Desynchronized?"))); |
386 | } | 394 | } |
387 | } else { | 395 | } else { |
388 | if (message->ctcpDestination() == m_session->m_server->nick()) { | 396 | if (message->ctcpDestination() == m_session->m_server->nick()) { |
389 | IRCPerson *person = m_session->getPerson(mask.nick()); | 397 | IRCPerson *person = m_session->getPerson(mask.nick()); |
390 | if (!person) { | 398 | if (!person) { |
391 | /* Person not yet known, create and add to the current session */ | 399 | /* Person not yet known, create and add to the current session */ |
392 | person = new IRCPerson(message->prefix()); | 400 | person = new IRCPerson(message->prefix()); |