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 @@ #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[] = { { "PING", FUNC(parseLiteralPing) }, @@ -460,14 +465,27 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) { } void IRCMessageParser::parseCTCPDCC(IRCMessage *message) { QStringList params = QStringList::split(' ', message->param(0).stripWhiteSpace()); - if( params.count() != 5) { - emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from ") + IRCPerson(message->prefix()).nick())); - return; + + if(params[0] == "SEND") { + QString nickname = IRCPerson(message->prefix()).nick(); + if( params.count() != 5) { + 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; + + 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()); } - - //TransferReceiver *foo = new TransferReceiver(params[2].toUInt(), params[3].toUInt(), params[1], params[4].toUInt()); } void IRCMessageParser::parseLiteralMode(IRCMessage *message) { IRCPerson mask(message->prefix()); |