Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index ad9de2b..939cdae 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -1,11 +1,16 @@ | |||
1 | #include <qtextstream.h> | 1 | #include <qtextstream.h> |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | 3 | ||
4 | #include <opie2/ofiledialog.h> | ||
5 | #include <opie2/ofileselector.h> | ||
6 | #include <opie2/odebug.h> | ||
7 | |||
4 | #include "ircmessageparser.h" | 8 | #include "ircmessageparser.h" |
5 | #include "ircversion.h" | 9 | #include "ircversion.h" |
6 | #include "ircchannelperson.h" | 10 | #include "ircchannelperson.h" |
7 | //#include "transferreceiver.h" | 11 | #include "dcctransfertab.h" |
12 | #include "ircservertab.h" | ||
8 | 13 | ||
9 | /* Lookup table for literal commands */ | 14 | /* Lookup table for literal commands */ |
10 | IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { | 15 | IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { |
11 | { "PING", FUNC(parseLiteralPing) }, | 16 | { "PING", FUNC(parseLiteralPing) }, |
@@ -460,14 +465,27 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) { | |||
460 | } | 465 | } |
461 | 466 | ||
462 | void IRCMessageParser::parseCTCPDCC(IRCMessage *message) { | 467 | void IRCMessageParser::parseCTCPDCC(IRCMessage *message) { |
463 | QStringList params = QStringList::split(' ', message->param(0).stripWhiteSpace()); | 468 | QStringList params = QStringList::split(' ', message->param(0).stripWhiteSpace()); |
464 | if( params.count() != 5) { | 469 | |
465 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from ") + IRCPerson(message->prefix()).nick())); | 470 | if(params[0] == "SEND") { |
466 | return; | 471 | QString nickname = IRCPerson(message->prefix()).nick(); |
472 | if( params.count() != 5) { | ||
473 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from %1").arg(nickname))); | ||
474 | return; | ||
475 | } | ||
476 | bool accepted = DCCTransferTab::confirm(static_cast<QWidget*>(m_session->parent()), nickname, params[1], params[4].toUInt()); | ||
477 | if(!accepted) | ||
478 | return; | ||
479 | QString filename = Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED_ALL, | ||
480 | QString::null, params[1], MimeTypes(), 0, tr("Save As")); | ||
481 | if(filename.isEmpty()) | ||
482 | return; | ||
483 | |||
484 | odebug << "Receiving file " << filename << " from " << nickname << oendl; | ||
485 | static_cast<IRCServerTab*>(m_session->parent())->mainwindow()->addDCC(DCCTransfer::Recv, params[2].toUInt(), params[3].toUInt(), | ||
486 | filename, nickname, params[4].toUInt()); | ||
467 | } | 487 | } |
468 | |||
469 | //TransferReceiver *foo = new TransferReceiver(params[2].toUInt(), params[3].toUInt(), params[1], params[4].toUInt()); | ||
470 | } | 488 | } |
471 | 489 | ||
472 | void IRCMessageParser::parseLiteralMode(IRCMessage *message) { | 490 | void IRCMessageParser::parseLiteralMode(IRCMessage *message) { |
473 | IRCPerson mask(message->prefix()); | 491 | IRCPerson mask(message->prefix()); |