summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (ignore 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
@@ -262,48 +262,82 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
262 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); 262 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?")));
263 } 263 }
264} 264}
265 265
266void IRCMessageParser::parseLiteralTopic(IRCMessage *message) { 266void IRCMessageParser::parseLiteralTopic(IRCMessage *message) {
267 IRCPerson mask(message->prefix()); 267 IRCPerson mask(message->prefix());
268 IRCChannel *channel = m_session->getChannel(message->param(0).lower()); 268 IRCChannel *channel = m_session->getChannel(message->param(0).lower());
269 if (channel) { 269 if (channel) {
270 IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\""); 270 IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\"");
271 output.addParam(channel); 271 output.addParam(channel);
272 emit outputReady(output); 272 emit outputReady(output);
273 } else { 273 } else {
274 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?"))); 274 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?")));
275 } 275 }
276} 276}
277 277
278void IRCMessageParser::parseLiteralError(IRCMessage *message) { 278void IRCMessageParser::parseLiteralError(IRCMessage *message) {
279 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters())); 279 emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
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()));
292} 326}
293 327
294void IRCMessageParser::parseCTCPAction(IRCMessage *message) { 328void IRCMessageParser::parseCTCPAction(IRCMessage *message) {
295 IRCPerson mask(message->prefix()); 329 IRCPerson mask(message->prefix());
296 QString dest = message->ctcpDestination(); 330 QString dest = message->ctcpDestination();
297 if (dest.startsWith("#")) { 331 if (dest.startsWith("#")) {
298 IRCChannel *channel = m_session->getChannel(dest.lower()); 332 IRCChannel *channel = m_session->getChannel(dest.lower());
299 if (channel) { 333 if (channel) {
300 IRCChannelPerson *person = channel->getPerson(mask.nick()); 334 IRCChannelPerson *person = channel->getPerson(mask.nick());
301 if (person) { 335 if (person) {
302 IRCOutput output(OUTPUT_CHANACTION, "*" + mask.nick() + message->param(0)); 336 IRCOutput output(OUTPUT_CHANACTION, "*" + mask.nick() + message->param(0));
303 output.addParam(channel); 337 output.addParam(channel);
304 output.addParam(person); 338 output.addParam(person);
305 emit outputReady(output); 339 emit outputReady(output);
306 } else { 340 } else {
307 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP ACTION with unknown person - Desynchronized?"))); 341 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP ACTION with unknown person - Desynchronized?")));
308 } 342 }
309 } else { 343 } else {