This is a pretty simple manager as duplicates are allowed and
PurpleFileTransfer all property driven which means we only need to propagate
the notify signal.
This doesn't persist across restarts as we have some other issues that are
making that harder than it needs to be.
Testing Done:
Ran the unit tests under valgrind.
Bugs closed: PIDGIN-17831
Reviewed at https://reviews.imfreedom.org/r/2874/
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
*/
#include<glib/gi18n-lib.h>
#include"glibcompat.h" /* for purple_g_stat on win32 */
#include<glib/gstdio.h>
#include"debug.h"
#include"eventloop.h"
#include"glibcompat.h"
#include"image-store.h"
#include"network.h"
#include"notify.h"
#include"prefs.h"
#include"proxy.h"
#include"purpleconversationmanager.h"
#include"purpleenums.h"
#include"purplegio.h"
#include"request.h"
#include"server.h"
#include"util.h"
#include"xfer.h"
#ifdef _WIN32
#include"win32/libc_interface.h"
#endif
#define FT_INITIAL_BUFFER_SIZE 4096
#define FT_MAX_BUFFER_SIZE 65535
typedefstruct_PurpleXferPrivatePurpleXferPrivate;
staticPurpleXferUiOps*xfer_ui_ops=NULL;
staticGList*xfers;
/* Private data for a file transfer */
struct_PurpleXferPrivate{
PurpleXferTypetype;/* The type of transfer. */
PurpleAccount*account;/* The account. */
char*who;/* The person on the other end of the
transfer. */
char*message;/* A message sent with the request */
char*filename;/* The name sent over the network. */
char*local_filename;/* The name on the local hard drive. */
goffsetsize;/* The size of the file. */
FILE*dest_fp;/* The destination file pointer. */
char*remote_ip;/* The remote IP address. */
guint16local_port;/* The local port. */
guint16remote_port;/* The remote port. */
GSocketConnection*conn;/* The socket connection. */
intfd;/* The socket file descriptor. */
intwatcher;/* Watcher. */
goffsetbytes_sent;/* The number of bytes sent. */
gint64start_time;/* When the transfer of data began. */
gint64end_time;/* When the transfer of data ended. */
size_tcurrent_buffer_size;/* This gradually increases for fast