author | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
commit | 8aaae9e3eca7853e9c693d2401f721d75209acf7 (patch) (unidiff) | |
tree | 6f700d154fac8510b322242496604d0ad7589377 /noncore/net/opieirc/ircmessageparser.cpp | |
parent | 875b3b63624308f4e50f82e17db27edeb9609d6c (diff) | |
download | opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.zip opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.tar.gz opie-8aaae9e3eca7853e9c693d2401f721d75209acf7.tar.bz2 |
Added DCC receive support
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 24 |
1 files changed, 21 insertions, 3 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,13 +1,18 @@ | |||
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) }, |
12 | { "NOTICE", FUNC(parseLiteralNotice) }, | 17 | { "NOTICE", FUNC(parseLiteralNotice) }, |
13 | { "JOIN", FUNC(parseLiteralJoin) }, | 18 | { "JOIN", FUNC(parseLiteralJoin) }, |
@@ -458,18 +463,31 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) { | |||
458 | } | 463 | } |
459 | } | 464 | } |
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()); |
469 | |||
470 | if(params[0] == "SEND") { | ||
471 | QString nickname = IRCPerson(message->prefix()).nick(); | ||
464 | if( params.count() != 5) { | 472 | if( params.count() != 5) { |
465 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from ") + IRCPerson(message->prefix()).nick())); | 473 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from %1").arg(nickname))); |
466 | return; | 474 | return; |
467 | } | 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; | ||
468 | 483 | ||
469 | //TransferReceiver *foo = new TransferReceiver(params[2].toUInt(), params[3].toUInt(), params[1], params[4].toUInt()); | 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()); | ||
487 | } | ||
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()); |
474 | 492 | ||
475 | if (message->param(0).startsWith("#")) { | 493 | if (message->param(0).startsWith("#")) { |