annotate libpurple/ft.c @ 29963:fb2bf8986524

merge of 'bd7b70e38030da580a7bc922236ec504ecb8853b' and 'c1573675765ce94fa58152c4fc2af225ff621d47'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 17 May 2010 08:04:50 +0000
parents ce52e101844a
children 1cdae196aac8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file ft.c File Transfer API
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
3 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
4
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
5 /* purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19567
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19567
b99a158ea85e disapproval of revision 'c672802b647f1230fbd9b0edf383fb3d558cf719'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19566
diff changeset
24 *
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "internal.h"
17811
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
27 #include "dbus-maybe.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "ft.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "network.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "proxy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "util.h"
22073
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
35 #include "debug.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #define FT_INITIAL_BUFFER_SIZE 4096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #define FT_MAX_BUFFER_SIZE 65535
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
40 static PurpleXferUiOps *xfer_ui_ops = NULL;
15640
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
41 static GList *xfers;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
43 /*
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
44 * A hack to store more data since we can't extend the size of PurpleXfer
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
45 * easily.
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
46 */
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
47 static GHashTable *xfers_data = NULL;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
48
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
49 typedef struct _PurpleXferPrivData {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
50 /*
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
51 * Used to moderate the file transfer when either the read/write ui_ops are
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
52 * set or fd is not set. In those cases, the UI/prpl call the respective
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
53 * function, which is somewhat akin to a fd watch being triggered.
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
54 */
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
55 enum {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
56 PURPLE_XFER_READY_NONE = 0x0,
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
57 PURPLE_XFER_READY_UI = 0x1,
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
58 PURPLE_XFER_READY_PRPL = 0x2,
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
59 } ready;
29685
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
60
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
61 /* TODO: Should really use a PurpleCircBuffer for this. */
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
62 GByteArray *buffer;
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
63
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
64 gpointer thumbnail_data; /**< thumbnail image */
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
65 gsize thumbnail_size;
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
66 gchar *thumbnail_mimetype;
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
67 } PurpleXferPrivData;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
68
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
69 static int purple_xfer_choose_file(PurpleXfer *xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
71 static void
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
72 purple_xfer_priv_data_destroy(gpointer data)
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
73 {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
74 PurpleXferPrivData *priv = data;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
75
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
76 if (priv->buffer)
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
77 g_byte_array_free(priv->buffer, TRUE);
29348
422889fb57e0 propagate from branch 'im.pidgin.pidgin' (head 9028ac0daaa1f7e565726fa39aca22ce7d3ecc49)
Paul Aurich <paul@darkrain42.org>
parents: 28911 29347
diff changeset
78
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
79 g_free(priv->thumbnail_data);
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
80
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
81 g_free(priv->thumbnail_mimetype);
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
82
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
83 g_free(priv);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
84 }
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
85
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
86 static const gchar *
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
87 purple_xfer_status_type_to_string(PurpleXferStatusType type)
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
88 {
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
89 static const struct {
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
90 PurpleXferStatusType type;
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
91 const char *name;
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
92 } type_names[] = {
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
93 { PURPLE_XFER_STATUS_UNKNOWN, "unknown" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
94 { PURPLE_XFER_STATUS_NOT_STARTED, "not started" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
95 { PURPLE_XFER_STATUS_ACCEPTED, "accepted" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
96 { PURPLE_XFER_STATUS_STARTED, "started" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
97 { PURPLE_XFER_STATUS_DONE, "done" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
98 { PURPLE_XFER_STATUS_CANCEL_LOCAL, "cancelled locally" },
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
99 { PURPLE_XFER_STATUS_CANCEL_REMOTE, "cancelled remotely" }
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
100 };
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
101 int i;
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
102
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
103 for (i = 0; i < G_N_ELEMENTS(type_names); ++i)
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
104 if (type_names[i].type == type)
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
105 return type_names[i].name;
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
106
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
107 return "invalid state";
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
108 }
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
109
15640
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
110 GList *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
111 purple_xfers_get_all()
15640
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
112 {
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
113 return xfers;
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
114 }
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
115
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
116 PurpleXfer *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
117 purple_xfer_new(PurpleAccount *account, PurpleXferType type, const char *who)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
119 PurpleXfer *xfer;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
120 PurpleXferUiOps *ui_ops;
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
121 PurpleXferPrivData *priv;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
123 g_return_val_if_fail(type != PURPLE_XFER_UNKNOWN, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 g_return_val_if_fail(who != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
127 xfer = g_new0(PurpleXfer, 1);
17811
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
128 PURPLE_DBUS_REGISTER_POINTER(xfer, PurpleXfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 xfer->ref = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 xfer->type = type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 xfer->account = account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 xfer->who = g_strdup(who);
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
134 xfer->ui_ops = ui_ops = purple_xfers_get_ui_ops();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 xfer->message = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 xfer->current_buffer_size = FT_INITIAL_BUFFER_SIZE;
20221
89e5492bcea4 applied changes from 307f0cff97539b1c6ddc0114500677abfe42aaa6
Richard Laager <rlaager@wiktel.com>
parents: 19681
diff changeset
137 xfer->fd = -1;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
139 priv = g_new0(PurpleXferPrivData, 1);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
140 priv->ready = PURPLE_XFER_READY_NONE;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
141
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
142 if (ui_ops && ui_ops->data_not_sent) {
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
143 /* If the ui will handle unsent data no need for buffer */
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
144 priv->buffer = NULL;
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
145 } else {
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
146 priv->buffer = g_byte_array_sized_new(FT_INITIAL_BUFFER_SIZE);
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
147 }
29348
422889fb57e0 propagate from branch 'im.pidgin.pidgin' (head 9028ac0daaa1f7e565726fa39aca22ce7d3ecc49)
Paul Aurich <paul@darkrain42.org>
parents: 28911 29347
diff changeset
148
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
149 g_hash_table_insert(xfers_data, xfer, priv);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
150
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
151 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 if (ui_ops != NULL && ui_ops->new_xfer != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 ui_ops->new_xfer(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
15640
35fa1d1c4ef2 Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15373
diff changeset
156 xfers = g_list_prepend(xfers, xfer);
28821
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
157
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
158 if (purple_debug_is_verbose())
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
159 purple_debug_info("xfer", "new %p [%d]\n", xfer, xfer->ref);
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
160
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 return xfer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
165 purple_xfer_destroy(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
167 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
28821
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
171 if (purple_debug_is_verbose())
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
172 purple_debug_info("xfer", "destroyed %p [%d]\n", xfer, xfer->ref);
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
173
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 /* Close the file browser, if it's open */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
175 purple_request_close_with_handle(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
177 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_STARTED)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
178 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
180 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 if (ui_ops != NULL && ui_ops->destroy != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 ui_ops->destroy(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 g_free(xfer->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 g_free(xfer->filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 g_free(xfer->remote_ip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 g_free(xfer->local_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
190 g_hash_table_remove(xfers_data, xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
191
17811
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
192 PURPLE_DBUS_UNREGISTER_POINTER(xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
193 xfers = g_list_remove(xfers, xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 g_free(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
198 purple_xfer_ref(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 xfer->ref++;
28821
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
203
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
204 if (purple_debug_is_verbose())
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
205 purple_debug_info("xfer", "ref'd %p [%d]\n", xfer, xfer->ref);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
209 purple_xfer_unref(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 g_return_if_fail(xfer->ref > 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 xfer->ref--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
28821
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
216 if (purple_debug_is_verbose())
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
217 purple_debug_info("xfer", "unref'd %p [%d]\n", xfer, xfer->ref);
edea24b65db9 Add some verbose ref-count debugging for PurpleXfer's.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28820
diff changeset
218
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 if (xfer->ref == 0)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
220 purple_xfer_destroy(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
224 purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
228 if (purple_debug_is_verbose())
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
229 purple_debug_info("xfer", "Changing status of xfer %p from %s to %s\n",
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
230 xfer, purple_xfer_status_type_to_string(xfer->status),
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
231 purple_xfer_status_type_to_string(status));
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
232
27725
36d5e7690ad6 ft: Don't emit a changed-status signal for something that isn't a change.
Paul Aurich <paul@darkrain42.org>
parents: 27679
diff changeset
233 if (xfer->status == status)
36d5e7690ad6 ft: Don't emit a changed-status signal for something that isn't a change.
Paul Aurich <paul@darkrain42.org>
parents: 27679
diff changeset
234 return;
36d5e7690ad6 ft: Don't emit a changed-status signal for something that isn't a change.
Paul Aurich <paul@darkrain42.org>
parents: 27679
diff changeset
235
27677
fd4415c0595f Set xfer->status before emitting signals in purple_xfer_set_status.
Paul Aurich <paul@darkrain42.org>
parents: 27396
diff changeset
236 xfer->status = status;
fd4415c0595f Set xfer->status before emitting signals in purple_xfer_set_status.
Paul Aurich <paul@darkrain42.org>
parents: 27396
diff changeset
237
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
238 if(xfer->type == PURPLE_XFER_SEND) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 switch(status) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
240 case PURPLE_XFER_STATUS_ACCEPTED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
241 purple_signal_emit(purple_xfers_get_handle(), "file-send-accept", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
243 case PURPLE_XFER_STATUS_STARTED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
244 purple_signal_emit(purple_xfers_get_handle(), "file-send-start", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
246 case PURPLE_XFER_STATUS_DONE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
247 purple_signal_emit(purple_xfers_get_handle(), "file-send-complete", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
249 case PURPLE_XFER_STATUS_CANCEL_LOCAL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
250 case PURPLE_XFER_STATUS_CANCEL_REMOTE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
251 purple_signal_emit(purple_xfers_get_handle(), "file-send-cancel", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
256 } else if(xfer->type == PURPLE_XFER_RECEIVE) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 switch(status) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
258 case PURPLE_XFER_STATUS_ACCEPTED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
259 purple_signal_emit(purple_xfers_get_handle(), "file-recv-accept", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
261 case PURPLE_XFER_STATUS_STARTED:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
262 purple_signal_emit(purple_xfers_get_handle(), "file-recv-start", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
264 case PURPLE_XFER_STATUS_DONE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
265 purple_signal_emit(purple_xfers_get_handle(), "file-recv-complete", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
267 case PURPLE_XFER_STATUS_CANCEL_LOCAL:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
268 case PURPLE_XFER_STATUS_CANCEL_REMOTE:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
269 purple_signal_emit(purple_xfers_get_handle(), "file-recv-cancel", xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
277 static void
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
278 purple_xfer_conversation_write_internal(PurpleXfer *xfer,
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
279 const char *message, gboolean is_error, gboolean print_thumbnail)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
281 PurpleConversation *conv = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
282 PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 char *escaped;
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
284 gconstpointer thumbnail_data;
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
285 gsize size;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 g_return_if_fail(message != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
290 thumbnail_data = purple_xfer_get_thumbnail(xfer, &size);
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
291
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
292 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
293 purple_xfer_get_account(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 if (conv == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 escaped = g_markup_escape_text(message, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 if (is_error)
28675
52dc24a5069f ft: Properly set a bitmask field (so it includes PURPLE_MESSAGE_SYSTEM like
Florian Quèze <florian@instantbird.org>
parents: 28359
diff changeset
301 flags |= PURPLE_MESSAGE_ERROR;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
303 if (print_thumbnail && thumbnail_data) {
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
304 gchar *message_with_img;
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
305 gpointer data = g_memdup(thumbnail_data, size);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
306 int id = purple_imgstore_add_with_id(data, size, NULL);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
307
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
308 message_with_img =
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
309 g_strdup_printf("<img id='%d'> %s", id, escaped);
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
310 purple_conversation_write(conv, NULL, message_with_img, flags,
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
311 time(NULL));
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
312 purple_imgstore_unref_by_id(id);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
313 g_free(message_with_img);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
314 } else {
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
315 purple_conversation_write(conv, NULL, escaped, flags, time(NULL));
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
316 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
320 void
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
321 purple_xfer_conversation_write(PurpleXfer *xfer, gchar *message,
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
322 gboolean is_error)
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
323 {
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
324 purple_xfer_conversation_write_internal(xfer, message, is_error, FALSE);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
325 }
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
326
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
327 /* maybe this one should be exported publically? */
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
328 static void
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
329 purple_xfer_conversation_write_with_thumbnail(PurpleXfer *xfer,
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
330 const gchar *message)
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
331 {
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
332 purple_xfer_conversation_write_internal(xfer, message, FALSE, TRUE);
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
333 }
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
334
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
335
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
336 static void purple_xfer_show_file_error(PurpleXfer *xfer, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 int err = errno;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 gchar *msg = NULL, *utf8;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
340 PurpleXferType xfer_type = purple_xfer_get_type(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
341 PurpleAccount *account = purple_xfer_get_account(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 switch(xfer_type) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
345 case PURPLE_XFER_SEND:
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 msg = g_strdup_printf(_("Error reading %s: \n%s.\n"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 20251
diff changeset
347 utf8, g_strerror(err));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 break;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
349 case PURPLE_XFER_RECEIVE:
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 msg = g_strdup_printf(_("Error writing %s: \n%s.\n"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 20251
diff changeset
351 utf8, g_strerror(err));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 msg = g_strdup_printf(_("Error accessing %s: \n%s.\n"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 20251
diff changeset
355 utf8, g_strerror(err));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 g_free(utf8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
360 purple_xfer_conversation_write(xfer, msg, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
361 purple_xfer_error(xfer_type, account, xfer->who, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
366 purple_xfer_choose_file_ok_cb(void *user_data, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
368 PurpleXfer *xfer;
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
369 PurpleXferType type;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 struct stat st;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 gchar *dir;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
373 xfer = (PurpleXfer *)user_data;
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
374 type = purple_xfer_get_type(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 if (g_stat(filename, &st) != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 /* File not found. */
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
378 if (type == PURPLE_XFER_RECEIVE) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 int mode = W_OK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 int mode = F_OK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 dir = g_path_get_dirname(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 if (g_access(dir, mode) == 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
387 purple_xfer_request_accepted(xfer, filename);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
389 purple_xfer_ref(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
390 purple_notify_message(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
391 NULL, PURPLE_NOTIFY_MSG_ERROR, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 _("Directory is not writable."), NULL,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
393 (PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 g_free(dir);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
399 purple_xfer_show_file_error(xfer, filename);
28823
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
400 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 }
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
403 else if ((type == PURPLE_XFER_SEND) && (st.st_size == 0)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
405 purple_notify_error(NULL, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 _("Cannot send a file of 0 bytes."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
28823
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
408 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 }
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
410 else if ((type == PURPLE_XFER_SEND) && S_ISDIR(st.st_mode)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 * XXX - Sending a directory should be valid for some protocols.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
414 purple_notify_error(NULL, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 _("Cannot send a directory."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
28823
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
417 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 }
28819
811c12e6d965 There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28675
diff changeset
419 else if ((type == PURPLE_XFER_RECEIVE) && S_ISDIR(st.st_mode)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 char *msg, *utf8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 msg = g_strdup_printf(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 _("%s is not a regular file. Cowardly refusing to overwrite it.\n"), utf8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 g_free(utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
425 purple_notify_error(NULL, NULL, msg, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 g_free(msg);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
427 purple_xfer_request_denied(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 }
28820
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
429 else if (type == PURPLE_XFER_SEND) {
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
430 #ifndef _WIN32
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
431 int mode = R_OK;
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
432 #else
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
433 int mode = F_OK;
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
434 #endif
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
435
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
436 if (g_access(filename, mode) == 0) {
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
437 purple_xfer_request_accepted(xfer, filename);
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
438 } else {
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
439 purple_xfer_ref(xfer);
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
440 purple_notify_message(
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
441 NULL, PURPLE_NOTIFY_MSG_ERROR, NULL,
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
442 _("File is not readable."), NULL,
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
443 (PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer);
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
444 }
32f356585aed Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28819
diff changeset
445 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
447 purple_xfer_request_accepted(xfer, filename);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
450 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
454 purple_xfer_choose_file_cancel_cb(void *user_data, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
456 PurpleXfer *xfer = (PurpleXfer *)user_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
458 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
28823
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
459 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
460 purple_xfer_cancel_local(xfer);
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
461 else
16dfa8df7dd1 Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28822
diff changeset
462 purple_xfer_request_denied(xfer);
28822
df5808d7e669 The PurpleXfer should be unref'd if the file selection dialog was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28821
diff changeset
463 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 static int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
467 purple_xfer_choose_file(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
469 purple_request_file(xfer, NULL, purple_xfer_get_filename(xfer),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
470 (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
471 G_CALLBACK(purple_xfer_choose_file_ok_cb),
16439
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
472 G_CALLBACK(purple_xfer_choose_file_cancel_cb),
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
473 purple_xfer_get_account(xfer), xfer->who, NULL,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
474 xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 static int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
480 cancel_recv_cb(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
482 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
483 purple_xfer_request_denied(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
484 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
490 purple_xfer_ask_recv(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 char *buf, *size_buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 size_t size;
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
494 gconstpointer thumb;
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
495 gsize thumb_size;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 /* If we have already accepted the request, ask the destination file
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 name directly */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
499 if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
500 PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
502 if (purple_xfer_get_filename(xfer) != NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
504 size = purple_xfer_get_size(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
505 size_buf = purple_str_size_to_units(size);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 buf = g_strdup_printf(_("%s wants to send you %s (%s)"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
507 buddy ? purple_buddy_get_alias(buddy) : xfer->who,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
508 purple_xfer_get_filename(xfer), size_buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 g_free(size_buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 buf = g_strdup_printf(_("%s wants to send you a file"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
514 buddy ? purple_buddy_get_alias(buddy) : xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 if (xfer->message != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
518 serv_got_im(purple_account_get_connection(xfer->account),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 xfer->who, xfer->message, 0, time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
521 if ((thumb = purple_xfer_get_thumbnail(xfer, &thumb_size))) {
29790
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
522 purple_request_accept_cancel_with_icon(xfer, NULL, buf, NULL,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
523 PURPLE_DEFAULT_ACTION_NONE, xfer->account, xfer->who, NULL,
29871
ce52e101844a Scale incoming thumbnails in the request dialog if they are overly large
Marcus Lundblad <ml@update.uu.se>
parents: 29835
diff changeset
524 thumb, thumb_size, xfer,
29790
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
525 G_CALLBACK(purple_xfer_choose_file),
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
526 G_CALLBACK(cancel_recv_cb));
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
527 } else {
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
528 purple_request_accept_cancel(xfer, NULL, buf, NULL,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
529 PURPLE_DEFAULT_ACTION_NONE, xfer->account, xfer->who, NULL,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
530 xfer, G_CALLBACK(purple_xfer_choose_file),
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
531 G_CALLBACK(cancel_recv_cb));
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
532 }
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 29782
diff changeset
533
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 } else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
536 purple_xfer_choose_file(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 static int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
540 ask_accept_ok(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
542 purple_xfer_request_accepted(xfer, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 static int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
548 ask_accept_cancel(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
550 purple_xfer_request_denied(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
551 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
557 purple_xfer_ask_accept(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 char *buf, *buf2 = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
560 PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 buf = g_strdup_printf(_("Accept file transfer request from %s?"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
563 buddy ? purple_buddy_get_alias(buddy) : xfer->who);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
564 if (purple_xfer_get_remote_ip(xfer) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
565 purple_xfer_get_remote_port(xfer))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 buf2 = g_strdup_printf(_("A file is available for download from:\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 "Remote host: %s\nRemote port: %d"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
568 purple_xfer_get_remote_ip(xfer),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
569 purple_xfer_get_remote_port(xfer));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
570 purple_request_accept_cancel(xfer, NULL, buf, buf2,
16439
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
571 PURPLE_DEFAULT_ACTION_NONE,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
572 xfer->account, xfer->who, NULL,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15822
diff changeset
573 xfer,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 G_CALLBACK(ask_accept_ok),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 G_CALLBACK(ask_accept_cancel));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 g_free(buf2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
581 purple_xfer_request(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 g_return_if_fail(xfer->ops.init != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
586 purple_xfer_ref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
588 if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
590 purple_signal_emit(purple_xfers_get_handle(), "file-recv-request", xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
591 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 /* The file-transfer was cancelled by a plugin */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
594 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
596 else if (purple_xfer_get_filename(xfer) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
597 purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_ACCEPTED)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 gchar* message = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
600 PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who);
29804
cb09d358d777 Make it work again, after some new xfer UI ops where added... :)
Marcus Lundblad <ml@update.uu.se>
parents: 29801
diff changeset
601
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 message = g_strdup_printf(_("%s is offering to send file %s"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
603 buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer));
29806
56b67321b7c6 Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <ml@update.uu.se>
parents: 29804
diff changeset
604 purple_xfer_conversation_write_with_thumbnail(xfer, message);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 g_free(message);
29804
cb09d358d777 Make it work again, after some new xfer UI ops where added... :)
Marcus Lundblad <ml@update.uu.se>
parents: 29801
diff changeset
606
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 /* Ask for a filename to save to if it's not already given by a plugin */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 if (xfer->local_filename == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
609 purple_xfer_ask_recv(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
613 purple_xfer_ask_accept(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
618 purple_xfer_choose_file(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
623 purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
625 PurpleXferType type;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 struct stat st;
26505
0c796a1950b7 Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26167
diff changeset
627 char *msg, *utf8, *base;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
628 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
629 PurpleBuddy *buddy;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 if (xfer == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
634 type = purple_xfer_get_type(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
635 account = purple_xfer_get_account(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636
29537
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
637 purple_debug_misc("xfer", "request accepted for %p\n", xfer);
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
638
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
639 if (!filename && type == PURPLE_XFER_RECEIVE) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
640 xfer->status = PURPLE_XFER_STATUS_ACCEPTED;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 xfer->ops.init(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
645 buddy = purple_find_buddy(account, xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
647 if (type == PURPLE_XFER_SEND) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 /* Sending a file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 /* Check the filename. */
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
650 PurpleXferUiOps *ui_ops;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
651 ui_ops = purple_xfer_get_ui_ops(xfer);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
652
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 #ifdef _WIN32
21866
03c950701fac Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents: 21597
diff changeset
654 if (g_strrstr(filename, "../") || g_strrstr(filename, "..\\"))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 #else
21866
03c950701fac Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents: 21597
diff changeset
656 if (g_strrstr(filename, "../"))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 #endif
21866
03c950701fac Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents: 21597
diff changeset
658 {
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
659 utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 msg = g_strdup_printf(_("%s is not a valid filename.\n"), utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
662 purple_xfer_error(type, account, xfer->who, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 g_free(utf8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
666 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669
27881
dad4cb8f81df Fix building on win32, which has #define write wpurple_write (and similar for read).
Paul Aurich <paul@darkrain42.org>
parents: 27878
diff changeset
670 if (ui_ops == NULL || (ui_ops->ui_read == NULL && ui_ops->ui_write == NULL)) {
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
671 if (g_stat(filename, &st) == -1) {
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
672 purple_xfer_show_file_error(xfer, filename);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
673 purple_xfer_unref(xfer);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
674 return;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
675 }
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
676
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
677 purple_xfer_set_local_filename(xfer, filename);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
678 purple_xfer_set_size(xfer, st.st_size);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
679 } else {
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
680 utf8 = g_strdup(filename);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
681 purple_xfer_set_local_filename(xfer, filename);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683
26505
0c796a1950b7 Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26167
diff changeset
684 base = g_path_get_basename(filename);
0c796a1950b7 Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26167
diff changeset
685 utf8 = g_filename_to_utf8(base, -1, NULL, NULL, NULL);
0c796a1950b7 Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26167
diff changeset
686 g_free(base);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
687 purple_xfer_set_filename(xfer, utf8);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 msg = g_strdup_printf(_("Offering to send %s to %s"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
690 utf8, buddy ? purple_buddy_get_alias(buddy) : xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 g_free(utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
692 purple_xfer_conversation_write(xfer, msg, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 /* Receiving a file */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
697 xfer->status = PURPLE_XFER_STATUS_ACCEPTED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
698 purple_xfer_set_local_filename(xfer, filename);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 msg = g_strdup_printf(_("Starting transfer of %s from %s"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
701 xfer->filename, buddy ? purple_buddy_get_alias(buddy) : xfer->who);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
702 purple_xfer_conversation_write(xfer, msg, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
706 purple_xfer_add(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 xfer->ops.init(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
712 purple_xfer_request_denied(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
716 purple_debug_misc("xfer", "xfer %p denied\n", xfer);
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
717
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 if (xfer->ops.request_denied != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 xfer->ops.request_denied(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
721 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
724 PurpleXferType
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
725 purple_xfer_get_type(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
727 g_return_val_if_fail(xfer != NULL, PURPLE_XFER_UNKNOWN);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 return xfer->type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
732 PurpleAccount *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
733 purple_xfer_get_account(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 g_return_val_if_fail(xfer != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 return xfer->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739
17811
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
740 const char *
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
741 purple_xfer_get_remote_user(const PurpleXfer *xfer)
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
742 {
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
743 g_return_val_if_fail(xfer != NULL, NULL);
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
744 return xfer->who;
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
745 }
e62095e99db0 Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17201
diff changeset
746
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
747 PurpleXferStatusType
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
748 purple_xfer_get_status(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
750 g_return_val_if_fail(xfer != NULL, PURPLE_XFER_STATUS_UNKNOWN);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 return xfer->status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 gboolean
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
756 purple_xfer_is_canceled(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 g_return_val_if_fail(xfer != NULL, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
760 if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
761 (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 gboolean
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
768 purple_xfer_is_completed(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 g_return_val_if_fail(xfer != NULL, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
772 return (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_DONE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 const char *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
776 purple_xfer_get_filename(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 g_return_val_if_fail(xfer != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 return xfer->filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 const char *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
784 purple_xfer_get_local_filename(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 g_return_val_if_fail(xfer != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 return xfer->local_filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 size_t
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
792 purple_xfer_get_bytes_sent(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 g_return_val_if_fail(xfer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 return xfer->bytes_sent;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 size_t
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
800 purple_xfer_get_bytes_remaining(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 g_return_val_if_fail(xfer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 return xfer->bytes_remaining;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 size_t
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
808 purple_xfer_get_size(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 g_return_val_if_fail(xfer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 return xfer->size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 double
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
816 purple_xfer_get_progress(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 g_return_val_if_fail(xfer != NULL, 0.0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
820 if (purple_xfer_get_size(xfer) == 0)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821 return 0.0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
823 return ((double)purple_xfer_get_bytes_sent(xfer) /
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
824 (double)purple_xfer_get_size(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 unsigned int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
828 purple_xfer_get_local_port(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 g_return_val_if_fail(xfer != NULL, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 return xfer->local_port;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 const char *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
836 purple_xfer_get_remote_ip(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 g_return_val_if_fail(xfer != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 return xfer->remote_ip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 unsigned int
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
844 purple_xfer_get_remote_port(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 g_return_val_if_fail(xfer != NULL, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 return xfer->remote_port;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850
22216
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
851 time_t
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
852 purple_xfer_get_start_time(const PurpleXfer *xfer)
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
853 {
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
854 g_return_val_if_fail(xfer != NULL, 0);
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
855
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
856 return xfer->start_time;
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
857 }
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
858
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
859 time_t
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
860 purple_xfer_get_end_time(const PurpleXfer *xfer)
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
861 {
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
862 g_return_val_if_fail(xfer != NULL, 0);
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
863
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
864 return xfer->end_time;
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
865 }
b99d6d21cd79 Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22073
diff changeset
866
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
868 purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
870 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 if (completed == TRUE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 char *msg = NULL;
27396
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
876 PurpleConversation *conv;
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
877
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
878 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_DONE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
880 if (purple_xfer_get_filename(xfer) != NULL)
27396
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
881 {
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
882 char *filename = g_markup_escape_text(purple_xfer_get_filename(xfer), -1);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
883 if (purple_xfer_get_local_filename(xfer)
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
884 && purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE)
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
885 {
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
886 char *local = g_markup_escape_text(purple_xfer_get_local_filename(xfer), -1);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
887 msg = g_strdup_printf(_("Transfer of file <A HREF=\"file://%s\">%s</A> complete"),
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
888 local, filename);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
889 g_free(local);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
890 }
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
891 else
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
892 msg = g_strdup_printf(_("Transfer of file %s complete"),
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
893 filename);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
894 g_free(filename);
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
895 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 else
24915
568b786c36f9 The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24451
diff changeset
897 msg = g_strdup(_("File transfer complete"));
27396
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
898
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
899 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who,
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
900 purple_xfer_get_account(xfer));
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
901
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
902 if (conv != NULL)
740760605cc1 Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26505
diff changeset
903 purple_conversation_write(conv, NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
907 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 if (ui_ops != NULL && ui_ops->update_progress != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
910 ui_ops->update_progress(xfer, purple_xfer_get_progress(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
914 purple_xfer_set_message(PurpleXfer *xfer, const char *message)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 g_free(xfer->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 xfer->message = g_strdup(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
923 purple_xfer_set_filename(PurpleXfer *xfer, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 g_free(xfer->filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 xfer->filename = g_strdup(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
932 purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 g_free(xfer->local_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 xfer->local_filename = g_strdup(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
941 purple_xfer_set_size(PurpleXfer *xfer, size_t size)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 xfer->size = size;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
946 xfer->bytes_remaining = xfer->size - purple_xfer_get_bytes_sent(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
950 purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 xfer->bytes_sent = bytes_sent;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
955 xfer->bytes_remaining = purple_xfer_get_size(xfer) - bytes_sent;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
958 PurpleXferUiOps *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
959 purple_xfer_get_ui_ops(const PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 g_return_val_if_fail(xfer != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 return xfer->ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
967 purple_xfer_set_init_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 xfer->ops.init = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
974 void purple_xfer_set_request_denied_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 xfer->ops.request_denied = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
982 purple_xfer_set_read_fnc(PurpleXfer *xfer, gssize (*fnc)(guchar **, PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 xfer->ops.read = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
990 purple_xfer_set_write_fnc(PurpleXfer *xfer,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
991 gssize (*fnc)(const guchar *, size_t, PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 xfer->ops.write = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
999 purple_xfer_set_ack_fnc(PurpleXfer *xfer,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1000 void (*fnc)(PurpleXfer *, const guchar *, size_t))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 xfer->ops.ack = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1008 purple_xfer_set_start_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 xfer->ops.start = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1016 purple_xfer_set_end_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 xfer->ops.end = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1024 purple_xfer_set_cancel_send_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 xfer->ops.cancel_send = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1032 purple_xfer_set_cancel_recv_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 xfer->ops.cancel_recv = fnc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1040 purple_xfer_increase_buffer_size(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042 xfer->current_buffer_size = MIN(xfer->current_buffer_size * 1.5,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 FT_MAX_BUFFER_SIZE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 gssize
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1047 purple_xfer_read(PurpleXfer *xfer, guchar **buffer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 gssize s, r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 g_return_val_if_fail(xfer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 g_return_val_if_fail(buffer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1054 if (purple_xfer_get_size(xfer) == 0)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 s = xfer->current_buffer_size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1057 s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058
26167
4cbe258db067 fix a bug in libpurple that prevented receiving file transfers to be marked completed (in case the protocol uses an xfer->ops.read function)
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 24915
diff changeset
1059 if (xfer->ops.read != NULL) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 r = (xfer->ops.read)(buffer, xfer);
26167
4cbe258db067 fix a bug in libpurple that prevented receiving file transfers to be marked completed (in case the protocol uses an xfer->ops.read function)
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 24915
diff changeset
1061 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 *buffer = g_malloc0(s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 r = read(xfer->fd, *buffer, s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066 if (r < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 r = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 else if (r < 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 r = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 else if (r == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 r = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 if (r == xfer->current_buffer_size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 * We managed to read the entire buffer. This means our this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 * network is fast and our buffer is too small, so make it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 * bigger.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1080 purple_xfer_increase_buffer_size(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 gssize
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1086 purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088 gssize r, s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 g_return_val_if_fail(xfer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 g_return_val_if_fail(buffer != NULL, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 g_return_val_if_fail(size != 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1094 s = MIN(purple_xfer_get_bytes_remaining(xfer), size);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096 if (xfer->ops.write != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 r = (xfer->ops.write)(buffer, s, xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 r = write(xfer->fd, buffer, s);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 if (r < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 r = 0;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1102 if ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1103 purple_xfer_set_completed(xfer, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 return r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109 static void
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1110 do_transfer(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1112 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 guchar *buffer = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114 gssize r = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1116 ui_ops = purple_xfer_get_ui_ops(xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1117
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1118 if (xfer->type == PURPLE_XFER_RECEIVE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1119 r = purple_xfer_read(xfer, &buffer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 if (r > 0) {
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1121 size_t wc;
27881
dad4cb8f81df Fix building on win32, which has #define write wpurple_write (and similar for read).
Paul Aurich <paul@darkrain42.org>
parents: 27878
diff changeset
1122 if (ui_ops && ui_ops->ui_write)
dad4cb8f81df Fix building on win32, which has #define write wpurple_write (and similar for read).
Paul Aurich <paul@darkrain42.org>
parents: 27878
diff changeset
1123 wc = ui_ops->ui_write(xfer, buffer, r);
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1124 else
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1125 wc = fwrite(buffer, 1, r, xfer->dest_fp);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1126
22073
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
1127 if (wc != r) {
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
1128 purple_debug_error("filetransfer", "Unable to write whole buffer.\n");
27679
ed3184cc557d ft: fwrite failing is a local error. Pointed out by kenshin.
Paul Aurich <paul@darkrain42.org>
parents: 27677
diff changeset
1129 purple_xfer_cancel_local(xfer);
27799
da33da2e1a1e Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents: 27725
diff changeset
1130 g_free(buffer);
22073
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
1131 return;
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
1132 }
27902
e30de9ebfa69 ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents: 27881
diff changeset
1133
e30de9ebfa69 ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents: 27881
diff changeset
1134 if ((purple_xfer_get_size(xfer) > 0) &&
e30de9ebfa69 ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents: 27881
diff changeset
1135 ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)))
e30de9ebfa69 ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents: 27881
diff changeset
1136 purple_xfer_set_completed(xfer, TRUE);
17201
9235189117c0 Fix file transfers aborting and mistakenly being marked as cancelled when they are actually complete. Fixes #814
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17054
diff changeset
1137 } else if(r < 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1138 purple_xfer_cancel_remote(xfer);
27799
da33da2e1a1e Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents: 27725
diff changeset
1139 g_free(buffer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 }
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1142 } else if (xfer->type == PURPLE_XFER_SEND) {
29497
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1143 size_t result = 0;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1144 size_t s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size);
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1145 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
29536
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1146 gboolean read = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 /* this is so the prpl can keep the connection open
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 if it needs to for some odd reason. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 if (s == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 if (xfer->watcher) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1152 purple_input_remove(xfer->watcher);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 xfer->watcher = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157
29536
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1158 if (priv->buffer) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1159 if (priv->buffer->len < s) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1160 s -= priv->buffer->len;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1161 read = TRUE;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1162 } else {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1163 read = FALSE;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1164 }
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1165 }
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1166
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1167 if (read) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1168 if (ui_ops && ui_ops->ui_read) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1169 gssize tmp = ui_ops->ui_read(xfer, &buffer, s);
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1170 if (tmp == 0) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1171 /*
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1172 * The UI claimed it was ready, but didn't have any data for
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1173 * us... It will call purple_xfer_ui_ready when ready, which
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1174 * sets back up this watcher.
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1175 */
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1176 if (xfer->watcher != 0) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1177 purple_input_remove(xfer->watcher);
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1178 xfer->watcher = 0;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1179 }
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1180
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1181 /* Need to indicate the prpl is still ready... */
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1182 priv->ready |= PURPLE_XFER_READY_PRPL;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1183
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1184 g_return_if_reached();
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1185 } else if (tmp < 0) {
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1186 purple_debug_error("filetransfer", "Unable to read whole buffer.\n");
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1187 purple_xfer_cancel_local(xfer);
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1188 return;
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1189 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190
29536
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1191 result = tmp;
75780bc426d0 ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents: 29535
diff changeset
1192 } else {
29497
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1193 buffer = g_malloc(s);
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1194 result = fread(buffer, 1, s, xfer->dest_fp);
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1195 if (result != s) {
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1196 purple_debug_error("filetransfer", "Unable to read whole buffer.\n");
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1197 purple_xfer_cancel_local(xfer);
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1198 g_free(buffer);
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1199 return;
1326fd4dfdc9 ft: Don't try to read from the source file if the byte array already holds
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29348
diff changeset
1200 }
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1201 }
22073
f90462eb434b Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents: 21866
diff changeset
1202 }
29537
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
1203
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1204 if (priv->buffer) {
29685
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1205 g_byte_array_append(priv->buffer, buffer, result);
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1206 g_free(buffer);
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1207 buffer = priv->buffer->data;
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1208 result = priv->buffer->len;
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1209 }
29537
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
1210
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1211 r = purple_xfer_write(xfer, buffer, result);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 if (r == -1) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1214 purple_xfer_cancel_remote(xfer);
29685
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1215 if (!priv->buffer)
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1216 /* We don't free buffer if priv->buffer is set, because in
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1217 that case buffer doesn't belong to us. */
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1218 g_free(buffer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 return;
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1220 } else if (r == result) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 * We managed to write the entire buffer. This means our
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 * network is fast and our buffer is too small, so make it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 * bigger.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1226 purple_xfer_increase_buffer_size(xfer);
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1227 } else {
29537
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
1228 if (ui_ops && ui_ops->data_not_sent)
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
1229 ui_ops->data_not_sent(xfer, buffer + r, result - r);
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1230 }
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1231
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1232 if (priv->buffer) {
29537
1b861e13ae45 whitespace trimming
Paul Aurich <paul@darkrain42.org>
parents: 29536
diff changeset
1233 /*
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1234 * Remove what we wrote
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1235 * If we wrote the whole buffer the byte array will be empty
29685
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1236 * Otherwise we'll keep what wasn't sent for next time.
29124
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1237 */
51c5cbc0d325 Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents: 28359
diff changeset
1238 buffer = NULL;
29685
6797736dbe37 Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <mark@kingant.net>
parents: 29537
diff changeset
1239 g_byte_array_remove_range(priv->buffer, 0, r);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 if (r > 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1244 if (purple_xfer_get_size(xfer) > 0)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 xfer->bytes_remaining -= r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247 xfer->bytes_sent += r;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 if (xfer->ops.ack != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 xfer->ops.ack(xfer, buffer, r);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 g_free(buffer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 if (ui_ops != NULL && ui_ops->update_progress != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 ui_ops->update_progress(xfer,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1256 purple_xfer_get_progress(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1259 if (purple_xfer_is_completed(xfer))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1260 purple_xfer_end(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1263 static void
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1264 transfer_cb(gpointer data, gint source, PurpleInputCondition condition)
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1265 {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1266 PurpleXfer *xfer = data;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1267
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1268 if (xfer->dest_fp == NULL) {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1269 /* The UI is moderating its side manually */
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1270 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1271 if (0 == (priv->ready & PURPLE_XFER_READY_UI)) {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1272 priv->ready |= PURPLE_XFER_READY_PRPL;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1273
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1274 purple_input_remove(xfer->watcher);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1275 xfer->watcher = 0;
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1276
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1277 purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1278 return;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1279 }
28911
a41724547756 ft: Fix ui_ops->ui_read being called too often (when it's not ready).
Paul Aurich <paul@darkrain42.org>
parents: 28831
diff changeset
1280
a41724547756 ft: Fix ui_ops->ui_read being called too often (when it's not ready).
Paul Aurich <paul@darkrain42.org>
parents: 28831
diff changeset
1281 priv->ready = PURPLE_XFER_READY_NONE;
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1282 }
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1283
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1284 do_transfer(xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1285 }
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1286
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1287 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1288 begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1290 PurpleXferType type = purple_xfer_get_type(xfer);
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1291 PurpleXferUiOps *ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292
27881
dad4cb8f81df Fix building on win32, which has #define write wpurple_write (and similar for read).
Paul Aurich <paul@darkrain42.org>
parents: 27878
diff changeset
1293 if (ui_ops == NULL || (ui_ops->ui_read == NULL && ui_ops->ui_write == NULL)) {
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1294 xfer->dest_fp = g_fopen(purple_xfer_get_local_filename(xfer),
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1295 type == PURPLE_XFER_RECEIVE ? "wb" : "rb");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1297 if (xfer->dest_fp == NULL) {
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1298 purple_xfer_show_file_error(xfer, purple_xfer_get_local_filename(xfer));
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1299 purple_xfer_cancel_local(xfer);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1300 return;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1301 }
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1302
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1303 fseek(xfer->dest_fp, xfer->bytes_sent, SEEK_SET);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305
27874
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1306 if (xfer->fd != -1)
17054
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16439
diff changeset
1307 xfer->watcher = purple_input_add(xfer->fd, cond, transfer_cb, xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309 xfer->start_time = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311 if (xfer->ops.start != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312 xfer->ops.start(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1315 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1316 connect_cb(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1318 PurpleXfer *xfer = (PurpleXfer *)data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319
21587
fd87b254d3f3 Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
1320 if (source < 0) {
fd87b254d3f3 Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
1321 purple_xfer_cancel_local(xfer);
fd87b254d3f3 Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
1322 return;
fd87b254d3f3 Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
1323 }
fd87b254d3f3 Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
1324
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325 xfer->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1327 begin_transfer(xfer, PURPLE_INPUT_READ);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1330 void
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1331 purple_xfer_ui_ready(PurpleXfer *xfer)
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1332 {
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1333 PurpleInputCondition cond;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1334 PurpleXferType type;
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1335 PurpleXferPrivData *priv;
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1336
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1337 g_return_if_fail(xfer != NULL);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1338
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1339 priv = g_hash_table_lookup(xfers_data, xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1340 priv->ready |= PURPLE_XFER_READY_UI;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1341
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1342 if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) {
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1343 purple_debug_misc("xfer", "UI is ready on ft %p, waiting for prpl\n", xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1344 return;
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1345 }
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1346
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1347 purple_debug_misc("xfer", "UI (and prpl) ready on ft %p, so proceeding\n", xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1348
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1349 type = purple_xfer_get_type(xfer);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1350 if (type == PURPLE_XFER_SEND)
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1351 cond = PURPLE_INPUT_WRITE;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1352 else /* if (type == PURPLE_XFER_RECEIVE) */
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1353 cond = PURPLE_INPUT_READ;
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1354
27875
7754717d574c ft: Fix an issue with re-setting xfer->watcher when there is no fd.
Paul Aurich <paul@darkrain42.org>
parents: 27874
diff changeset
1355 if (xfer->watcher == 0 && xfer->fd != -1)
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1356 xfer->watcher = purple_input_add(xfer->fd, cond, transfer_cb, xfer);
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1357
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1358 priv->ready = PURPLE_XFER_READY_NONE;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1359
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1360 do_transfer(xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1361 }
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1362
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1363 void
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1364 purple_xfer_prpl_ready(PurpleXfer *xfer)
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1365 {
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1366 PurpleXferPrivData *priv;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1367
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1368 g_return_if_fail(xfer != NULL);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1369
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1370 priv = g_hash_table_lookup(xfers_data, xfer);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1371 priv->ready |= PURPLE_XFER_READY_PRPL;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1372
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1373 /* I don't think fwrite/fread are ever *not* ready */
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1374 if (xfer->dest_fp == NULL && 0 == (priv->ready & PURPLE_XFER_READY_UI)) {
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1375 purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1376 return;
28831
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1377 }
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1378
07ec4a569da1 ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents: 28823
diff changeset
1379 purple_debug_misc("xfer", "Prpl (and UI) ready on ft %p, so proceeding\n", xfer);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1380
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1381 priv->ready = PURPLE_XFER_READY_NONE;
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1382
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1383 do_transfer(xfer);
27872
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1384 }
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1385
4a4e9d309fc0 ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents: 27799
diff changeset
1386 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1387 purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 unsigned int port)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1390 PurpleInputCondition cond;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1391 PurpleXferType type;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 g_return_if_fail(xfer != NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1394 g_return_if_fail(purple_xfer_get_type(xfer) != PURPLE_XFER_UNKNOWN);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1396 type = purple_xfer_get_type(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1398 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_STARTED);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399
27874
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1400 /*
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1401 * FIXME 3.0.0 -- there's too much broken code depending on fd == 0
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1402 * meaning "don't use a real fd"
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1403 */
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1404 if (fd == 0)
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1405 fd = -1;
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1406
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1407 if (type == PURPLE_XFER_RECEIVE) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1408 cond = PURPLE_INPUT_READ;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 if (ip != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411 xfer->remote_ip = g_strdup(ip);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 xfer->remote_port = port;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 /* Establish a file descriptor. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1415 purple_proxy_connect(NULL, xfer->account, xfer->remote_ip,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 xfer->remote_port, connect_cb, xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 xfer->fd = fd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1425 cond = PURPLE_INPUT_WRITE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 xfer->fd = fd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430 begin_transfer(xfer, cond);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1434 purple_xfer_end(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 /* See if we are actually trying to cancel this. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1439 if (!purple_xfer_is_completed(xfer)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1440 purple_xfer_cancel_local(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 xfer->end_time = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 if (xfer->ops.end != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 xfer->ops.end(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 if (xfer->watcher != 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1449 purple_input_remove(xfer->watcher);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 xfer->watcher = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452
27874
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1453 if (xfer->fd != -1)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 close(xfer->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 if (xfer->dest_fp != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 fclose(xfer->dest_fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 xfer->dest_fp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1461 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1465 purple_xfer_add(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1467 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1471 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 if (ui_ops != NULL && ui_ops->add_xfer != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474 ui_ops->add_xfer(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1478 purple_xfer_cancel_local(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1480 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1485 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 xfer->end_time = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1488 if (purple_xfer_get_filename(xfer) != NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 {
27960
a7eac81575e7 Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents: 27396
diff changeset
1490 msg = g_strdup_printf(_("You cancelled the transfer of %s"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1491 purple_xfer_get_filename(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 {
24915
568b786c36f9 The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24451
diff changeset
1495 msg = g_strdup(_("File transfer cancelled"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1497 purple_xfer_conversation_write(xfer, msg, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1500 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 if (xfer->ops.cancel_send != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 xfer->ops.cancel_send(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 if (xfer->ops.cancel_recv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 xfer->ops.cancel_recv(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 if (xfer->watcher != 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1512 purple_input_remove(xfer->watcher);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 xfer->watcher = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515
27874
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1516 if (xfer->fd != -1)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 close(xfer->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 if (xfer->dest_fp != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 fclose(xfer->dest_fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 xfer->dest_fp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1524 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 if (ui_ops != NULL && ui_ops->cancel_local != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 ui_ops->cancel_local(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 xfer->bytes_remaining = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1531 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1535 purple_xfer_cancel_remote(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1537 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 gchar *msg;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1539 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1540 PurpleBuddy *buddy;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1544 purple_request_close_with_handle(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1545 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 xfer->end_time = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1548 account = purple_xfer_get_account(xfer);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1549 buddy = purple_find_buddy(account, xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1551 if (purple_xfer_get_filename(xfer) != NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 {
27960
a7eac81575e7 Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents: 27396
diff changeset
1553 msg = g_strdup_printf(_("%s cancelled the transfer of %s"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1554 buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 {
27960
a7eac81575e7 Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents: 27396
diff changeset
1558 msg = g_strdup_printf(_("%s cancelled the file transfer"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1559 buddy ? purple_buddy_get_alias(buddy) : xfer->who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1561 purple_xfer_conversation_write(xfer, msg, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1562 purple_xfer_error(purple_xfer_get_type(xfer), account, xfer->who, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1565 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 if (xfer->ops.cancel_send != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 xfer->ops.cancel_send(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 if (xfer->ops.cancel_recv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 xfer->ops.cancel_recv(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 if (xfer->watcher != 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1577 purple_input_remove(xfer->watcher);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 xfer->watcher = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1580
27874
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 27872
diff changeset
1581 if (xfer->fd != -1)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 close(xfer->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 if (xfer->dest_fp != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 fclose(xfer->dest_fp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 xfer->dest_fp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1589 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 if (ui_ops != NULL && ui_ops->cancel_remote != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 ui_ops->cancel_remote(xfer);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 xfer->bytes_remaining = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1596 purple_xfer_unref(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1600 purple_xfer_error(PurpleXferType type, PurpleAccount *account, const char *who, const char *msg)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602 char *title;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 g_return_if_fail(msg != NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1605 g_return_if_fail(type != PURPLE_XFER_UNKNOWN);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607 if (account) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1608 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1609 buddy = purple_find_buddy(account, who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 if (buddy)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1611 who = purple_buddy_get_alias(buddy);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1614 if (type == PURPLE_XFER_SEND)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 title = g_strdup_printf(_("File transfer to %s failed."), who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 title = g_strdup_printf(_("File transfer from %s failed."), who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1619 purple_notify_error(NULL, NULL, title, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1625 purple_xfer_update_progress(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1627 PurpleXferUiOps *ui_ops;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1631 ui_ops = purple_xfer_get_ui_ops(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 if (ui_ops != NULL && ui_ops->update_progress != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1633 ui_ops->update_progress(xfer, purple_xfer_get_progress(xfer));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
1636 gconstpointer
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
1637 purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len)
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1638 {
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1639 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1640
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
1641 if (len)
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
1642 *len = priv->thumbnail_size;
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1643
29835
afc9cec164e4 Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29833
diff changeset
1644 return priv->thumbnail_data;
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1645 }
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1646
29822
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1647 const gchar *
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1648 purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer)
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1649 {
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1650 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1651
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1652 return priv->thumbnail_mimetype;
29822
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1653 }
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1654
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1655 void
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1656 purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail,
29822
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29819
diff changeset
1657 gsize size, const gchar *mimetype)
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1658 {
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1659 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1660
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1661 g_free(priv->thumbnail_data);
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1662 g_free(priv->thumbnail_mimetype);
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1663
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1664 if (thumbnail && size > 0) {
29824
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1665 priv->thumbnail_data = g_memdup(thumbnail, size);
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1666 priv->thumbnail_size = size;
6671b5e92c28 Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents: 29823
diff changeset
1667 priv->thumbnail_mimetype = g_strdup(mimetype);
29833
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1668 } else {
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1669 priv->thumbnail_data = NULL;
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1670 priv->thumbnail_size = 0;
834038426c38 Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29832
diff changeset
1671 priv->thumbnail_mimetype = NULL;
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1672 }
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1673 }
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1674
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1675 void
29823
79bb2804a19e Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <ml@update.uu.se>
parents: 29822
diff changeset
1676 purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats)
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1677 {
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1678 if (xfer->ui_ops->add_thumbnail) {
29823
79bb2804a19e Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <ml@update.uu.se>
parents: 29822
diff changeset
1679 xfer->ui_ops->add_thumbnail(xfer, formats);
29782
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1680 }
3882d419e628 Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents: 26505
diff changeset
1681 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1684 * File Transfer Subsystem API
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1685 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686 void *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1687 purple_xfers_get_handle(void) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 static int handle = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1694 purple_xfers_init(void) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1695 void *handle = purple_xfers_get_handle();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1697 xfers_data = g_hash_table_new_full(g_direct_hash, g_direct_equal,
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1698 NULL, purple_xfer_priv_data_destroy);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1699
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 /* register signals */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1701 purple_signal_register(handle, "file-recv-accept",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1702 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1703 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1704 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1705 purple_signal_register(handle, "file-send-accept",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1706 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1707 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1708 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1709 purple_signal_register(handle, "file-recv-start",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1710 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1711 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1712 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1713 purple_signal_register(handle, "file-send-start",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1714 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1715 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1716 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1717 purple_signal_register(handle, "file-send-cancel",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1718 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1719 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1720 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1721 purple_signal_register(handle, "file-recv-cancel",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1722 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1723 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1724 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1725 purple_signal_register(handle, "file-send-complete",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1726 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1727 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1728 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1729 purple_signal_register(handle, "file-recv-complete",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1730 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1731 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1732 PURPLE_SUBTYPE_XFER));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1733 purple_signal_register(handle, "file-recv-request",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1734 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1735 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1736 PURPLE_SUBTYPE_XFER));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 void
21067
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1740 purple_xfers_uninit(void)
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1741 {
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1742 void *handle = purple_xfers_get_handle();
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1743
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1744 purple_signals_disconnect_by_handle(handle);
96929e7acb86 Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents: 20592
diff changeset
1745 purple_signals_unregister_by_instance(handle);
27878
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1746
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1747 g_hash_table_destroy(xfers_data);
b7b25f580637 ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents: 27875
diff changeset
1748 xfers_data = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1752 purple_xfers_set_ui_ops(PurpleXferUiOps *ops) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 xfer_ui_ops = ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1756 PurpleXferUiOps *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15640
diff changeset
1757 purple_xfers_get_ui_ops(void) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 return xfer_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 }