author | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-02-03 21:47:50 (UTC) |
commit | 8aaae9e3eca7853e9c693d2401f721d75209acf7 (patch) (side-by-side diff) | |
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,10 +1,15 @@ #include <qtextstream.h> #include <qdatetime.h> +#include <opie2/ofiledialog.h> +#include <opie2/ofileselector.h> +#include <opie2/odebug.h> + #include "ircmessageparser.h" #include "ircversion.h" #include "ircchannelperson.h" -//#include "transferreceiver.h" +#include "dcctransfertab.h" +#include "ircservertab.h" /* Lookup table for literal commands */ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { @@ -461,12 +466,25 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) { void IRCMessageParser::parseCTCPDCC(IRCMessage *message) { QStringList params = QStringList::split(' ', message->param(0).stripWhiteSpace()); + + if(params[0] == "SEND") { + QString nickname = IRCPerson(message->prefix()).nick(); if( params.count() != 5) { - emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from ") + IRCPerson(message->prefix()).nick())); + emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from %1").arg(nickname))); return; } + bool accepted = DCCTransferTab::confirm(static_cast<QWidget*>(m_session->parent()), nickname, params[1], params[4].toUInt()); + if(!accepted) + return; + QString filename = Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED_ALL, + QString::null, params[1], MimeTypes(), 0, tr("Save As")); + if(filename.isEmpty()) + return; - //TransferReceiver *foo = new TransferReceiver(params[2].toUInt(), params[3].toUInt(), params[1], params[4].toUInt()); + odebug << "Receiving file " << filename << " from " << nickname << oendl; + static_cast<IRCServerTab*>(m_session->parent())->mainwindow()->addDCC(DCCTransfer::Recv, params[2].toUInt(), params[3].toUInt(), + filename, nickname, params[4].toUInt()); + } } void IRCMessageParser::parseLiteralMode(IRCMessage *message) { |