This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.
The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.
Testing Done:
Ran locally.
Reviewed at https://reviews.imfreedom.org/r/528/
/* 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"internal.h"
#include"glibcompat.h" /* for purple_g_stat on win32 */
#include<glib/gstdio.h>
#include"debug.h"
#include"enums.h"
#include"glibcompat.h"
#include"image-store.h"
#include"network.h"
#include"notify.h"
#include"prefs.h"
#include"proxy.h"
#include"purple-gio.h"
#include"request.h"
#include"util.h"
#include"xfer.h"
#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