Mercurial > pidgin
annotate libpurple/ft.c @ 31479:0eceb1304f53
Add new DNS-related API to perform lookups in the context of an account.
Combined with the new "Tor/Privacy" proxy setting, this allows us to prevent
DNS lookups when the user has selected a proxy that they may want to use to
for privacy.
Refs #11110
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 19 Apr 2011 04:58:17 +0000 |
parents | 45496e1dfe5c |
children | 313fcc5be568 |
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 | 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 | 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 | 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>
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 | 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 | 116 PurpleXfer * |
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 | 119 PurpleXfer *xfer; |
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 | 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 | 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>
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 | 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 | 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 | 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 | 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 | 177 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_STARTED) |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 240 case PURPLE_XFER_STATUS_ACCEPTED: |
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 | 243 case PURPLE_XFER_STATUS_STARTED: |
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 | 246 case PURPLE_XFER_STATUS_DONE: |
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 | 249 case PURPLE_XFER_STATUS_CANCEL_LOCAL: |
250 case PURPLE_XFER_STATUS_CANCEL_REMOTE: | |
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 | 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 | 258 case PURPLE_XFER_STATUS_ACCEPTED: |
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 | 261 case PURPLE_XFER_STATUS_STARTED: |
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 | 264 case PURPLE_XFER_STATUS_DONE: |
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 | 267 case PURPLE_XFER_STATUS_CANCEL_LOCAL: |
268 case PURPLE_XFER_STATUS_CANCEL_REMOTE: | |
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 |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30954
diff
changeset
|
277 static void |
29806
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 | 281 PurpleConversation *conv = NULL; |
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 | 292 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, |
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; |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30954
diff
changeset
|
305 gpointer data = g_memdup(thumbnail_data, size); |
29806
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 |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30954
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); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30954
diff
changeset
|
310 purple_conversation_write(conv, NULL, message_with_img, flags, |
29806
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 | 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 | 340 PurpleXferType xfer_type = purple_xfer_get_type(xfer); |
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 | 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 | 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 | 360 purple_xfer_conversation_write(xfer, msg, TRUE); |
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 | 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 | 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 | 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 | 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 | 389 purple_xfer_ref(xfer); |
390 purple_notify_message( | |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 469 purple_request_file(xfer, NULL, purple_xfer_get_filename(xfer), |
470 (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE), | |
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 | 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 | 482 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
483 purple_xfer_request_denied(xfer); | |
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 | 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 | 499 if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) { |
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 | 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 | 504 size = purple_xfer_get_size(xfer); |
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 | 507 buddy ? purple_buddy_get_alias(buddy) : xfer->who, |
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 | 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 | 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 } |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30954
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 | 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 | 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 | 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 | 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 | 550 purple_xfer_request_denied(xfer); |
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 | 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 | 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 | 563 buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
564 if (purple_xfer_get_remote_ip(xfer) && | |
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 | 568 purple_xfer_get_remote_ip(xfer), |
569 purple_xfer_get_remote_port(xfer)); | |
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 | 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 | 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 | 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 | 590 purple_signal_emit(purple_xfers_get_handle(), "file-recv-request", xfer); |
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 | 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 | 596 else if (purple_xfer_get_filename(xfer) || |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 628 PurpleAccount *account; |
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 | 634 type = purple_xfer_get_type(xfer); |
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 | 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 | 639 if (!filename && type == PURPLE_XFER_RECEIVE) { |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 697 xfer->status = PURPLE_XFER_STATUS_ACCEPTED; |
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 | 701 xfer->filename, buddy ? purple_buddy_get_alias(buddy) : xfer->who); |
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 | 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 | 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 | 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 | 724 PurpleXferType |
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 | 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 | 732 PurpleAccount * |
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 | 747 PurpleXferStatusType |
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 | 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 |
30432
1cdae196aac8
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29871
diff
changeset
|
755 /* FIXME: Rename with cancelled for 3.0.0. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 gboolean |
15822 | 757 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
|
758 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 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
|
760 |
15822 | 761 if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) || |
762 (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
|
763 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 return FALSE; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 gboolean |
15822 | 769 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
|
770 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 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
|
772 |
15822 | 773 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
|
774 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 const char * |
15822 | 777 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
|
778 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 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
|
780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 return xfer->filename; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 const char * |
15822 | 785 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
|
786 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 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
|
788 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 return xfer->local_filename; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 size_t |
15822 | 793 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
|
794 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 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
|
796 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 return xfer->bytes_sent; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 size_t |
15822 | 801 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
|
802 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 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
|
804 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 return xfer->bytes_remaining; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 size_t |
15822 | 809 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
|
810 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 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
|
812 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 return xfer->size; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 double |
15822 | 817 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
|
818 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 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
|
820 |
15822 | 821 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
|
822 return 0.0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 |
15822 | 824 return ((double)purple_xfer_get_bytes_sent(xfer) / |
825 (double)purple_xfer_get_size(xfer)); | |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 unsigned int |
15822 | 829 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
|
830 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 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
|
832 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 return xfer->local_port; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 const char * |
15822 | 837 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
|
838 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 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
|
840 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 return xfer->remote_ip; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 unsigned int |
15822 | 845 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
|
846 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 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
|
848 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 return xfer->remote_port; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
22216
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
852 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
|
853 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
|
854 { |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
855 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
|
856 |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
857 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
|
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 |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
860 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
|
861 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
|
862 { |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
863 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
|
864 |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
865 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
|
866 } |
b99d6d21cd79
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22073
diff
changeset
|
867 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 void |
15822 | 869 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
|
870 { |
15822 | 871 PurpleXferUiOps *ui_ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 if (completed == TRUE) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 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
|
877 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
|
878 |
15822 | 879 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
|
880 |
15822 | 881 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
|
882 { |
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 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
|
884 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
|
885 && 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
|
886 { |
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 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
|
888 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
|
889 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
|
890 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
|
891 } |
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 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
|
893 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
|
894 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 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
|
896 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 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
|
898 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
|
899 |
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 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
|
901 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
|
902 |
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 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
|
904 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
|
905 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 |
15822 | 908 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
|
909 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 if (ui_ops != NULL && ui_ops->update_progress != NULL) |
15822 | 911 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
|
912 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 void |
15822 | 915 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
|
916 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 g_free(xfer->message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 xfer->message = g_strdup(message); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 void |
15822 | 924 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
|
925 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 g_free(xfer->filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 xfer->filename = g_strdup(filename); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 void |
15822 | 933 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
|
934 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 g_free(xfer->local_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 xfer->local_filename = g_strdup(filename); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 void |
15822 | 942 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
|
943 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 xfer->size = size; |
15822 | 947 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
|
948 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 void |
15822 | 951 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
|
952 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 xfer->bytes_sent = bytes_sent; |
15822 | 956 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
|
957 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 |
15822 | 959 PurpleXferUiOps * |
960 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
|
961 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 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
|
963 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 return xfer->ui_ops; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 void |
15822 | 968 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
|
969 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 xfer->ops.init = fnc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 |
15822 | 975 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
|
976 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 xfer->ops.request_denied = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 void |
15822 | 983 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
|
984 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 xfer->ops.read = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 void |
15822 | 991 purple_xfer_set_write_fnc(PurpleXfer *xfer, |
992 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
|
993 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 xfer->ops.write = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 void |
15822 | 1000 purple_xfer_set_ack_fnc(PurpleXfer *xfer, |
1001 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
|
1002 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 xfer->ops.ack = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 void |
15822 | 1009 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
|
1010 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 xfer->ops.start = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 void |
15822 | 1017 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
|
1018 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 xfer->ops.end = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 void |
15822 | 1025 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
|
1026 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 xfer->ops.cancel_send = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 void |
15822 | 1033 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
|
1034 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 xfer->ops.cancel_recv = fnc; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 static void |
15822 | 1041 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
|
1042 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 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
|
1044 FT_MAX_BUFFER_SIZE); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 gssize |
15822 | 1048 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
|
1049 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 gssize s, r; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 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
|
1053 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
|
1054 |
15822 | 1055 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
|
1056 s = xfer->current_buffer_size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 else |
15822 | 1058 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
|
1059 |
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
|
1060 if (xfer->ops.read != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 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
|
1062 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 *buffer = g_malloc0(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 r = read(xfer->fd, *buffer, s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 if (r < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 r = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 else if (r < 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 r = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 else if (r == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 r = -1; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 if (r == xfer->current_buffer_size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 * 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
|
1078 * 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
|
1079 * bigger. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 */ |
15822 | 1081 purple_xfer_increase_buffer_size(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 return r; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 gssize |
15822 | 1087 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
|
1088 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 gssize r, s; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 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
|
1092 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
|
1093 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
|
1094 |
15822 | 1095 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
|
1096 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 if (xfer->ops.write != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 r = (xfer->ops.write)(buffer, s, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 r = write(xfer->fd, buffer, s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 if (r < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 r = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 } |
31301
45496e1dfe5c
Fix up some cases of file transfers never finishing. This will help certain
Cristi Posoiu
parents:
31086
diff
changeset
|
1104 if (r >= 0 && (purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer) && |
45496e1dfe5c
Fix up some cases of file transfers never finishing. This will help certain
Cristi Posoiu
parents:
31086
diff
changeset
|
1105 !purple_xfer_is_completed(xfer)) |
45496e1dfe5c
Fix up some cases of file transfers never finishing. This will help certain
Cristi Posoiu
parents:
31086
diff
changeset
|
1106 purple_xfer_set_completed(xfer, TRUE); |
45496e1dfe5c
Fix up some cases of file transfers never finishing. This will help certain
Cristi Posoiu
parents:
31086
diff
changeset
|
1107 |
15373
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 return r; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 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
|
1113 do_transfer(PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 { |
15822 | 1115 PurpleXferUiOps *ui_ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1116 guchar *buffer = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 gssize r = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1119 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
|
1120 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1121 if (xfer->type == PURPLE_XFER_RECEIVE) { |
15822 | 1122 r = purple_xfer_read(xfer, &buffer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 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
|
1124 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
|
1125 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
|
1126 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
|
1127 else |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1128 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
|
1129 |
22073
f90462eb434b
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
21866
diff
changeset
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 return; |
f90462eb434b
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
21866
diff
changeset
|
1135 } |
27902
e30de9ebfa69
ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents:
27881
diff
changeset
|
1136 |
e30de9ebfa69
ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <paul@darkrain42.org>
parents:
27881
diff
changeset
|
1137 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
|
1138 ((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
|
1139 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
|
1140 } else if(r < 0) { |
15822 | 1141 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
|
1142 g_free(buffer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 } |
27878
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1145 } 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
|
1146 size_t result = 0; |
15822 | 1147 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
|
1148 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
|
1149 gboolean read = TRUE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 /* 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
|
1152 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
|
1153 if (s == 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 if (xfer->watcher) { |
15822 | 1155 purple_input_remove(xfer->watcher); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 |
29536
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1161 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
|
1162 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
|
1163 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
|
1164 read = TRUE; |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1165 } else { |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1166 read = FALSE; |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1167 } |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1168 } |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1169 |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1170 if (read) { |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1171 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
|
1172 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
|
1173 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
|
1174 /* |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1175 * 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
|
1176 * 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
|
1177 * 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
|
1178 */ |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1179 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
|
1180 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
|
1181 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
|
1182 } |
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 /* 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
|
1185 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
|
1186 |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1187 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
|
1188 } 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
|
1189 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
|
1190 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
|
1191 return; |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1192 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 |
29536
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1194 result = tmp; |
75780bc426d0
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <paul@darkrain42.org>
parents:
29535
diff
changeset
|
1195 } 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
|
1196 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
|
1197 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
|
1198 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
|
1199 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
|
1200 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
|
1201 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
|
1202 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
|
1203 } |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1204 } |
22073
f90462eb434b
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@wiktel.com>
parents:
21866
diff
changeset
|
1205 } |
29537 | 1206 |
29124
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1207 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
|
1208 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
|
1209 g_free(buffer); |
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1210 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
|
1211 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
|
1212 } |
29537 | 1213 |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1214 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
|
1215 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 if (r == -1) { |
15822 | 1217 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
|
1218 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
|
1219 /* 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
|
1220 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
|
1221 g_free(buffer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 return; |
29124
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1223 } else if (r == result) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 * 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
|
1226 * 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
|
1227 * bigger. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 */ |
15822 | 1229 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
|
1230 } else { |
29537 | 1231 if (ui_ops && ui_ops->data_not_sent) |
1232 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
|
1233 } |
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1234 |
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1235 if (priv->buffer) { |
29537 | 1236 /* |
29124
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1237 * 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
|
1238 * 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
|
1239 * 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
|
1240 */ |
51c5cbc0d325
Kill off the use of fseek for non-seekable streams in file transfers.
foufou33@gmail.com
parents:
28359
diff
changeset
|
1241 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
|
1242 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
|
1243 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 if (r > 0) { |
15822 | 1247 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
|
1248 xfer->bytes_remaining -= r; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 xfer->bytes_sent += 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 if (xfer->ops.ack != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 xfer->ops.ack(xfer, buffer, r); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 g_free(buffer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 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
|
1258 ui_ops->update_progress(xfer, |
15822 | 1259 purple_xfer_get_progress(xfer)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 |
15822 | 1262 if (purple_xfer_is_completed(xfer)) |
1263 purple_xfer_end(xfer); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 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
|
1267 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
|
1268 { |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1269 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
|
1270 |
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 (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
|
1272 /* 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
|
1273 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
|
1274 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
|
1275 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
|
1276 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1277 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
|
1278 xfer->watcher = 0; |
28831
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1279 |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1280 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
|
1281 return; |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1282 } |
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
|
1283 |
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
|
1284 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
|
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 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
|
1288 } |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1289 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1290 static void |
15822 | 1291 begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 { |
15822 | 1293 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
|
1294 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
|
1295 |
30590
485eaf544bb0
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30432
diff
changeset
|
1296 if (xfer->start_time != 0) { |
485eaf544bb0
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30432
diff
changeset
|
1297 purple_debug_error("xfer", "Transfer is being started multiple times\n"); |
485eaf544bb0
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30432
diff
changeset
|
1298 g_return_if_reached(); |
485eaf544bb0
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30432
diff
changeset
|
1299 } |
485eaf544bb0
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30432
diff
changeset
|
1300 |
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
|
1301 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
|
1302 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
|
1303 type == PURPLE_XFER_RECEIVE ? "wb" : "rb"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1304 |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1305 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
|
1306 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
|
1307 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
|
1308 return; |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1309 } |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1310 |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1311 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
|
1312 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1313 |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1314 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
|
1315 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
|
1316 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 xfer->start_time = time(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 if (xfer->ops.start != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 xfer->ops.start(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 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
|
1325 { |
15822 | 1326 PurpleXfer *xfer = (PurpleXfer *)data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 |
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
|
1328 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
|
1329 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
|
1330 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
|
1331 } |
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
|
1332 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 |
15822 | 1335 begin_transfer(xfer, PURPLE_INPUT_READ); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 void |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1339 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
|
1340 { |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1341 PurpleInputCondition cond; |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1342 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
|
1343 PurpleXferPrivData *priv; |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1344 |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1345 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
|
1346 |
27878
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1347 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
|
1348 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
|
1349 |
28831
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1350 if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) { |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1351 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
|
1352 return; |
28831
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1353 } |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1354 |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1355 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
|
1356 |
27872
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1357 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
|
1358 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
|
1359 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
|
1360 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
|
1361 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
|
1362 |
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
|
1363 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
|
1364 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
|
1365 |
27878
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1366 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
|
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 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
|
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 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1371 void |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1372 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
|
1373 { |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1374 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
|
1375 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1376 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
|
1377 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1378 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
|
1379 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
|
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 /* 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
|
1382 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
|
1383 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
|
1384 return; |
28831
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1385 } |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1386 |
07ec4a569da1
ft: Add some useful debug logging.
Paul Aurich <paul@darkrain42.org>
parents:
28823
diff
changeset
|
1387 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
|
1388 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1389 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
|
1390 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1391 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
|
1392 } |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1393 |
4a4e9d309fc0
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
hanzz@soc.pidgin.im
parents:
27799
diff
changeset
|
1394 void |
15822 | 1395 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
|
1396 unsigned int port) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 { |
15822 | 1398 PurpleInputCondition cond; |
1399 PurpleXferType type; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1400 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 g_return_if_fail(xfer != NULL); |
15822 | 1402 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
|
1403 |
15822 | 1404 type = purple_xfer_get_type(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 |
15822 | 1406 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
|
1407 |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1408 /* |
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1409 * 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
|
1410 * 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
|
1411 */ |
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1412 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
|
1413 fd = -1; |
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1414 |
15822 | 1415 if (type == PURPLE_XFER_RECEIVE) { |
1416 cond = PURPLE_INPUT_READ; | |
15373
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 if (ip != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 xfer->remote_ip = g_strdup(ip); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 xfer->remote_port = port; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 /* Establish a file descriptor. */ |
15822 | 1423 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
|
1424 xfer->remote_port, connect_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 xfer->fd = fd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 } |
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 else { |
15822 | 1433 cond = PURPLE_INPUT_WRITE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 xfer->fd = fd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 } |
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 begin_transfer(xfer, cond); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 void |
15822 | 1442 purple_xfer_end(PurpleXfer *xfer) |
15373
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 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 /* See if we are actually trying to cancel this. */ |
15822 | 1447 if (!purple_xfer_is_completed(xfer)) { |
1448 purple_xfer_cancel_local(xfer); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 } |
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 xfer->end_time = time(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 if (xfer->ops.end != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 xfer->ops.end(xfer); |
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->watcher != 0) { |
15822 | 1457 purple_input_remove(xfer->watcher); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 xfer->watcher = 0; |
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 |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1461 if (xfer->fd != -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 close(xfer->fd); |
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 if (xfer->dest_fp != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 fclose(xfer->dest_fp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 xfer->dest_fp = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1468 |
15822 | 1469 purple_xfer_unref(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1470 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1472 void |
15822 | 1473 purple_xfer_add(PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1474 { |
15822 | 1475 PurpleXferUiOps *ui_ops; |
15373
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 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 |
15822 | 1479 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
|
1480 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 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
|
1482 ui_ops->add_xfer(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 void |
15822 | 1486 purple_xfer_cancel_local(PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 { |
15822 | 1488 PurpleXferUiOps *ui_ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 char *msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 |
30954
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1493 /* TODO: We definitely want to close any open request dialogs associated |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1494 with this transfer. However, in some cases the request dialog might |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1495 own a reference on the xfer. This happens at least with the "%s wants |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1496 to send you %s" dialog from purple_xfer_ask_recv(). In these cases |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1497 the ref count will not be decremented when the request dialog is |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1498 closed, so the ref count will never reach 0 and the xfer will never |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1499 be freed. This is a memleak and should be fixed. It's not clear what |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1500 the correct fix is. Probably requests should have a destroy function |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1501 that is called when the request is destroyed. But also, ref counting |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1502 xfer objects makes this code REALLY complicated. An alternate fix is |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1503 to not ref count and instead just make sure the object still exists |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1504 when we try to use it. */ |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1505 purple_request_close_with_handle(xfer); |
a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
Mark Doliner <mark@kingant.net>
parents:
30590
diff
changeset
|
1506 |
15822 | 1507 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
|
1508 xfer->end_time = time(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 |
15822 | 1510 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
|
1511 { |
27960
a7eac81575e7
Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents:
27396
diff
changeset
|
1512 msg = g_strdup_printf(_("You cancelled the transfer of %s"), |
15822 | 1513 purple_xfer_get_filename(xfer)); |
15373
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 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 { |
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
|
1517 msg = g_strdup(_("File transfer cancelled")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 } |
15822 | 1519 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
|
1520 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1521 |
15822 | 1522 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
|
1523 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 if (xfer->ops.cancel_send != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 xfer->ops.cancel_send(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 else |
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 if (xfer->ops.cancel_recv != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 xfer->ops.cancel_recv(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 } |
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 if (xfer->watcher != 0) { |
15822 | 1534 purple_input_remove(xfer->watcher); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1538 if (xfer->fd != -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 close(xfer->fd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 if (xfer->dest_fp != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 fclose(xfer->dest_fp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1543 xfer->dest_fp = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 |
15822 | 1546 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
|
1547 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 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
|
1549 ui_ops->cancel_local(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 xfer->bytes_remaining = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 |
15822 | 1553 purple_xfer_unref(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 } |
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 void |
15822 | 1557 purple_xfer_cancel_remote(PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 { |
15822 | 1559 PurpleXferUiOps *ui_ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 gchar *msg; |
15822 | 1561 PurpleAccount *account; |
1562 PurpleBuddy *buddy; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 |
15822 | 1566 purple_request_close_with_handle(xfer); |
1567 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
|
1568 xfer->end_time = time(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 |
15822 | 1570 account = purple_xfer_get_account(xfer); |
1571 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
|
1572 |
15822 | 1573 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
|
1574 { |
27960
a7eac81575e7
Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents:
27396
diff
changeset
|
1575 msg = g_strdup_printf(_("%s cancelled the transfer of %s"), |
15822 | 1576 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
|
1577 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 { |
27960
a7eac81575e7
Normalize on 'cancelled'
Paul Aurich <paul@darkrain42.org>
parents:
27396
diff
changeset
|
1580 msg = g_strdup_printf(_("%s cancelled the file transfer"), |
15822 | 1581 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
|
1582 } |
15822 | 1583 purple_xfer_conversation_write(xfer, msg, TRUE); |
1584 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
|
1585 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 |
15822 | 1587 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
|
1588 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 if (xfer->ops.cancel_send != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 xfer->ops.cancel_send(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 else |
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 if (xfer->ops.cancel_recv != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 xfer->ops.cancel_recv(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 } |
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 if (xfer->watcher != 0) { |
15822 | 1599 purple_input_remove(xfer->watcher); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 xfer->watcher = 0; |
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 |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27872
diff
changeset
|
1603 if (xfer->fd != -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 close(xfer->fd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 if (xfer->dest_fp != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 fclose(xfer->dest_fp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 xfer->dest_fp = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 |
15822 | 1611 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
|
1612 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 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
|
1614 ui_ops->cancel_remote(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 xfer->bytes_remaining = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 |
15822 | 1618 purple_xfer_unref(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 } |
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 void |
15822 | 1622 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
|
1623 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 char *title; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 g_return_if_fail(msg != NULL); |
15822 | 1627 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
|
1628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 if (account) { |
15822 | 1630 PurpleBuddy *buddy; |
1631 buddy = purple_find_buddy(account, who); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 if (buddy) |
15822 | 1633 who = purple_buddy_get_alias(buddy); |
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 |
15822 | 1636 if (type == PURPLE_XFER_SEND) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 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
|
1638 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 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
|
1640 |
15822 | 1641 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
|
1642 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 g_free(title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 void |
15822 | 1647 purple_xfer_update_progress(PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 { |
15822 | 1649 PurpleXferUiOps *ui_ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 |
15822 | 1653 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
|
1654 if (ui_ops != NULL && ui_ops->update_progress != NULL) |
15822 | 1655 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
|
1656 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 |
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
|
1658 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
|
1659 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
|
1660 { |
29824
6671b5e92c28
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents:
29823
diff
changeset
|
1661 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
|
1662 |
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
|
1663 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
|
1664 *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
|
1665 |
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
|
1666 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
|
1667 } |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1668 |
29822
25a53c299713
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents:
29819
diff
changeset
|
1669 const gchar * |
25a53c299713
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents:
29819
diff
changeset
|
1670 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
|
1671 { |
29824
6671b5e92c28
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents:
29823
diff
changeset
|
1672 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
|
1673 |
6671b5e92c28
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents:
29823
diff
changeset
|
1674 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
|
1675 } |
25a53c299713
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents:
29819
diff
changeset
|
1676 |
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 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
|
1678 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
|
1679 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
|
1680 { |
29824
6671b5e92c28
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <ml@update.uu.se>
parents:
29823
diff
changeset
|
1681 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
|
1682 |
29833
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1683 g_free(priv->thumbnail_data); |
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1684 g_free(priv->thumbnail_mimetype); |
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1685 |
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
|
1686 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
|
1687 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
|
1688 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
|
1689 priv->thumbnail_mimetype = g_strdup(mimetype); |
29833
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1690 } else { |
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1691 priv->thumbnail_data = NULL; |
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1692 priv->thumbnail_size = 0; |
834038426c38
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
1693 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
|
1694 } |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1695 } |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1696 |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1697 void |
29823
79bb2804a19e
Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <ml@update.uu.se>
parents:
29822
diff
changeset
|
1698 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
|
1699 { |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1700 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
|
1701 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
|
1702 } |
3882d419e628
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <ml@update.uu.se>
parents:
26505
diff
changeset
|
1703 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 * File Transfer Subsystem API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 void * |
15822 | 1709 purple_xfers_get_handle(void) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 static int handle = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1711 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 void |
15822 | 1716 purple_xfers_init(void) { |
1717 void *handle = purple_xfers_get_handle(); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 |
27878
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1719 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
|
1720 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
|
1721 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 /* register signals */ |
15822 | 1723 purple_signal_register(handle, "file-recv-accept", |
1724 purple_marshal_VOID__POINTER, NULL, 1, | |
1725 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1726 PURPLE_SUBTYPE_XFER)); | |
1727 purple_signal_register(handle, "file-send-accept", | |
1728 purple_marshal_VOID__POINTER, NULL, 1, | |
1729 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1730 PURPLE_SUBTYPE_XFER)); | |
1731 purple_signal_register(handle, "file-recv-start", | |
1732 purple_marshal_VOID__POINTER, NULL, 1, | |
1733 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1734 PURPLE_SUBTYPE_XFER)); | |
1735 purple_signal_register(handle, "file-send-start", | |
1736 purple_marshal_VOID__POINTER, NULL, 1, | |
1737 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1738 PURPLE_SUBTYPE_XFER)); | |
1739 purple_signal_register(handle, "file-send-cancel", | |
1740 purple_marshal_VOID__POINTER, NULL, 1, | |
1741 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1742 PURPLE_SUBTYPE_XFER)); | |
1743 purple_signal_register(handle, "file-recv-cancel", | |
1744 purple_marshal_VOID__POINTER, NULL, 1, | |
1745 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1746 PURPLE_SUBTYPE_XFER)); | |
1747 purple_signal_register(handle, "file-send-complete", | |
1748 purple_marshal_VOID__POINTER, NULL, 1, | |
1749 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1750 PURPLE_SUBTYPE_XFER)); | |
1751 purple_signal_register(handle, "file-recv-complete", | |
1752 purple_marshal_VOID__POINTER, NULL, 1, | |
1753 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1754 PURPLE_SUBTYPE_XFER)); | |
1755 purple_signal_register(handle, "file-recv-request", | |
1756 purple_marshal_VOID__POINTER, NULL, 1, | |
1757 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
1758 PURPLE_SUBTYPE_XFER)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1759 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 void |
21067
96929e7acb86
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents:
20592
diff
changeset
|
1762 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
|
1763 { |
96929e7acb86
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents:
20592
diff
changeset
|
1764 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
|
1765 |
96929e7acb86
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <pidgin@unreliablesource.net>
parents:
20592
diff
changeset
|
1766 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
|
1767 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
|
1768 |
b7b25f580637
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <paul@darkrain42.org>
parents:
27875
diff
changeset
|
1769 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
|
1770 xfers_data = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1772 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1773 void |
15822 | 1774 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
|
1775 xfer_ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
15822 | 1778 PurpleXferUiOps * |
1779 purple_xfers_get_ui_ops(void) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 return xfer_ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1781 } |