This produces a more-native dialog on Windows and macOS, plus it enables
portals in Flatpak so we don't need to request special permission to
access the file system.
/* 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"internal.h"
#include"glibcompat.h"
#include"enums.h"
#include"image-store.h"
#include"xfer.h"
#include"network.h"
#include"notify.h"
#include"prefs.h"
#include"proxy.h"
#include"request.h"
#include"util.h"
#include"debug.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. */
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