/* * QuteCom, a voice over Internet phone * Copyright (C) 2010 Mbdsys * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "PurpleReceiveFileSession.h" #include #include #include #include #include PurpleReceiveFileSession::PurpleReceiveFileSession(CoIpManager & coIpManager) : IReceiveFileSessionPlugin(coIpManager) { } PurpleReceiveFileSession::PurpleReceiveFileSession(const PurpleReceiveFileSession & PurpleReceiveFileSession) : IReceiveFileSessionPlugin(PurpleReceiveFileSession) { _fileName = PurpleReceiveFileSession._fileName; _fileSize = PurpleReceiveFileSession._fileSize; } Identifiable * PurpleReceiveFileSession::clone() const { return new PurpleReceiveFileSession(*this); } PurpleReceiveFileSession::~PurpleReceiveFileSession() { _xfer->ui_data = 0; } void PurpleReceiveFileSession::start() { LOG_DEBUG("starting file transfer"); //Only start the file transfer if it's still not marked as cancelled and therefore can be begun. if ((purple_xfer_get_status(_xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL) && (purple_xfer_get_status(_xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE)) { //XXX should do further error checking as done by purple_xfer_choose_file_ok_cb() in purple's ft.c std::string path = _filePath + _fileName; purple_xfer_request_accepted(_xfer, path.c_str()); } } void PurpleReceiveFileSession::pause() { LOG_DEBUG("pausing file transfer"); } void PurpleReceiveFileSession::resume() { LOG_DEBUG("resuming file transfer"); } void PurpleReceiveFileSession::stop() { LOG_DEBUG("stopping file transfer"); purple_xfer_request_denied(_xfer); if ((purple_xfer_get_status(_xfer) == PURPLE_XFER_STATUS_UNKNOWN) || (purple_xfer_get_status(_xfer) == PURPLE_XFER_STATUS_NOT_STARTED) || (purple_xfer_get_status(_xfer) == PURPLE_XFER_STATUS_STARTED) || (purple_xfer_get_status(_xfer) == PURPLE_XFER_STATUS_ACCEPTED)) { purple_xfer_cancel_local(_xfer); } }