Sat, 23 Oct 2021 01:06:57 -0500
Now that the History API is here, remove the purple logging api
Testing Done:
Sent ims in both pidgin3 and finch3, also joined a chat in pidgin3 and verified that the preferences window is okay.
Reviewed at https://reviews.imfreedom.org/r/1077/
|
20330
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* purple |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 4538 | 6 | * |
| 3609 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19733
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
19733
ec657d978c5a
disapproval of revision 'f08436883bb16f29affdc63e9fd86ff278ed368f'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19732
diff
changeset
|
20 | * |
| 3609 | 21 | */ |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
25 | #include "internal.h" |
|
40195
fb4b0ae193c0
Remove glibcompat.h from all the files that don't actually need it.
Gary Kramlich <grim@reaperworld.com>
parents:
40146
diff
changeset
|
26 | #include "glibcompat.h" /* for purple_g_stat on win32 */ |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
27 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40334
diff
changeset
|
28 | #include <glib/gstdio.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40334
diff
changeset
|
29 | |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
30 | #include "debug.h" |
|
40756
3a58ef28ee44
Implement mitigation for GHSL-2021-045
Gary Kramlich <grim@reaperworld.com>
parents:
40648
diff
changeset
|
31 | #include "glibcompat.h" |
|
35813
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
32 | #include "image-store.h" |
| 8231 | 33 | #include "network.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
34 | #include "notify.h" |
|
6241
34d166a31152
[gaim-migrate @ 6735]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
35 | #include "prefs.h" |
| 3609 | 36 | #include "proxy.h" |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
37 | #include "purple-gio.h" |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
38 | #include "purpleconversationmanager.h" |
|
41007
90d2dee9b3dc
Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
39 | #include "purpleenums.h" |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
40 | #include "request.h" |
|
41137
3c1574216aed
Now that the History API is here, remove the purple logging api
Gary Kramlich <grim@reaperworld.com>
parents:
41083
diff
changeset
|
41 | #include "server.h" |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
42 | #include "util.h" |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
43 | #include "xfer.h" |
|
5494
410d120ef10d
[gaim-migrate @ 5890]
Herman Bloggs <herman@bluedigits.com>
parents:
5436
diff
changeset
|
44 | |
|
15280
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
45 | #define FT_INITIAL_BUFFER_SIZE 4096 |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
46 | #define FT_MAX_BUFFER_SIZE 65535 |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
47 | |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
48 | typedef struct _PurpleXferPrivate PurpleXferPrivate; |
|
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
49 | |
| 15884 | 50 | static PurpleXferUiOps *xfer_ui_ops = NULL; |
|
15702
111fdd9108cc
Patch from Richard 'wabz' Nelson to add file-transfer ui. Amazing stuff\!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15435
diff
changeset
|
51 | static GList *xfers; |
| 3609 | 52 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
53 | /* Private data for a file transfer */ |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
54 | struct _PurpleXferPrivate { |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
55 | PurpleXferType type; /* The type of transfer. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
56 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
57 | PurpleAccount *account; /* The account. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
58 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
59 | char *who; /* The person on the other end of the |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
60 | transfer. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
61 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
62 | char *message; /* A message sent with the request */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
63 | char *filename; /* The name sent over the network. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
64 | char *local_filename; /* The name on the local hard drive. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
65 | goffset size; /* The size of the file. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
66 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
67 | FILE *dest_fp; /* The destination file pointer. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
68 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
69 | char *remote_ip; /* The remote IP address. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
70 | guint16 local_port; /* The local port. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
71 | guint16 remote_port; /* The remote port. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
72 | |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
73 | GSocketConnection *conn; /* The socket connection. */ |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
74 | int fd; /* The socket file descriptor. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
75 | int watcher; /* Watcher. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
76 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
77 | goffset bytes_sent; /* The number of bytes sent. */ |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
78 | gint64 start_time; /* When the transfer of data began. */ |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
79 | gint64 end_time; /* When the transfer of data ended. */ |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
80 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
81 | size_t current_buffer_size; /* This gradually increases for fast |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
82 | network connections. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
83 | |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
84 | PurpleXferStatus status; /* File Transfer's status. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
85 | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
86 | gboolean visible; /* Hint the UI that the transfer should |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
87 | be visible or not. */ |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
88 | PurpleXferUiOps *ui_ops; /* UI-specific operations. */ |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
89 | |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
90 | /* |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
91 | * Used to moderate the file transfer when either the read/write ui_ops are |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
92 | * set or fd is not set. In those cases, the UI/protocol call the respective |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
93 | * function, which is somewhat akin to a fd watch being triggered. |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
94 | */ |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
95 | enum { |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
96 | PURPLE_XFER_READY_NONE = 0x0, |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
97 | PURPLE_XFER_READY_UI = 0x1, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
98 | PURPLE_XFER_READY_PROTOCOL = 0x2, |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
99 | } ready; |
|
29968
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
100 | |
|
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
101 | /* TODO: Should really use a PurpleCircBuffer for this. */ |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
102 | GByteArray *buffer; |
|
30115
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
103 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
104 | gpointer thumbnail_data; /* thumbnail image */ |
|
30115
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
105 | gsize thumbnail_size; |
|
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
106 | gchar *thumbnail_mimetype; |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
107 | }; |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
108 | |
| 34925 | 109 | /* GObject property enums */ |
| 110 | enum | |
| 111 | { | |
| 112 | PROP_0, | |
| 113 | PROP_TYPE, | |
| 114 | PROP_ACCOUNT, | |
| 115 | PROP_REMOTE_USER, | |
| 116 | PROP_MESSAGE, | |
| 117 | PROP_FILENAME, | |
| 118 | PROP_LOCAL_FILENAME, | |
| 119 | PROP_FILE_SIZE, | |
| 120 | PROP_REMOTE_IP, | |
| 121 | PROP_LOCAL_PORT, | |
| 122 | PROP_REMOTE_PORT, | |
| 123 | PROP_FD, | |
| 124 | PROP_WATCHER, | |
| 125 | PROP_BYTES_SENT, | |
| 126 | PROP_START_TIME, | |
| 127 | PROP_END_TIME, | |
| 128 | PROP_STATUS, | |
|
40255
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
129 | PROP_PROGRESS, |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
130 | PROP_VISIBLE, |
| 34925 | 131 | PROP_LAST |
| 132 | }; | |
| 133 | ||
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
134 | static GParamSpec *properties[PROP_LAST]; |
| 34925 | 135 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
136 | /* GObject signal enums */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
137 | enum |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
138 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
139 | SIG_OPEN_LOCAL, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
140 | SIG_QUERY_LOCAL, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
141 | SIG_READ_LOCAL, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
142 | SIG_WRITE_LOCAL, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
143 | SIG_DATA_NOT_SENT, |
|
40257
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
144 | SIG_ADD_THUMBNAIL, |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
145 | SIG_LAST |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
146 | }; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
147 | static guint signals[SIG_LAST] = {0}; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
148 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
149 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleXfer, purple_xfer, G_TYPE_OBJECT); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
150 | |
| 15884 | 151 | static int purple_xfer_choose_file(PurpleXfer *xfer); |
| 14967 | 152 | |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
153 | static const gchar * |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
154 | purple_xfer_status_type_to_string(PurpleXferStatus type) |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
155 | { |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
156 | static const struct { |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
157 | PurpleXferStatus type; |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
158 | const char *name; |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
159 | } type_names[] = { |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
160 | { PURPLE_XFER_STATUS_UNKNOWN, "unknown" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
161 | { PURPLE_XFER_STATUS_NOT_STARTED, "not started" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
162 | { PURPLE_XFER_STATUS_ACCEPTED, "accepted" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
163 | { PURPLE_XFER_STATUS_STARTED, "started" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
164 | { PURPLE_XFER_STATUS_DONE, "done" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
165 | { PURPLE_XFER_STATUS_CANCEL_LOCAL, "cancelled locally" }, |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
166 | { PURPLE_XFER_STATUS_CANCEL_REMOTE, "cancelled remotely" } |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
167 | }; |
|
34305
5804117fb298
Fix the rest of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34286
diff
changeset
|
168 | gsize i; |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
169 | |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
170 | for (i = 0; i < G_N_ELEMENTS(type_names); ++i) |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
171 | if (type_names[i].type == type) |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
172 | return type_names[i].name; |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
173 | |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
174 | return "invalid state"; |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
175 | } |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
176 | |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
177 | void |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
178 | purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatus status) |
|
9788
ca43717a431b
[gaim-migrate @ 10656]
Dave West <kat@users.sourceforge.net>
parents:
9785
diff
changeset
|
179 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
180 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
181 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
182 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
183 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
184 | priv = purple_xfer_get_instance_private(xfer); |
|
9788
ca43717a431b
[gaim-migrate @ 10656]
Dave West <kat@users.sourceforge.net>
parents:
9785
diff
changeset
|
185 | |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
186 | if (purple_debug_is_verbose()) |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
187 | purple_debug_info("xfer", "Changing status of xfer %p from %s to %s\n", |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
188 | xfer, purple_xfer_status_type_to_string(priv->status), |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
189 | purple_xfer_status_type_to_string(status)); |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
190 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
191 | if (priv->status == status) |
|
27993
857add008895
ft: Don't emit a changed-status signal for something that isn't a change.
Paul Aurich <darkrain42@pidgin.im>
parents:
27944
diff
changeset
|
192 | return; |
|
857add008895
ft: Don't emit a changed-status signal for something that isn't a change.
Paul Aurich <darkrain42@pidgin.im>
parents:
27944
diff
changeset
|
193 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
194 | priv->status = status; |
|
27942
ace850ade78d
Set xfer->status before emitting signals in purple_xfer_set_status.
Paul Aurich <darkrain42@pidgin.im>
parents:
27655
diff
changeset
|
195 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
196 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_STATUS]); |
|
9788
ca43717a431b
[gaim-migrate @ 10656]
Dave West <kat@users.sourceforge.net>
parents:
9785
diff
changeset
|
197 | } |
|
ca43717a431b
[gaim-migrate @ 10656]
Dave West <kat@users.sourceforge.net>
parents:
9785
diff
changeset
|
198 | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
199 | void |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
200 | purple_xfer_set_visible(PurpleXfer *xfer, gboolean visible) |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
201 | { |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
202 | PurpleXferPrivate *priv = NULL; |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
203 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
204 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
205 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
206 | priv = purple_xfer_get_instance_private(xfer); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
207 | priv->visible = visible; |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
208 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
209 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_VISIBLE]); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
210 | } |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
211 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31154
diff
changeset
|
212 | static void |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
213 | purple_xfer_conversation_write_internal(PurpleXfer *xfer, |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
214 | const char *message, gboolean is_error, gboolean print_thumbnail) |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
215 | { |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
216 | PurpleConversation *im = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
217 | PurpleConversationManager *manager = NULL; |
| 15884 | 218 | PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
219 | char *escaped; |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
220 | gconstpointer thumbnail_data; |
|
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
221 | gsize size; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
222 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
223 | |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
224 | thumbnail_data = purple_xfer_get_thumbnail(xfer, &size); |
|
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
225 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
226 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
227 | im = purple_conversation_manager_find_im(manager, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
228 | purple_xfer_get_account(xfer), |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
229 | priv->who); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
230 | if(PURPLE_IS_IM_CONVERSATION(im)) { |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
231 | return; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
232 | } |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
233 | |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
234 | escaped = g_markup_escape_text(message, -1); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
235 | |
|
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
236 | if (is_error) |
|
29019
9cb4fa62242d
ft: Properly set a bitmask field (so it includes PURPLE_MESSAGE_SYSTEM like
Florian Quèze <florian@instantbird.org>
parents:
28659
diff
changeset
|
237 | flags |= PURPLE_MESSAGE_ERROR; |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
238 | |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
239 | if (print_thumbnail && thumbnail_data) { |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
240 | gchar *message_with_img; |
|
35813
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
241 | PurpleImage *img; |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
242 | guint id; |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
243 | |
|
40146
66604f791698
Fix some possible leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39892
diff
changeset
|
244 | img = purple_image_new_from_data(thumbnail_data, size); |
|
35813
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
245 | id = purple_image_store_add(img); |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
246 | g_object_unref(img); |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
247 | |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
248 | message_with_img = g_strdup_printf("<img src=\"" |
|
a5b71a95a42a
imgstore: remove references from libpurple (not prpls yet)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
249 | PURPLE_IMAGE_STORE_PROTOCOL "%u\"> %s", id, escaped); |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
250 | purple_conversation_write_system_message( |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
251 | im, message_with_img, flags); |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
252 | g_free(message_with_img); |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
253 | } else { |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
254 | purple_conversation_write_system_message( |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
255 | im, escaped, flags); |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
256 | } |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
257 | g_free(escaped); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
258 | } |
|
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
259 | |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
260 | void |
|
33465
215bec3b763a
Add const to the API, where needed
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33052
diff
changeset
|
261 | purple_xfer_conversation_write(PurpleXfer *xfer, const gchar *message, |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
262 | gboolean is_error) |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
263 | { |
|
39775
a203f2974c98
Move extraneous NULL-checks in xfer to public function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39670
diff
changeset
|
264 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
a203f2974c98
Move extraneous NULL-checks in xfer to public function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39670
diff
changeset
|
265 | g_return_if_fail(message != NULL); |
|
a203f2974c98
Move extraneous NULL-checks in xfer to public function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39670
diff
changeset
|
266 | |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
267 | purple_xfer_conversation_write_internal(xfer, message, is_error, FALSE); |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
268 | } |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
269 | |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41024
diff
changeset
|
270 | /* maybe this one should be exported publicly? */ |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
271 | static void |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
272 | purple_xfer_conversation_write_with_thumbnail(PurpleXfer *xfer, |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
273 | const gchar *message) |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
274 | { |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
275 | purple_xfer_conversation_write_internal(xfer, message, FALSE, TRUE); |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
276 | } |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
277 | |
|
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
278 | |
| 15884 | 279 | static void purple_xfer_show_file_error(PurpleXfer *xfer, const char *filename) |
| 9785 | 280 | { |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
281 | int err = errno; |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
282 | gchar *msg = NULL, *utf8; |
|
34910
60502558e400
Replacements for the GObject Xfer API
Ankit Vani <a@nevitus.org>
parents:
34909
diff
changeset
|
283 | PurpleXferType xfer_type = purple_xfer_get_xfer_type(xfer); |
| 15884 | 284 | PurpleAccount *account = purple_xfer_get_account(xfer); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
285 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
| 9785 | 286 | |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
287 | utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); |
|
9796
dd7499147bed
[gaim-migrate @ 10664]
Dave West <kat@users.sourceforge.net>
parents:
9795
diff
changeset
|
288 | switch(xfer_type) { |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
289 | case PURPLE_XFER_TYPE_SEND: |
|
9796
dd7499147bed
[gaim-migrate @ 10664]
Dave West <kat@users.sourceforge.net>
parents:
9795
diff
changeset
|
290 | msg = g_strdup_printf(_("Error reading %s: \n%s.\n"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
20147
diff
changeset
|
291 | utf8, g_strerror(err)); |
| 9795 | 292 | break; |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
293 | case PURPLE_XFER_TYPE_RECEIVE: |
|
9796
dd7499147bed
[gaim-migrate @ 10664]
Dave West <kat@users.sourceforge.net>
parents:
9795
diff
changeset
|
294 | msg = g_strdup_printf(_("Error writing %s: \n%s.\n"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
20147
diff
changeset
|
295 | utf8, g_strerror(err)); |
| 9785 | 296 | break; |
| 297 | default: | |
|
9796
dd7499147bed
[gaim-migrate @ 10664]
Dave West <kat@users.sourceforge.net>
parents:
9795
diff
changeset
|
298 | msg = g_strdup_printf(_("Error accessing %s: \n%s.\n"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
20147
diff
changeset
|
299 | utf8, g_strerror(err)); |
| 9785 | 300 | break; |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
301 | } |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
302 | g_free(utf8); |
| 9785 | 303 | |
| 15884 | 304 | purple_xfer_conversation_write(xfer, msg, TRUE); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
305 | purple_xfer_error(xfer_type, account, priv->who, msg); |
|
9796
dd7499147bed
[gaim-migrate @ 10664]
Dave West <kat@users.sourceforge.net>
parents:
9795
diff
changeset
|
306 | g_free(msg); |
| 9785 | 307 | } |
| 308 | ||
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
309 | static void |
| 15884 | 310 | purple_xfer_choose_file_ok_cb(void *user_data, const char *filename) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
311 | { |
| 15884 | 312 | PurpleXfer *xfer; |
|
29155
365ee5da3b06
There's no need to call purple_xfer_get_type() repeatedly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29019
diff
changeset
|
313 | PurpleXferType type; |
|
33940
b44d15793c83
Use GStatBuf instead of struct stat
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33661
diff
changeset
|
314 | GStatBuf st; |
| 14967 | 315 | gchar *dir; |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
316 | |
| 15884 | 317 | xfer = (PurpleXfer *)user_data; |
|
34910
60502558e400
Replacements for the GObject Xfer API
Ankit Vani <a@nevitus.org>
parents:
34909
diff
changeset
|
318 | type = purple_xfer_get_xfer_type(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
319 | |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10504
diff
changeset
|
320 | if (g_stat(filename, &st) != 0) { |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
321 | /* File not found. */ |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
322 | if (type == PURPLE_XFER_TYPE_RECEIVE) { |
|
15161
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
323 | #ifndef _WIN32 |
|
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
324 | int mode = W_OK; |
|
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
325 | #else |
|
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
326 | int mode = F_OK; |
|
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
327 | #endif |
| 14967 | 328 | dir = g_path_get_dirname(filename); |
| 329 | ||
|
15161
7a392764f0b8
[gaim-migrate @ 17885]
Daniel Atallah <datallah@pidgin.im>
parents:
14967
diff
changeset
|
330 | if (g_access(dir, mode) == 0) { |
| 15884 | 331 | purple_xfer_request_accepted(xfer, filename); |
| 14967 | 332 | } else { |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
333 | g_object_ref(xfer); |
| 15884 | 334 | purple_notify_message( |
| 335 | NULL, PURPLE_NOTIFY_MSG_ERROR, NULL, | |
| 14967 | 336 | _("Directory is not writable."), NULL, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
337 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
338 | purple_xfer_get_account(xfer)), |
| 15884 | 339 | (PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer); |
| 14967 | 340 | } |
| 341 | ||
| 342 | g_free(dir); | |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
343 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
344 | else { |
| 15884 | 345 | purple_xfer_show_file_error(xfer, filename); |
|
29159
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
346 | purple_xfer_cancel_local(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
347 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
348 | } |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
349 | else if ((type == PURPLE_XFER_TYPE_SEND) && (st.st_size == 0)) { |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
350 | |
| 15884 | 351 | purple_notify_error(NULL, NULL, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
352 | _("Cannot send a file of 0 bytes."), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
353 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
354 | purple_xfer_get_account(xfer))); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
355 | |
|
29159
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
356 | purple_xfer_cancel_local(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
357 | } |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
358 | else if ((type == PURPLE_XFER_TYPE_SEND) && S_ISDIR(st.st_mode)) { |
| 9785 | 359 | /* |
| 360 | * XXX - Sending a directory should be valid for some protocols. | |
| 361 | */ | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
362 | purple_notify_error(NULL, NULL, _("Cannot send a directory."), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
363 | NULL, purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
364 | purple_xfer_get_account(xfer))); |
| 9785 | 365 | |
|
29159
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
366 | purple_xfer_cancel_local(xfer); |
| 9785 | 367 | } |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
368 | else if ((type == PURPLE_XFER_TYPE_RECEIVE) && S_ISDIR(st.st_mode)) { |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
369 | char *msg, *utf8; |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
370 | utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
371 | msg = g_strdup_printf( |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
372 | _("%s is not a regular file. Cowardly refusing to overwrite it.\n"), utf8); |
|
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
373 | g_free(utf8); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
374 | purple_notify_error(NULL, NULL, msg, NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
375 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
376 | purple_xfer_get_account(xfer))); |
| 9785 | 377 | g_free(msg); |
| 15884 | 378 | purple_xfer_request_denied(xfer); |
| 9785 | 379 | } |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
380 | else if (type == PURPLE_XFER_TYPE_SEND) { |
|
29156
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
381 | #ifndef _WIN32 |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
382 | int mode = R_OK; |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
383 | #else |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
384 | int mode = F_OK; |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
385 | #endif |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
386 | |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
387 | if (g_access(filename, mode) == 0) { |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
388 | purple_xfer_request_accepted(xfer, filename); |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
389 | } else { |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
390 | g_object_ref(xfer); |
|
29156
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
391 | purple_notify_message( |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
392 | NULL, PURPLE_NOTIFY_MSG_ERROR, NULL, |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
393 | _("File is not readable."), NULL, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
394 | purple_request_cpar_from_account( |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
395 | purple_xfer_get_account(xfer)), |
|
29156
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
396 | (PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer); |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
397 | } |
|
816cd92683eb
Check file permissions before sending a file transfer request.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29155
diff
changeset
|
398 | } |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
399 | else { |
| 15884 | 400 | purple_xfer_request_accepted(xfer, filename); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
401 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
402 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
403 | g_object_unref(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
404 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
405 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
406 | static void |
| 15884 | 407 | purple_xfer_choose_file_cancel_cb(void *user_data, const char *filename) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
408 | { |
| 15884 | 409 | PurpleXfer *xfer = (PurpleXfer *)user_data; |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
410 | |
| 15884 | 411 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
412 | if (purple_xfer_get_xfer_type(xfer) == PURPLE_XFER_TYPE_SEND) |
|
29159
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
413 | purple_xfer_cancel_local(xfer); |
|
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
414 | else |
|
742ae16831fa
Call purple_xfer_cancel_local instead of purple_xfer_request_denied when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29158
diff
changeset
|
415 | purple_xfer_request_denied(xfer); |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
416 | g_object_unref(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
417 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
418 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
419 | static int |
| 15884 | 420 | purple_xfer_choose_file(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
421 | { |
| 15884 | 422 | purple_request_file(xfer, NULL, purple_xfer_get_filename(xfer), |
| 34945 | 423 | (purple_xfer_get_xfer_type(xfer) == PURPLE_XFER_TYPE_RECEIVE), |
|
34333
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
424 | G_CALLBACK(purple_xfer_choose_file_ok_cb), |
|
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
425 | G_CALLBACK(purple_xfer_choose_file_cancel_cb), |
|
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
426 | purple_request_cpar_from_account(purple_xfer_get_account(xfer)), |
|
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
427 | xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
428 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
429 | return 0; |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
430 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
431 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
432 | static int |
| 15884 | 433 | cancel_recv_cb(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
434 | { |
| 15884 | 435 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
| 436 | purple_xfer_request_denied(xfer); | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
437 | g_object_unref(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
438 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
439 | return 0; |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
440 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
441 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
442 | static void |
| 15884 | 443 | purple_xfer_ask_recv(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
444 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
445 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
446 | char *buf, *size_buf; |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
447 | goffset size; |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
448 | gconstpointer thumb; |
|
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
449 | gsize thumb_size; |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
450 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
451 | /* If we have already accepted the request, ask the destination file |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
452 | name directly */ |
| 15884 | 453 | if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) { |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
454 | PurpleRequestCommonParameters *cpar; |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
455 | PurpleBuddy *buddy = purple_blist_find_buddy(priv->account, priv->who); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
456 | |
| 15884 | 457 | if (purple_xfer_get_filename(xfer) != NULL) |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
458 | { |
| 15884 | 459 | size = purple_xfer_get_size(xfer); |
|
39824
aefdb7ab2475
Replace purple_str_size_to_units by g_format_size.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39823
diff
changeset
|
460 | size_buf = g_format_size_full(size, G_FORMAT_SIZE_LONG_FORMAT); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
461 | buf = g_strdup_printf(_("%s wants to send you %s (%s)"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
462 | buddy ? purple_buddy_get_alias(buddy) : priv->who, |
| 15884 | 463 | purple_xfer_get_filename(xfer), size_buf); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
464 | g_free(size_buf); |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
465 | } |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
466 | else |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
467 | { |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
468 | buf = g_strdup_printf(_("%s wants to send you a file"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
469 | buddy ? purple_buddy_get_alias(buddy) : priv->who); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
470 | } |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
471 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
472 | if (priv->message != NULL) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35489
diff
changeset
|
473 | purple_serv_got_im(purple_account_get_connection(priv->account), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
474 | priv->who, priv->message, 0, time(NULL)); |
|
9933
61bd3fadbfe6
[gaim-migrate @ 10825]
Dave West <kat@users.sourceforge.net>
parents:
9932
diff
changeset
|
475 | |
| 34945 | 476 | cpar = purple_request_cpar_from_account(priv->account); |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
477 | if ((thumb = purple_xfer_get_thumbnail(xfer, &thumb_size))) { |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
478 | purple_request_cpar_set_custom_icon(cpar, thumb, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
479 | thumb_size); |
|
27427
00f91afbd4d9
Show thumbnail in ft request dialog
Marcus Lundblad <malu@pidgin.im>
parents:
27419
diff
changeset
|
480 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31154
diff
changeset
|
481 | |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
482 | purple_request_accept_cancel(xfer, NULL, buf, NULL, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
483 | PURPLE_DEFAULT_ACTION_NONE, cpar, xfer, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
484 | G_CALLBACK(purple_xfer_choose_file), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
485 | G_CALLBACK(cancel_recv_cb)); |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
486 | |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
487 | g_free(buf); |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
488 | } else |
| 15884 | 489 | purple_xfer_choose_file(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
490 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
491 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
492 | static int |
| 15884 | 493 | ask_accept_ok(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
494 | { |
| 15884 | 495 | purple_xfer_request_accepted(xfer, NULL); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
496 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
497 | return 0; |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
498 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
499 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
500 | static int |
| 15884 | 501 | ask_accept_cancel(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
502 | { |
| 15884 | 503 | purple_xfer_request_denied(xfer); |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
504 | g_object_unref(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
505 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
506 | return 0; |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
507 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
508 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
509 | static void |
| 15884 | 510 | purple_xfer_ask_accept(PurpleXfer *xfer) |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
511 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
512 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
513 | char *buf, *buf2 = NULL; |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
514 | PurpleBuddy *buddy = purple_blist_find_buddy(priv->account, priv->who); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
515 | |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
516 | buf = g_strdup_printf(_("Accept file transfer request from %s?"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
517 | buddy ? purple_buddy_get_alias(buddy) : priv->who); |
| 15884 | 518 | if (purple_xfer_get_remote_ip(xfer) && |
| 519 | purple_xfer_get_remote_port(xfer)) | |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
520 | buf2 = g_strdup_printf(_("A file is available for download from:\n" |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
521 | "Remote host: %s\nRemote port: %d"), |
| 15884 | 522 | purple_xfer_get_remote_ip(xfer), |
| 523 | purple_xfer_get_remote_port(xfer)); | |
| 524 | purple_request_accept_cancel(xfer, NULL, buf, buf2, | |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
525 | PURPLE_DEFAULT_ACTION_NONE, |
| 34945 | 526 | purple_request_cpar_from_account(priv->account), xfer, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34305
diff
changeset
|
527 | G_CALLBACK(ask_accept_ok), G_CALLBACK(ask_accept_cancel)); |
|
9511
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
528 | g_free(buf); |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
529 | g_free(buf2); |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
530 | } |
|
d68f99136f26
[gaim-migrate @ 10338]
Mark Doliner <markdoliner@pidgin.im>
parents:
8585
diff
changeset
|
531 | |
| 7805 | 532 | void |
| 15884 | 533 | purple_xfer_request(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
534 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
535 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
536 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
537 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
538 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
539 | /* this is unref'd in the finishers, like cancel and stop */ |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
540 | g_object_ref(xfer); |
|
4247
a77b46afa096
[gaim-migrate @ 4497]
Christian Hammond <chipx86@chipx86.com>
parents:
4245
diff
changeset
|
541 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
542 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
543 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
544 | if (priv->type == PURPLE_XFER_TYPE_RECEIVE) |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
545 | { |
| 15884 | 546 | purple_signal_emit(purple_xfers_get_handle(), "file-recv-request", xfer); |
| 547 | if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) | |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
548 | { |
|
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
549 | /* The file-transfer was cancelled by a plugin */ |
| 15884 | 550 | purple_xfer_cancel_local(xfer); |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
551 | } |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
552 | else if (priv->filename || priv->status == PURPLE_XFER_STATUS_ACCEPTED) |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
553 | { |
|
11084
b6acee973833
[gaim-migrate @ 13103]
Jonathan Clark <ardentlygnarly@users.sourceforge.net>
parents:
10919
diff
changeset
|
554 | gchar* message = NULL; |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
555 | PurpleBuddy *buddy = purple_blist_find_buddy(priv->account, priv->who); |
|
28720
4b63cf19f159
Make it work again, after some new xfer UI ops where added... :)
Marcus Lundblad <malu@pidgin.im>
parents:
28682
diff
changeset
|
556 | |
|
11084
b6acee973833
[gaim-migrate @ 13103]
Jonathan Clark <ardentlygnarly@users.sourceforge.net>
parents:
10919
diff
changeset
|
557 | message = g_strdup_printf(_("%s is offering to send file %s"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
558 | buddy ? purple_buddy_get_alias(buddy) : priv->who, purple_xfer_get_filename(xfer)); |
|
28722
d53c7b4cf1d2
Print the thumbnail along with the offer message in the conversation
Marcus Lundblad <malu@pidgin.im>
parents:
28720
diff
changeset
|
559 | purple_xfer_conversation_write_with_thumbnail(xfer, message); |
|
11084
b6acee973833
[gaim-migrate @ 13103]
Jonathan Clark <ardentlygnarly@users.sourceforge.net>
parents:
10919
diff
changeset
|
560 | g_free(message); |
|
28720
4b63cf19f159
Make it work again, after some new xfer UI ops where added... :)
Marcus Lundblad <malu@pidgin.im>
parents:
28682
diff
changeset
|
561 | |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
562 | /* Ask for a filename to save to if it's not already given by a plugin */ |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
563 | if (priv->local_filename == NULL) |
| 15884 | 564 | purple_xfer_ask_recv(xfer); |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
565 | } |
|
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
566 | else |
|
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
567 | { |
| 15884 | 568 | purple_xfer_ask_accept(xfer); |
|
11084
b6acee973833
[gaim-migrate @ 13103]
Jonathan Clark <ardentlygnarly@users.sourceforge.net>
parents:
10919
diff
changeset
|
569 | } |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
570 | } |
|
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
571 | else |
|
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
572 | { |
| 15884 | 573 | purple_xfer_choose_file(xfer); |
|
13220
4eca54b95034
[gaim-migrate @ 15583]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13109
diff
changeset
|
574 | } |
| 3609 | 575 | } |
| 576 | ||
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
577 | static gboolean |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
578 | do_query_local(PurpleXfer *xfer, const gchar *filename) |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
579 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
580 | GStatBuf st; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
581 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
582 | if (g_stat(filename, &st) == -1) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
583 | purple_xfer_show_file_error(xfer, filename); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
584 | return FALSE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
585 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
586 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
587 | purple_xfer_set_size(xfer, st.st_size); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
588 | return TRUE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
589 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
590 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
591 | void |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
592 | purple_xfer_request_accepted(PurpleXfer *xfer, const gchar *filename) |
| 3609 | 593 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
594 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
595 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
596 | gchar *msg, *utf8, *base; |
| 15884 | 597 | PurpleBuddy *buddy; |
| 3609 | 598 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
599 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
600 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
601 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
602 | priv = purple_xfer_get_instance_private(xfer); |
|
8585
23db71a2d432
[gaim-migrate @ 9335]
Pekka Riikonen <priikone@silcnet.org>
parents:
8351
diff
changeset
|
603 | |
| 29822 | 604 | purple_debug_misc("xfer", "request accepted for %p\n", xfer); |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
605 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
606 | if(filename == NULL) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
607 | if(priv->type == PURPLE_XFER_TYPE_RECEIVE) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
608 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_ACCEPTED); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
609 | klass->init(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
610 | } else { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
611 | purple_debug_warning( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
612 | "xfer", |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
613 | "can not set file transfer without a file name" |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
614 | ); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
615 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
616 | |
| 3609 | 617 | return; |
| 4150 | 618 | } |
| 3609 | 619 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
620 | buddy = purple_blist_find_buddy(priv->account, priv->who); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
621 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
622 | if (priv->type == PURPLE_XFER_TYPE_SEND) { |
|
13595
191c2d12a00c
[gaim-migrate @ 15980]
Mark Doliner <markdoliner@pidgin.im>
parents:
13220
diff
changeset
|
623 | /* Sending a file */ |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
624 | /* Check the filename. */ |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
625 | gboolean query_status; |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
626 | |
| 11934 | 627 | #ifdef _WIN32 |
|
21985
bf0e936998e4
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21682
diff
changeset
|
628 | if (g_strrstr(filename, "../") || g_strrstr(filename, "..\\")) |
| 11934 | 629 | #else |
|
21985
bf0e936998e4
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21682
diff
changeset
|
630 | if (g_strrstr(filename, "../")) |
| 11934 | 631 | #endif |
|
21985
bf0e936998e4
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21682
diff
changeset
|
632 | { |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
633 | utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); |
| 3609 | 634 | |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
635 | msg = g_strdup_printf(_("%s is not a valid filename.\n"), utf8); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
636 | purple_xfer_error(priv->type, priv->account, priv->who, msg); |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
637 | g_free(utf8); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
638 | g_free(msg); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
639 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
640 | g_object_unref(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
641 | return; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
642 | } |
| 3609 | 643 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
644 | g_signal_emit(xfer, signals[SIG_QUERY_LOCAL], 0, filename, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
645 | &query_status); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
646 | if (!query_status) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
647 | g_object_unref(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
648 | return; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
649 | } |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
650 | purple_xfer_set_local_filename(xfer, filename); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
651 | |
|
26726
b81bcec8f359
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26373
diff
changeset
|
652 | base = g_path_get_basename(filename); |
|
b81bcec8f359
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26373
diff
changeset
|
653 | utf8 = g_filename_to_utf8(base, -1, NULL, NULL, NULL); |
|
b81bcec8f359
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26373
diff
changeset
|
654 | g_free(base); |
| 15884 | 655 | purple_xfer_set_filename(xfer, utf8); |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
656 | |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
657 | msg = g_strdup_printf(_("Offering to send %s to %s"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
658 | utf8, buddy ? purple_buddy_get_alias(buddy) : priv->who); |
|
10919
22fba24cd16e
[gaim-migrate @ 12683]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10774
diff
changeset
|
659 | g_free(utf8); |
| 15884 | 660 | purple_xfer_conversation_write(xfer, msg, FALSE); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
661 | g_free(msg); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
662 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
663 | else { |
|
13595
191c2d12a00c
[gaim-migrate @ 15980]
Mark Doliner <markdoliner@pidgin.im>
parents:
13220
diff
changeset
|
664 | /* Receiving a file */ |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
665 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_ACCEPTED); |
| 15884 | 666 | purple_xfer_set_local_filename(xfer, filename); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
667 | |
|
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
668 | msg = g_strdup_printf(_("Starting transfer of %s from %s"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
669 | priv->filename, buddy ? purple_buddy_get_alias(buddy) : priv->who); |
| 15884 | 670 | purple_xfer_conversation_write(xfer, msg, FALSE); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
671 | g_free(msg); |
| 3609 | 672 | } |
| 4150 | 673 | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
674 | purple_xfer_set_visible(xfer, TRUE); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
675 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
676 | klass->init(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
677 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
678 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
679 | void |
| 15884 | 680 | purple_xfer_request_denied(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
681 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
682 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
683 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
684 | g_return_if_fail(PURPLE_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
685 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
686 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
687 | |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
688 | purple_debug_misc("xfer", "xfer %p denied\n", xfer); |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
689 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
690 | if(klass && klass->request_denied) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
691 | klass->request_denied(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
692 | } |
|
5164
dda3bf92f195
[gaim-migrate @ 5528]
Mark Doliner <markdoliner@pidgin.im>
parents:
5146
diff
changeset
|
693 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
694 | g_object_unref(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
695 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
696 | |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
697 | int purple_xfer_get_fd(PurpleXfer *xfer) |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
698 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
699 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
700 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
701 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
702 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
703 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
704 | return priv->fd; |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
705 | } |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
706 | |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
707 | int purple_xfer_get_watcher(PurpleXfer *xfer) |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
708 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
709 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
710 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
711 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
712 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
713 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
714 | return priv->watcher; |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
715 | } |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
716 | |
| 15884 | 717 | PurpleXferType |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
718 | purple_xfer_get_xfer_type(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
719 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
720 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
721 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
722 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), PURPLE_XFER_TYPE_UNKNOWN); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
723 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
724 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
725 | return priv->type; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
726 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
727 | |
| 15884 | 728 | PurpleAccount * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
729 | purple_xfer_get_account(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
730 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
731 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
732 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
733 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
734 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
735 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
736 | return priv->account; |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
737 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
738 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
739 | void |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
740 | purple_xfer_set_remote_user(PurpleXfer *xfer, const char *who) |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
741 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
742 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
743 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
744 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
745 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
746 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
747 | g_free(priv->who); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
748 | priv->who = g_strdup(who); |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
749 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
750 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_REMOTE_USER]); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
751 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
752 | |
|
17852
174c0d122a79
Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17293
diff
changeset
|
753 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
754 | purple_xfer_get_remote_user(PurpleXfer *xfer) |
|
17852
174c0d122a79
Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17293
diff
changeset
|
755 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
756 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
757 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
758 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
759 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
760 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
761 | return priv->who; |
|
17852
174c0d122a79
Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17293
diff
changeset
|
762 | } |
|
174c0d122a79
Add new function purple_xfer_get_remote_user.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17293
diff
changeset
|
763 | |
|
34909
91be147083c6
Started GObjectification of PurpleXfer.
Ankit Vani <a@nevitus.org>
parents:
34892
diff
changeset
|
764 | PurpleXferStatus |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
765 | purple_xfer_get_status(PurpleXfer *xfer) |
| 7805 | 766 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
767 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
768 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
769 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), PURPLE_XFER_STATUS_UNKNOWN); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
770 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
771 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
772 | return priv->status; |
| 7805 | 773 | } |
| 774 | ||
| 775 | gboolean | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
776 | purple_xfer_get_visible(PurpleXfer *xfer) |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
777 | { |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
778 | PurpleXferPrivate *priv = NULL; |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
779 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
780 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), FALSE); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
781 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
782 | priv = purple_xfer_get_instance_private(xfer); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
783 | return priv->visible; |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
784 | } |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
785 | |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
786 | gboolean |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
787 | purple_xfer_is_cancelled(PurpleXfer *xfer) |
| 7738 | 788 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
789 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), TRUE); |
| 7738 | 790 | |
| 15884 | 791 | if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) || |
| 792 | (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE)) | |
| 7805 | 793 | return TRUE; |
| 794 | else | |
| 795 | return FALSE; | |
| 7738 | 796 | } |
| 797 | ||
|
4539
44671e1ce14e
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
798 | gboolean |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
799 | purple_xfer_is_completed(PurpleXfer *xfer) |
|
4539
44671e1ce14e
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
800 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
801 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), TRUE); |
|
4539
44671e1ce14e
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
802 | |
| 15884 | 803 | return (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_DONE); |
|
4539
44671e1ce14e
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
804 | } |
|
44671e1ce14e
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
805 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
806 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
807 | purple_xfer_get_filename(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
808 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
809 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
810 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
811 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
812 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
813 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
814 | return priv->filename; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
815 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
816 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
817 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
818 | purple_xfer_get_local_filename(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
819 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
820 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
821 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
822 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
823 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
824 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
825 | return priv->local_filename; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
826 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
827 | |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
828 | goffset |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
829 | purple_xfer_get_bytes_sent(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
830 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
831 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
832 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
833 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
834 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
835 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
836 | return priv->bytes_sent; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
837 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
838 | |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
839 | goffset |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
840 | purple_xfer_get_bytes_remaining(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
841 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
842 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
843 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
844 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
845 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
846 | priv = purple_xfer_get_instance_private(xfer); |
|
37210
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
847 | return priv->size - priv->bytes_sent; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
848 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
849 | |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
850 | goffset |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
851 | purple_xfer_get_size(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
852 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
853 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
854 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
855 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
856 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
857 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
858 | return priv->size; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
859 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
860 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
861 | double |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
862 | purple_xfer_get_progress(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
863 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
864 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0.0); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
865 | |
| 15884 | 866 | if (purple_xfer_get_size(xfer) == 0) |
|
4517
998c580f7f56
[gaim-migrate @ 4795]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
867 | return 0.0; |
|
998c580f7f56
[gaim-migrate @ 4795]
Christian Hammond <chipx86@chipx86.com>
parents:
4514
diff
changeset
|
868 | |
| 15884 | 869 | return ((double)purple_xfer_get_bytes_sent(xfer) / |
| 870 | (double)purple_xfer_get_size(xfer)); | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
871 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
872 | |
|
34457
a9d3726c3a8f
Clang warnings: clean up libpurple
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
873 | guint16 |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
874 | purple_xfer_get_local_port(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
875 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
876 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
877 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
878 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), -1); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
879 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
880 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
881 | return priv->local_port; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
882 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
883 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
884 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
885 | purple_xfer_get_remote_ip(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
886 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
887 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
888 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
889 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
890 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
891 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
892 | return priv->remote_ip; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
893 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
894 | |
|
34457
a9d3726c3a8f
Clang warnings: clean up libpurple
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
895 | guint16 |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
896 | purple_xfer_get_remote_port(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
897 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
898 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
899 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
900 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), -1); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
901 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
902 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
903 | return priv->remote_port; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
904 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
905 | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
906 | gint64 |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
907 | purple_xfer_get_start_time(PurpleXfer *xfer) |
|
22338
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
908 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
909 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
910 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
911 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
912 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
913 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
914 | return priv->start_time; |
|
22338
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
915 | } |
|
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
916 | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
917 | gint64 |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
918 | purple_xfer_get_end_time(PurpleXfer *xfer) |
|
22338
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
919 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
920 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
921 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
922 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
923 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
924 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
925 | return priv->end_time; |
|
22338
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
926 | } |
|
d6a489105624
Add accessor and update finch to not touch the internals of PurpleXfer.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22194
diff
changeset
|
927 | |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
928 | void purple_xfer_set_fd(PurpleXfer *xfer, int fd) |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
929 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
930 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
931 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
932 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
933 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
934 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
935 | priv->fd = fd; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
936 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
937 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_FD]); |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
938 | } |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
939 | |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
940 | void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher) |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
941 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
942 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
943 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
944 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
945 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
946 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
947 | priv->watcher = watcher; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
948 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
949 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_WATCHER]); |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
950 | } |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
951 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
952 | void |
| 15884 | 953 | purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) |
| 4538 | 954 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
955 | PurpleXferPrivate *priv = NULL; |
|
4656
b676f986e7e3
[gaim-migrate @ 4967]
Mark Doliner <markdoliner@pidgin.im>
parents:
4634
diff
changeset
|
956 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
957 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
958 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
959 | priv = purple_xfer_get_instance_private(xfer); |
| 4538 | 960 | |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
961 | if (completed == TRUE) { |
|
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
962 | char *msg = NULL; |
|
40885
87f6241da196
Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents:
40804
diff
changeset
|
963 | PurpleConversation *im; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
964 | PurpleConversationManager *manager; |
|
27655
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
965 | |
| 15884 | 966 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_DONE); |
|
4656
b676f986e7e3
[gaim-migrate @ 4967]
Mark Doliner <markdoliner@pidgin.im>
parents:
4634
diff
changeset
|
967 | |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
968 | if(purple_xfer_get_filename(xfer) != NULL) { |
|
27655
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
969 | char *filename = g_markup_escape_text(purple_xfer_get_filename(xfer), -1); |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
970 | if (purple_xfer_get_local_filename(xfer) |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
971 | && purple_xfer_get_xfer_type(xfer) == PURPLE_XFER_TYPE_RECEIVE) |
|
27655
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
972 | { |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
973 | char *local = g_markup_escape_text(purple_xfer_get_local_filename(xfer), -1); |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
974 | msg = g_strdup_printf(_("Transfer of file <A HREF=\"file://%s\">%s</A> complete"), |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
975 | local, filename); |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
976 | g_free(local); |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
977 | } |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
978 | else |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
979 | msg = g_strdup_printf(_("Transfer of file %s complete"), |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
980 | filename); |
|
162b561fad5e
Link-ify the filename when writing the "Transfer is complete" message to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26726
diff
changeset
|
981 | g_free(filename); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
982 | } else { |
|
25359
ea172b7ea601
The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <datallah@pidgin.im>
parents:
24672
diff
changeset
|
983 | msg = g_strdup(_("File transfer complete")); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
984 | } |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
985 | |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
986 | manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
987 | im = purple_conversation_manager_find_im(manager, priv->account, |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
988 | priv->who); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
989 | if(PURPLE_IS_IM_CONVERSATION(im)) { |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40885
diff
changeset
|
990 | purple_conversation_write_system_message(im, msg, 0); |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
991 | } |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
992 | g_free(msg); |
|
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
993 | } |
|
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
994 | |
|
40255
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
995 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_PROGRESS]); |
| 4538 | 996 | } |
| 997 | ||
| 998 | void | |
| 15884 | 999 | purple_xfer_set_message(PurpleXfer *xfer, const char *message) |
|
9933
61bd3fadbfe6
[gaim-migrate @ 10825]
Dave West <kat@users.sourceforge.net>
parents:
9932
diff
changeset
|
1000 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1001 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1002 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1003 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1004 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1005 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1006 | |
| 38358 | 1007 | if (message != priv->message) { |
| 1008 | g_free(priv->message); | |
| 1009 | priv->message = g_strdup(message); | |
| 38254 | 1010 | } |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
1011 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1012 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_MESSAGE]); |
|
9933
61bd3fadbfe6
[gaim-migrate @ 10825]
Dave West <kat@users.sourceforge.net>
parents:
9932
diff
changeset
|
1013 | } |
|
61bd3fadbfe6
[gaim-migrate @ 10825]
Dave West <kat@users.sourceforge.net>
parents:
9932
diff
changeset
|
1014 | |
|
34927
cef809309dbf
Fixed libpurple build errors, and added purple_xfer_get_message()
Ankit Vani <a@nevitus.org>
parents:
34926
diff
changeset
|
1015 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1016 | purple_xfer_get_message(PurpleXfer *xfer) |
|
34927
cef809309dbf
Fixed libpurple build errors, and added purple_xfer_get_message()
Ankit Vani <a@nevitus.org>
parents:
34926
diff
changeset
|
1017 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1018 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1019 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1020 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1021 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1022 | priv = purple_xfer_get_instance_private(xfer); |
|
34927
cef809309dbf
Fixed libpurple build errors, and added purple_xfer_get_message()
Ankit Vani <a@nevitus.org>
parents:
34926
diff
changeset
|
1023 | return priv->message; |
|
cef809309dbf
Fixed libpurple build errors, and added purple_xfer_get_message()
Ankit Vani <a@nevitus.org>
parents:
34926
diff
changeset
|
1024 | } |
|
cef809309dbf
Fixed libpurple build errors, and added purple_xfer_get_message()
Ankit Vani <a@nevitus.org>
parents:
34926
diff
changeset
|
1025 | |
|
9933
61bd3fadbfe6
[gaim-migrate @ 10825]
Dave West <kat@users.sourceforge.net>
parents:
9932
diff
changeset
|
1026 | void |
| 15884 | 1027 | purple_xfer_set_filename(PurpleXfer *xfer, const char *filename) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1028 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1029 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1030 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1031 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1032 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1033 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1034 | |
| 38358 | 1035 | if (filename != priv->filename) { |
| 1036 | g_free(priv->filename); | |
| 1037 | priv->filename = g_strdup(filename); | |
| 38254 | 1038 | } |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
1039 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1040 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_FILENAME]); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1041 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1042 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1043 | void |
| 15884 | 1044 | purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1045 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1046 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1047 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1048 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1049 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1050 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1051 | |
| 38358 | 1052 | if (filename != priv->local_filename) { |
| 1053 | g_free(priv->local_filename); | |
| 1054 | priv->local_filename = g_strdup(filename); | |
| 38254 | 1055 | } |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
1056 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1057 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_LOCAL_FILENAME]); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1058 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1059 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1060 | void |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
1061 | purple_xfer_set_size(PurpleXfer *xfer, goffset size) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1062 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1063 | PurpleXferPrivate *priv = NULL; |
|
40262
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1064 | GObject *obj; |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1065 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1066 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1067 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1068 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1069 | priv->size = size; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
1070 | |
|
40262
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1071 | obj = G_OBJECT(xfer); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1072 | g_object_freeze_notify(obj); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1073 | g_object_notify_by_pspec(obj, properties[PROP_FILE_SIZE]); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1074 | g_object_notify_by_pspec(obj, properties[PROP_PROGRESS]); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1075 | g_object_thaw_notify(obj); |
|
15322
cd268e368bc1
[gaim-migrate @ 18050]
Mark Doliner <markdoliner@pidgin.im>
parents:
15280
diff
changeset
|
1076 | } |
| 4538 | 1077 | |
|
15322
cd268e368bc1
[gaim-migrate @ 18050]
Mark Doliner <markdoliner@pidgin.im>
parents:
15280
diff
changeset
|
1078 | void |
|
34457
a9d3726c3a8f
Clang warnings: clean up libpurple
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
1079 | purple_xfer_set_local_port(PurpleXfer *xfer, guint16 local_port) |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
1080 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1081 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1082 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1083 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1084 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1085 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1086 | priv->local_port = local_port; |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
35001
diff
changeset
|
1087 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1088 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_LOCAL_PORT]); |
|
32289
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
1089 | } |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
1090 | |
|
8c121b654972
Add some get/set functions to help hidding _PrupleXfer.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32256
diff
changeset
|
1091 | void |
|
32663
1b87b3e98b0a
Upgrade PurpleXfer for a 64-bit world.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32608
diff
changeset
|
1092 | purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent) |
|
15322
cd268e368bc1
[gaim-migrate @ 18050]
Mark Doliner <markdoliner@pidgin.im>
parents:
15280
diff
changeset
|
1093 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1094 | PurpleXferPrivate *priv = NULL; |
|
40262
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1095 | GObject *obj; |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1096 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1097 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1098 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1099 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1100 | priv->bytes_sent = bytes_sent; |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1101 | |
|
40262
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1102 | obj = G_OBJECT(xfer); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1103 | g_object_freeze_notify(obj); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1104 | g_object_notify_by_pspec(obj, properties[PROP_BYTES_SENT]); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1105 | g_object_notify_by_pspec(obj, properties[PROP_PROGRESS]); |
|
47129af2bd5e
Add freezes around multi-notifies in xfers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40261
diff
changeset
|
1106 | g_object_thaw_notify(obj); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1107 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1108 | |
| 15884 | 1109 | PurpleXferUiOps * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1110 | purple_xfer_get_ui_ops(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1111 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1112 | PurpleXferPrivate *priv = NULL; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1113 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1114 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1115 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39775
diff
changeset
|
1116 | priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1117 | return priv->ui_ops; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1118 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1119 | |
|
15280
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1120 | static void |
| 15884 | 1121 | purple_xfer_increase_buffer_size(PurpleXfer *xfer) |
|
15280
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1122 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1123 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1124 | |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1125 | priv->current_buffer_size = MIN(priv->current_buffer_size * 1.5, |
|
15280
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1126 | FT_MAX_BUFFER_SIZE); |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1127 | } |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1128 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1129 | static gssize |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1130 | do_read(PurpleXfer *xfer, guchar **buffer, gsize size) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1131 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1132 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1133 | gssize r; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1134 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1135 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
6240
0390b27fe09d
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1136 | g_return_val_if_fail(buffer != NULL, 0); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1137 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1138 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1139 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1140 | *buffer = g_malloc0(size); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1141 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1142 | r = read(priv->fd, *buffer, size); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1143 | if (r < 0 && errno == EAGAIN) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1144 | r = 0; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1145 | } else if (r < 0) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1146 | r = -1; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1147 | } else if (r == 0) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1148 | r = -1; |
|
26373
105e5b66e8da
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@pidgin.im>
parents:
25359
diff
changeset
|
1149 | } |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1150 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1151 | return r; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1152 | } |
| 3609 | 1153 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1154 | gssize |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1155 | purple_xfer_read(PurpleXfer *xfer, guchar **buffer) |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1156 | { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1157 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1158 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1159 | gsize s; |
|
39670
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1160 | gssize r; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1161 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1162 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1163 | g_return_val_if_fail(buffer != NULL, 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1164 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1165 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1166 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1167 | if (purple_xfer_get_size(xfer) == 0) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1168 | s = priv->current_buffer_size; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1169 | } else { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1170 | s = MIN( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1171 | (gssize)purple_xfer_get_bytes_remaining(xfer), |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1172 | (gssize)priv->current_buffer_size |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1173 | ); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1174 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1175 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1176 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1177 | if(klass && klass->read) { |
|
39670
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1178 | r = klass->read(xfer, buffer, s); |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1179 | } else { |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1180 | r = do_read(xfer, buffer, s); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1181 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1182 | |
|
39670
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1183 | if (r >= 0 && (gsize)r == priv->current_buffer_size) { |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1184 | /* |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1185 | * We managed to read the entire buffer. This means our |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1186 | * network is fast and our buffer is too small, so make it |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1187 | * bigger. |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1188 | */ |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1189 | purple_xfer_increase_buffer_size(xfer); |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1190 | } |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1191 | |
|
8d95b195ce69
Cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents:
39669
diff
changeset
|
1192 | return r; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1193 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1194 | |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1195 | static gssize |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1196 | do_write(PurpleXfer *xfer, const guchar *buffer, gsize size) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1197 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1198 | PurpleXferPrivate *priv = NULL; |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1199 | gssize r; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1200 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1201 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
6240
0390b27fe09d
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1202 | g_return_val_if_fail(buffer != NULL, 0); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1203 | g_return_val_if_fail(size != 0, 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1204 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1205 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1206 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1207 | r = write(priv->fd, buffer, size); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1208 | if (r < 0 && errno == EAGAIN) |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1209 | r = 0; |
| 3609 | 1210 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1211 | return r; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1212 | } |
| 3609 | 1213 | |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1214 | gssize |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1215 | purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size) |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1216 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1217 | PurpleXferClass *klass = NULL; |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1218 | gssize s; |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1219 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1220 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1221 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1222 | s = MIN( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1223 | (gssize)purple_xfer_get_bytes_remaining(xfer), |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1224 | (gssize)size |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1225 | ); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1226 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1227 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1228 | if(klass && klass->write) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1229 | return klass->write(xfer, buffer, s); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1230 | } |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1231 | |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1232 | return do_write(xfer, buffer, s); |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1233 | } |
|
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1234 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1235 | static gssize |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1236 | do_write_local(PurpleXfer *xfer, const guchar *buffer, gssize size) |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1237 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1238 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1239 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1240 | if (priv->dest_fp == NULL) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1241 | purple_debug_error("xfer", "File is not opened for writing"); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1242 | return -1; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1243 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1244 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1245 | return fwrite(buffer, 1, size, priv->dest_fp); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1246 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1247 | |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1248 | gboolean |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1249 | purple_xfer_write_file(PurpleXfer *xfer, const guchar *buffer, gsize size) |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1250 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1251 | PurpleXferPrivate *priv = NULL; |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1252 | gsize wc; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1253 | goffset remaining; |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1254 | gboolean fs_known; |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1255 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1256 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), FALSE); |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1257 | g_return_val_if_fail(buffer != NULL, FALSE); |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1258 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1259 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1260 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1261 | fs_known = (priv->size > 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1262 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1263 | remaining = purple_xfer_get_bytes_remaining(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1264 | if (fs_known && (goffset)size > remaining) { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35115
diff
changeset
|
1265 | purple_debug_warning("xfer", |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1266 | "Got too much data (truncating at %" G_GOFFSET_FORMAT |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1267 | ").\n", purple_xfer_get_size(xfer)); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1268 | size = remaining; |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1269 | } |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1270 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1271 | g_signal_emit(xfer, signals[SIG_WRITE_LOCAL], 0, buffer, size, &wc); |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1272 | |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1273 | if (wc != size) { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35115
diff
changeset
|
1274 | purple_debug_error("xfer", |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1275 | "Unable to write whole buffer.\n"); |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1276 | purple_xfer_cancel_local(xfer); |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1277 | return FALSE; |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1278 | } |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1279 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1280 | purple_xfer_set_bytes_sent( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1281 | xfer, |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1282 | purple_xfer_get_bytes_sent(xfer) + size |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1283 | ); |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1284 | |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1285 | return TRUE; |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1286 | } |
|
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1287 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1288 | static gssize |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1289 | do_read_local(PurpleXfer *xfer, guchar *buffer, gssize size) |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1290 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1291 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1292 | gssize got_len; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1293 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1294 | if (priv->dest_fp == NULL) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1295 | purple_debug_error("xfer", "File is not opened for reading"); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1296 | return -1; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1297 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1298 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1299 | got_len = fread(buffer, 1, size, priv->dest_fp); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1300 | if ((got_len < 0 || got_len != size) && ferror(priv->dest_fp)) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1301 | purple_debug_error("xfer", "Unable to read file."); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1302 | return -1; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1303 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1304 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1305 | return got_len; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1306 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1307 | |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1308 | gssize |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1309 | purple_xfer_read_file(PurpleXfer *xfer, guchar *buffer, gsize size) |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1310 | { |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1311 | gssize got_len; |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1312 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1313 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1314 | g_return_val_if_fail(buffer != NULL, 0); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1315 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1316 | g_signal_emit(xfer, signals[SIG_READ_LOCAL], 0, buffer, size, &got_len); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1317 | if (got_len < 0 || got_len > size) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1318 | purple_debug_error("xfer", "Unable to read file."); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1319 | purple_xfer_cancel_local(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1320 | return -1; |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1321 | } |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1322 | |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1323 | if (got_len > 0) { |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1324 | purple_xfer_set_bytes_sent(xfer, |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1325 | purple_xfer_get_bytes_sent(xfer) + got_len); |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1326 | } |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1327 | |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1328 | return got_len; |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1329 | } |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1330 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1331 | static gboolean |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1332 | do_data_not_sent(PurpleXfer *xfer, const guchar *buffer, gsize size) |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1333 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1334 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1335 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1336 | if (priv->buffer == NULL) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1337 | priv->buffer = g_byte_array_sized_new(FT_INITIAL_BUFFER_SIZE); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1338 | g_byte_array_append(priv->buffer, buffer, size); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1339 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1340 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1341 | return TRUE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1342 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1343 | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1344 | static void |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1345 | do_transfer(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1346 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1347 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
11159
76ef02141bcb
[gaim-migrate @ 13246]
Mark Doliner <markdoliner@pidgin.im>
parents:
11084
diff
changeset
|
1348 | guchar *buffer = NULL; |
|
12151
8002bb57756b
[gaim-migrate @ 14452]
Richard Laager <rlaager@pidgin.im>
parents:
11934
diff
changeset
|
1349 | gssize r = 0; |
| 3609 | 1350 | |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
1351 | if (priv->type == PURPLE_XFER_TYPE_RECEIVE) { |
| 15884 | 1352 | r = purple_xfer_read(xfer, &buffer); |
| 8316 | 1353 | if (r > 0) { |
|
34272
8df870b218ca
HTTP: chop off another HTTP implementation (for xmpp oob file transfers)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33940
diff
changeset
|
1354 | if (!purple_xfer_write_file(xfer, buffer, r)) { |
|
28076
796f5a14f70b
Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <darkrain42@pidgin.im>
parents:
27993
diff
changeset
|
1355 | g_free(buffer); |
|
22194
3e48f2d3d083
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@pidgin.im>
parents:
21985
diff
changeset
|
1356 | return; |
|
3e48f2d3d083
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@pidgin.im>
parents:
21985
diff
changeset
|
1357 | } |
|
28180
782b27dceaf7
ft: Set completion (for receiving) *after* writing the file.
Paul Aurich <darkrain42@pidgin.im>
parents:
28159
diff
changeset
|
1358 | |
|
17293
2b7fbca58d92
Fix file transfers aborting and mistakenly being marked as cancelled when they are actually complete. Fixes #814
Daniel Atallah <datallah@pidgin.im>
parents:
17089
diff
changeset
|
1359 | } else if(r < 0) { |
| 15884 | 1360 | purple_xfer_cancel_remote(xfer); |
|
28076
796f5a14f70b
Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <darkrain42@pidgin.im>
parents:
27993
diff
changeset
|
1361 | g_free(buffer); |
| 8316 | 1362 | return; |
|
13109
c5801934af5c
[gaim-migrate @ 15470]
Daniel Atallah <datallah@pidgin.im>
parents:
13108
diff
changeset
|
1363 | } |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
1364 | } else if (priv->type == PURPLE_XFER_TYPE_SEND) { |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1365 | gssize result = 0; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1366 | gsize s = MIN( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1367 | (gsize)purple_xfer_get_bytes_remaining(xfer), |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1368 | (gsize)priv->current_buffer_size |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1369 | ); |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1370 | gboolean read_more = TRUE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1371 | gboolean existing_buffer = FALSE; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1372 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1373 | /* this is so the protocol can keep the connection open |
| 8351 | 1374 | if it needs to for some odd reason. */ |
| 1375 | if (s == 0) { | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1376 | if (priv->watcher) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1377 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1378 | purple_xfer_set_watcher(xfer, 0); |
| 8351 | 1379 | } |
| 1380 | return; | |
| 1381 | } | |
| 1382 | ||
|
29821
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1383 | if (priv->buffer) { |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1384 | existing_buffer = TRUE; |
|
29821
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1385 | if (priv->buffer->len < s) { |
|
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1386 | s -= priv->buffer->len; |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1387 | read_more = TRUE; |
|
29821
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1388 | } else { |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1389 | read_more = FALSE; |
|
29821
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1390 | } |
|
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1391 | } |
|
8c85f494737a
ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.
Paul Aurich <darkrain42@pidgin.im>
parents:
29820
diff
changeset
|
1392 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1393 | if (read_more) { |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1394 | buffer = g_new(guchar, s); |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1395 | result = purple_xfer_read_file(xfer, buffer, s); |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1396 | if (result == 0) { |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1397 | /* |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1398 | * The UI claimed it was ready, but didn't have any data for |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1399 | * us... It will call purple_xfer_ui_ready when ready, which |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1400 | * sets back up this watcher. |
|
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1401 | */ |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1402 | if (priv->watcher != 0) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1403 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1404 | purple_xfer_set_watcher(xfer, 0); |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1405 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1406 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1407 | /* Need to indicate the protocol is still ready... */ |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
1408 | priv->ready |= PURPLE_XFER_READY_PROTOCOL; |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1409 | |
|
39892
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1410 | g_free(buffer); |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1411 | g_return_if_reached(); |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1412 | } |
|
39892
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1413 | if (result < 0) { |
|
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1414 | g_free(buffer); |
|
34286
8d0979967d05
HTTP: removing extra yahoo HTTP implementations - file transfer (and small improvements to libpurple http and ft code)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34272
diff
changeset
|
1415 | return; |
|
39892
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1416 | } |
|
22194
3e48f2d3d083
Part of a large patch from o_sukhodolsky to fix some build warnings.
Richard Laager <rlaager@pidgin.im>
parents:
21985
diff
changeset
|
1417 | } |
| 29822 | 1418 | |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1419 | if (priv->buffer) { |
|
29968
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1420 | g_byte_array_append(priv->buffer, buffer, result); |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1421 | g_free(buffer); |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1422 | buffer = priv->buffer->data; |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1423 | result = priv->buffer->len; |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1424 | } |
| 29822 | 1425 | |
|
37644
451ed08be0b9
Fix purple_xfer_write() during do_transfer()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37210
diff
changeset
|
1426 | r = do_write(xfer, buffer, result); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1427 | |
| 8231 | 1428 | if (r == -1) { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1429 | purple_debug_error("xfer", "do_write failed! %s\n", g_strerror(errno)); |
| 15884 | 1430 | purple_xfer_cancel_remote(xfer); |
|
29968
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1431 | if (!priv->buffer) |
|
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1432 | /* We don't free buffer if priv->buffer is set, because in |
|
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1433 | that case buffer doesn't belong to us. */ |
|
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1434 | g_free(buffer); |
| 8231 | 1435 | return; |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1436 | } else if (r == result) { |
|
15280
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1437 | /* |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1438 | * We managed to write the entire buffer. This means our |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1439 | * network is fast and our buffer is too small, so make it |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1440 | * bigger. |
|
9df6112da532
[gaim-migrate @ 18008]
Mark Doliner <markdoliner@pidgin.im>
parents:
15161
diff
changeset
|
1441 | */ |
| 15884 | 1442 | purple_xfer_increase_buffer_size(xfer); |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1443 | } else { |
|
40334
3123ce0bafa7
Fix some issues that scanbuild had identified
Gary Kramlich <grim@reaperworld.com>
parents:
40262
diff
changeset
|
1444 | gboolean handler_result = FALSE; |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1445 | g_signal_emit(xfer, signals[SIG_DATA_NOT_SENT], 0, buffer + r, |
|
40334
3123ce0bafa7
Fix some issues that scanbuild had identified
Gary Kramlich <grim@reaperworld.com>
parents:
40262
diff
changeset
|
1446 | result - r, &handler_result); |
|
3123ce0bafa7
Fix some issues that scanbuild had identified
Gary Kramlich <grim@reaperworld.com>
parents:
40262
diff
changeset
|
1447 | if (!handler_result) { |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1448 | purple_xfer_cancel_local(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1449 | } |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1450 | } |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1451 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1452 | if (existing_buffer && priv->buffer) { |
| 29822 | 1453 | /* |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1454 | * Remove what we wrote |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1455 | * If we wrote the whole buffer the byte array will be empty |
|
29968
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1456 | * Otherwise we'll keep what wasn't sent for next time. |
|
29533
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1457 | */ |
|
ca223fea0a1e
Kill off the use of fseek for non-seekable streams in file transfers.
Raouf M. Bencheraiet <foufou33@gmail.com>
parents:
28659
diff
changeset
|
1458 | buffer = NULL; |
|
29968
1bab736e15da
Does anyone know the purpose of the ui_write, ui_read and data_not_sent
Mark Doliner <markdoliner@pidgin.im>
parents:
29822
diff
changeset
|
1459 | g_byte_array_remove_range(priv->buffer, 0, r); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1460 | } |
| 3609 | 1461 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1462 | |
|
13108
9a5cd09fd9cb
[gaim-migrate @ 15469]
Daniel Atallah <datallah@pidgin.im>
parents:
13011
diff
changeset
|
1463 | if (r > 0) { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1464 | PurpleXferClass *klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1465 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1466 | if (klass && klass->ack) |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1467 | klass->ack(xfer, buffer, r); |
|
13108
9a5cd09fd9cb
[gaim-migrate @ 15469]
Daniel Atallah <datallah@pidgin.im>
parents:
13011
diff
changeset
|
1468 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1469 | |
|
39892
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1470 | g_free(buffer); |
|
4fb59abd727e
Fix some static analysis warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39858
diff
changeset
|
1471 | |
|
37210
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1472 | if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer) && |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1473 | !purple_xfer_is_completed(xfer)) { |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1474 | purple_xfer_set_completed(xfer, TRUE); |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1475 | } |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1476 | |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1477 | /* TODO: Check if above is the only place xfers are marked completed. |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1478 | * If so, merge these conditions. |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1479 | */ |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1480 | if (purple_xfer_is_completed(xfer)) { |
| 15884 | 1481 | purple_xfer_end(xfer); |
|
37210
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1482 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1483 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1484 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1485 | static void |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1486 | transfer_cb(gpointer data, gint source, PurpleInputCondition condition) |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1487 | { |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1488 | PurpleXfer *xfer = data; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1489 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1490 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1491 | if (priv->dest_fp == NULL) { |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1492 | /* The UI is moderating its side manually */ |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1493 | if (0 == (priv->ready & PURPLE_XFER_READY_UI)) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
1494 | priv->ready |= PURPLE_XFER_READY_PROTOCOL; |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1495 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1496 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1497 | purple_xfer_set_watcher(xfer, 0); |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
1498 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1499 | purple_debug_misc("xfer", "Protocol is ready on ft %p, waiting for UI\n", xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1500 | return; |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1501 | } |
|
29232
a94f1f9cdcd2
ft: Fix ui_ops->ui_read being called too often (when it's not ready).
Paul Aurich <darkrain42@pidgin.im>
parents:
29168
diff
changeset
|
1502 | |
|
a94f1f9cdcd2
ft: Fix ui_ops->ui_read being called too often (when it's not ready).
Paul Aurich <darkrain42@pidgin.im>
parents:
29168
diff
changeset
|
1503 | priv->ready = PURPLE_XFER_READY_NONE; |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1504 | } |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1505 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1506 | do_transfer(xfer); |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1507 | } |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1508 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1509 | static gboolean |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1510 | do_open_local(PurpleXfer *xfer) |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1511 | { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1512 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1513 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1514 | priv->dest_fp = |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1515 | g_fopen(purple_xfer_get_local_filename(xfer), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1516 | priv->type == PURPLE_XFER_TYPE_RECEIVE ? "wb" : "rb"); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1517 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1518 | if (priv->dest_fp == NULL) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1519 | purple_xfer_show_file_error(xfer, purple_xfer_get_local_filename(xfer)); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1520 | return FALSE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1521 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1522 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1523 | if (fseek(priv->dest_fp, priv->bytes_sent, SEEK_SET) != 0) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1524 | purple_debug_error("xfer", "couldn't seek"); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1525 | purple_xfer_show_file_error(xfer, purple_xfer_get_local_filename(xfer)); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1526 | return FALSE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1527 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1528 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1529 | return TRUE; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1530 | } |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1531 | |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1532 | static void |
| 15884 | 1533 | begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1534 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1535 | PurpleXferClass *klass = PURPLE_XFER_GET_CLASS(xfer); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1536 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1537 | gboolean open_status = FALSE; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1538 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1539 | if (priv->start_time != 0) { |
|
30832
e5075db65f9a
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1540 | purple_debug_error("xfer", "Transfer is being started multiple times\n"); |
|
e5075db65f9a
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1541 | g_return_if_reached(); |
|
e5075db65f9a
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1542 | } |
|
e5075db65f9a
Beginning a file transfer multiple times leaks file handles.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1543 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1544 | g_signal_emit(xfer, signals[SIG_OPEN_LOCAL], 0, &open_status); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1545 | if (!open_status) { |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
1546 | purple_xfer_cancel_local(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1547 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1548 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1549 | if (priv->fd != -1) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1550 | purple_xfer_set_watcher( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1551 | xfer, |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1552 | purple_input_add(priv->fd, cond, transfer_cb, xfer) |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1553 | ); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1554 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1555 | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
1556 | priv->start_time = g_get_monotonic_time(); |
|
13599
b6369e541654
[gaim-migrate @ 15984]
Mark Doliner <markdoliner@pidgin.im>
parents:
13595
diff
changeset
|
1557 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1558 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_START_TIME]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1559 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1560 | if (klass && klass->start) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1561 | klass->start(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1562 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1563 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1564 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1565 | static void |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1566 | connect_cb(GObject *source, GAsyncResult *result, gpointer user_data) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1567 | { |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1568 | PurpleXfer *xfer = PURPLE_XFER(user_data); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1569 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1570 | GSocket *socket; |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1571 | GError *error = NULL; |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1572 | |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1573 | priv->conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source), |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1574 | result, &error); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1575 | if (priv->conn == NULL) { |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1576 | purple_debug_error("xfer", "Unable to connect to destination host: %s", |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1577 | error ? error->message : "unknown error"); |
|
21676
dabfb5216949
Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
1578 | purple_xfer_cancel_local(xfer); |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1579 | g_clear_error(&error); |
|
21676
dabfb5216949
Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
1580 | return; |
|
dabfb5216949
Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
1581 | } |
|
dabfb5216949
Fix #3983 by canceling the file transfer when connecting to the remote host fails.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
1582 | |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1583 | socket = g_socket_connection_get_socket(priv->conn); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1584 | purple_xfer_set_fd(xfer, g_socket_get_fd(socket)); |
| 15884 | 1585 | begin_transfer(xfer, PURPLE_INPUT_READ); |
| 3609 | 1586 | } |
| 1587 | ||
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1588 | void |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1589 | purple_xfer_ui_ready(PurpleXfer *xfer) |
|
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1590 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1591 | PurpleXferPrivate *priv = NULL; |
|
39858
0f2be88d88e4
Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39824
diff
changeset
|
1592 | PurpleInputCondition cond = 0; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1593 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1594 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1595 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1596 | priv = purple_xfer_get_instance_private(xfer); |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1597 | |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1598 | priv->ready |= PURPLE_XFER_READY_UI; |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1599 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
1600 | if (0 == (priv->ready & PURPLE_XFER_READY_PROTOCOL)) { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1601 | purple_debug_misc("xfer", "UI is ready on ft %p, waiting for protocol\n", xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1602 | return; |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
1603 | } |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
1604 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1605 | purple_debug_misc("xfer", "UI (and protocol) ready on ft %p, so proceeding\n", xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1606 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1607 | if (priv->type == PURPLE_XFER_TYPE_SEND) { |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1608 | cond = PURPLE_INPUT_WRITE; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1609 | } else if (priv->type == PURPLE_XFER_TYPE_RECEIVE) { |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1610 | cond = PURPLE_INPUT_READ; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1611 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1612 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1613 | if (priv->watcher == 0 && priv->fd != -1) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1614 | purple_xfer_set_watcher( |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1615 | xfer, |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1616 | purple_input_add(priv->fd, cond, transfer_cb, xfer) |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1617 | ); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1618 | } |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1619 | |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1620 | priv->ready = PURPLE_XFER_READY_NONE; |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1621 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1622 | do_transfer(xfer); |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1623 | } |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1624 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1625 | void |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
1626 | purple_xfer_protocol_ready(PurpleXfer *xfer) |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1627 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1628 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1629 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1630 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1631 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1632 | priv = purple_xfer_get_instance_private(xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1633 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
1634 | priv->ready |= PURPLE_XFER_READY_PROTOCOL; |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1635 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1636 | /* I don't think fwrite/fread are ever *not* ready */ |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1637 | if (priv->dest_fp == NULL && 0 == (priv->ready & PURPLE_XFER_READY_UI)) { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1638 | purple_debug_misc("xfer", "Protocol is ready on ft %p, waiting for UI\n", xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1639 | return; |
|
29168
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
1640 | } |
|
585ce277cad3
ft: Add some useful debug logging.
Paul Aurich <darkrain42@pidgin.im>
parents:
29159
diff
changeset
|
1641 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1642 | purple_debug_misc("xfer", "Protocol (and UI) ready on ft %p, so proceeding\n", xfer); |
|
28156
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1643 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1644 | priv->ready = PURPLE_XFER_READY_NONE; |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1645 | |
|
0a75e2463576
ft: Add infrastructure to allow a prpl to moderate when to send packets.
Paul Aurich <darkrain42@pidgin.im>
parents:
28153
diff
changeset
|
1646 | do_transfer(xfer); |
|
28150
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1647 | } |
|
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1648 | |
|
1213ec1efcf8
ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844.
Jan Kaluza <hanzz.k@gmail.com>
parents:
28076
diff
changeset
|
1649 | void |
|
34457
a9d3726c3a8f
Clang warnings: clean up libpurple
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
1650 | purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1651 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1652 | PurpleXferPrivate *priv = NULL; |
| 15884 | 1653 | PurpleInputCondition cond; |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1654 | GObject *obj; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1655 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1656 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1657 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1658 | priv = purple_xfer_get_instance_private(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1659 | |
| 15884 | 1660 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_STARTED); |
| 7805 | 1661 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1662 | if (priv->type == PURPLE_XFER_TYPE_RECEIVE) { |
| 15884 | 1663 | cond = PURPLE_INPUT_READ; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1664 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1665 | if (ip != NULL) { |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1666 | GSocketClient *client; |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1667 | GError *error = NULL; |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1668 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1669 | priv->remote_ip = g_strdup(ip); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1670 | priv->remote_port = port; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1671 | |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1672 | obj = G_OBJECT(xfer); |
|
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1673 | g_object_freeze_notify(obj); |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1674 | g_object_notify_by_pspec(obj, properties[PROP_REMOTE_IP]); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1675 | g_object_notify_by_pspec(obj, properties[PROP_REMOTE_PORT]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1676 | g_object_thaw_notify(obj); |
|
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1677 | |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1678 | client = purple_gio_socket_client_new(priv->account, &error); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1679 | if (client == NULL) { |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1680 | /* Assume it's a proxy error */ |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1681 | purple_notify_error( |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1682 | NULL, NULL, _("Invalid proxy settings"), error->message, |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1683 | purple_request_cpar_from_account(priv->account)); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1684 | g_clear_error(&error); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1685 | return; |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1686 | } |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1687 | |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1688 | purple_debug_info("xfer", "Attempting connection to %s:%u\n", ip, |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1689 | port); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1690 | |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1691 | g_socket_client_connect_to_host_async(client, ip, port, NULL, |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1692 | connect_cb, xfer); |
|
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
1693 | g_object_unref(client); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1694 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1695 | return; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1696 | } else { |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1697 | purple_xfer_set_fd(xfer, fd); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1698 | } |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1699 | } else { |
| 15884 | 1700 | cond = PURPLE_INPUT_WRITE; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1701 | |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1702 | purple_xfer_set_fd(xfer, fd); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1703 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1704 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1705 | begin_transfer(xfer, cond); |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1706 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1707 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1708 | void |
| 15884 | 1709 | purple_xfer_end(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1710 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1711 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1712 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1713 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1714 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1715 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1716 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1717 | priv = purple_xfer_get_instance_private(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1718 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1719 | /* See if we are actually trying to cancel this. */ |
| 15884 | 1720 | if (!purple_xfer_is_completed(xfer)) { |
| 1721 | purple_xfer_cancel_local(xfer); | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1722 | return; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1723 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1724 | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
1725 | priv->end_time = g_get_monotonic_time(); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1726 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1727 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1728 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1729 | if (klass && klass->end != NULL) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1730 | klass->end(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1731 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1732 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1733 | if (priv->watcher != 0) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1734 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1735 | purple_xfer_set_watcher(xfer, 0); |
|
4521
c67f31cc18f4
[gaim-migrate @ 4799]
Christian Hammond <chipx86@chipx86.com>
parents:
4518
diff
changeset
|
1736 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1737 | |
|
37210
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1738 | if (priv->fd != -1) { |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1739 | if (close(priv->fd)) { |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1740 | purple_debug_error("xfer", "closing file descr in purple_xfer_end() failed: %s", |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1741 | g_strerror(errno)); |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1742 | } |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1743 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1744 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1745 | if (priv->dest_fp != NULL) { |
|
37210
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1746 | if (fclose(priv->dest_fp)) { |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1747 | purple_debug_error("xfer", "closing dest file in purple_xfer_end() failed: %s", |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1748 | g_strerror(errno)); |
|
68004413f6e7
Initial fix of file transfer by removing extra calls to purple_xfer_set_bytes_sent() and purple_xfer_set_completed(). Also, remove needless member bytes_remaining from PurpleXferPrivate. Works reliably for me on XMPP. However, the redundant purple_xfer_set_completed() calls may be relied upon by other protocols. This needs to be tested. Ok'd by elb. Refs #16001
Michael McConville <mmcconville@mykolab.com>
parents:
37193
diff
changeset
|
1749 | } |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1750 | priv->dest_fp = NULL; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1751 | } |
| 7805 | 1752 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
1753 | g_object_unref(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1754 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1755 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1756 | void |
| 15884 | 1757 | purple_xfer_cancel_local(PurpleXfer *xfer) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1758 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1759 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1760 | PurpleXferPrivate *priv = NULL; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
1761 | char *msg = NULL; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1762 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1763 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1764 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1765 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1766 | priv = purple_xfer_get_instance_private(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1767 | |
|
31154
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1768 | /* TODO: We definitely want to close any open request dialogs associated |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1769 | with this transfer. However, in some cases the request dialog might |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1770 | own a reference on the xfer. This happens at least with the "%s wants |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1771 | to send you %s" dialog from purple_xfer_ask_recv(). In these cases |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1772 | the ref count will not be decremented when the request dialog is |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1773 | closed, so the ref count will never reach 0 and the xfer will never |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1774 | be freed. This is a memleak and should be fixed. It's not clear what |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1775 | the correct fix is. Probably requests should have a destroy function |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1776 | that is called when the request is destroyed. But also, ref counting |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1777 | xfer objects makes this code REALLY complicated. An alternate fix is |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1778 | to not ref count and instead just make sure the object still exists |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1779 | when we try to use it. */ |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1780 | purple_request_close_with_handle(xfer); |
|
d285b9000fbe
Apply Mark's specific changes listed below to the 2.7.7 branch.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30832
diff
changeset
|
1781 | |
| 15884 | 1782 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
1783 | priv->end_time = g_get_monotonic_time(); |
| 7738 | 1784 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1785 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1786 | |
| 15884 | 1787 | if (purple_xfer_get_filename(xfer) != NULL) |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1788 | { |
|
27797
10f6bc89044b
Normalize on 'cancelled'
Paul Aurich <darkrain42@pidgin.im>
parents:
27655
diff
changeset
|
1789 | msg = g_strdup_printf(_("You cancelled the transfer of %s"), |
| 15884 | 1790 | purple_xfer_get_filename(xfer)); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1791 | } |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1792 | else |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1793 | { |
|
25359
ea172b7ea601
The remainder of a patch from fqueze to fix some incorrect *printf() function
Daniel Atallah <datallah@pidgin.im>
parents:
24672
diff
changeset
|
1794 | msg = g_strdup(_("File transfer cancelled")); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1795 | } |
| 15884 | 1796 | purple_xfer_conversation_write(xfer, msg, FALSE); |
|
9932
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
1797 | g_free(msg); |
|
5e7cc9975595
[gaim-migrate @ 10824]
Dave West <kat@users.sourceforge.net>
parents:
9805
diff
changeset
|
1798 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1799 | if (priv->type == PURPLE_XFER_TYPE_SEND) |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1800 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1801 | if (klass && klass->cancel_send) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1802 | klass->cancel_send(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1803 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1804 | } else { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1805 | if (klass && klass->cancel_recv) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1806 | klass->cancel_recv(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1807 | } |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1808 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1809 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1810 | if (priv->watcher != 0) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1811 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1812 | purple_xfer_set_watcher(xfer, 0); |
|
4521
c67f31cc18f4
[gaim-migrate @ 4799]
Christian Hammond <chipx86@chipx86.com>
parents:
4518
diff
changeset
|
1813 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1814 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1815 | if (priv->fd != -1) { |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1816 | close(priv->fd); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1817 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1818 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1819 | if (priv->dest_fp != NULL) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1820 | fclose(priv->dest_fp); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1821 | priv->dest_fp = NULL; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1822 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1823 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
1824 | g_object_unref(xfer); |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1825 | } |
|
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1826 | |
|
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1827 | void |
| 15884 | 1828 | purple_xfer_cancel_remote(PurpleXfer *xfer) |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1829 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1830 | PurpleXferClass *klass = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1831 | PurpleXferPrivate *priv = NULL; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10654
diff
changeset
|
1832 | gchar *msg; |
| 15884 | 1833 | PurpleAccount *account; |
| 1834 | PurpleBuddy *buddy; | |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1835 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1836 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1837 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1838 | klass = PURPLE_XFER_GET_CLASS(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1839 | priv = purple_xfer_get_instance_private(xfer); |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1840 | |
| 15884 | 1841 | purple_request_close_with_handle(xfer); |
| 1842 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
1843 | priv->end_time = g_get_monotonic_time(); |
|
9771
42bd06e5b1b3
[gaim-migrate @ 10639]
Dave West <kat@users.sourceforge.net>
parents:
9523
diff
changeset
|
1844 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1845 | g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_END_TIME]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1846 | |
| 15884 | 1847 | account = purple_xfer_get_account(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1848 | buddy = purple_blist_find_buddy(account, priv->who); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
1849 | |
| 15884 | 1850 | if (purple_xfer_get_filename(xfer) != NULL) |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1851 | { |
|
27797
10f6bc89044b
Normalize on 'cancelled'
Paul Aurich <darkrain42@pidgin.im>
parents:
27655
diff
changeset
|
1852 | msg = g_strdup_printf(_("%s cancelled the transfer of %s"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1853 | buddy ? purple_buddy_get_alias(buddy) : priv->who, purple_xfer_get_filename(xfer)); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1854 | } |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1855 | else |
|
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1856 | { |
|
27797
10f6bc89044b
Normalize on 'cancelled'
Paul Aurich <darkrain42@pidgin.im>
parents:
27655
diff
changeset
|
1857 | msg = g_strdup_printf(_("%s cancelled the file transfer"), |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1858 | buddy ? purple_buddy_get_alias(buddy) : priv->who); |
|
10470
1a070302fa8c
[gaim-migrate @ 11752]
Evan Schoenberg <evands@pidgin.im>
parents:
10259
diff
changeset
|
1859 | } |
| 15884 | 1860 | purple_xfer_conversation_write(xfer, msg, TRUE); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1861 | purple_xfer_error(purple_xfer_get_xfer_type(xfer), account, priv->who, msg); |
|
9771
42bd06e5b1b3
[gaim-migrate @ 10639]
Dave West <kat@users.sourceforge.net>
parents:
9523
diff
changeset
|
1862 | g_free(msg); |
|
42bd06e5b1b3
[gaim-migrate @ 10639]
Dave West <kat@users.sourceforge.net>
parents:
9523
diff
changeset
|
1863 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1864 | if (priv->type == PURPLE_XFER_TYPE_SEND) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1865 | if (klass && klass->cancel_send) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1866 | klass->cancel_send(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1867 | } |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1868 | } else if(priv->type == PURPLE_XFER_TYPE_RECEIVE) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1869 | if (klass && klass->cancel_recv) { |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1870 | klass->cancel_recv(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1871 | } |
|
7272
f8335b8f1f1c
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1872 | } |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1873 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1874 | if (priv->watcher != 0) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1875 | purple_input_remove(priv->watcher); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1876 | purple_xfer_set_watcher(xfer, 0); |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1877 | } |
|
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1878 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1879 | if (priv->fd != -1) |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1880 | close(priv->fd); |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1881 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1882 | if (priv->dest_fp != NULL) { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1883 | fclose(priv->dest_fp); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1884 | priv->dest_fp = NULL; |
|
4675
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1885 | } |
|
8e0a7b537ca2
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4656
diff
changeset
|
1886 | |
|
34912
539b7b4d1949
Replaced purple_xfer_{ref|unref} with g_object_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34910
diff
changeset
|
1887 | g_object_unref(xfer); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1888 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1889 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1890 | void |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1891 | purple_xfer_error(PurpleXferType type, PurpleAccount *account, const gchar *who, const gchar *msg) |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1892 | { |
|
39858
0f2be88d88e4
Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39824
diff
changeset
|
1893 | gchar *title = NULL; |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1894 | |
|
6240
0390b27fe09d
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1895 | g_return_if_fail(msg != NULL); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1896 | |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
1897 | if (account) { |
| 15884 | 1898 | PurpleBuddy *buddy; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
1899 | buddy = purple_blist_find_buddy(account, who); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
1900 | if (buddy) |
| 15884 | 1901 | who = purple_buddy_get_alias(buddy); |
|
10654
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
1902 | } |
|
b2dd3be1b087
[gaim-migrate @ 12182]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
1903 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1904 | if (type == PURPLE_XFER_TYPE_SEND) { |
|
11231
1c5968418ca4
[gaim-migrate @ 13371]
Richard Laager <rlaager@pidgin.im>
parents:
11159
diff
changeset
|
1905 | title = g_strdup_printf(_("File transfer to %s failed."), who); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1906 | } else if (type == PURPLE_XFER_TYPE_RECEIVE) { |
|
11231
1c5968418ca4
[gaim-migrate @ 13371]
Richard Laager <rlaager@pidgin.im>
parents:
11159
diff
changeset
|
1907 | title = g_strdup_printf(_("File transfer from %s failed."), who); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1908 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1909 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1910 | purple_notify_error(NULL, NULL, title, msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1911 | purple_request_cpar_from_account(account)); |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1912 | |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1913 | g_free(title); |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1914 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
1915 | |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
1916 | gconstpointer |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1917 | purple_xfer_get_thumbnail(PurpleXfer *xfer, gsize *len) |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1918 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1919 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1920 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1921 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1922 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1923 | priv = purple_xfer_get_instance_private(xfer); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1924 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1925 | if (len) { |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
1926 | *len = priv->thumbnail_size; |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1927 | } |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1928 | |
|
30126
f09ecb81212c
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
1929 | return priv->thumbnail_data; |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1930 | } |
|
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1931 | |
|
30113
f60cbf3b3ca9
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <malu@pidgin.im>
parents:
29846
diff
changeset
|
1932 | const gchar * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1933 | purple_xfer_get_thumbnail_mimetype(PurpleXfer *xfer) |
|
30113
f60cbf3b3ca9
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <malu@pidgin.im>
parents:
29846
diff
changeset
|
1934 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1935 | PurpleXferPrivate *priv = NULL; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1936 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1937 | g_return_val_if_fail(PURPLE_IS_XFER(xfer), NULL); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1938 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1939 | priv = purple_xfer_get_instance_private(xfer); |
|
30115
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
1940 | |
|
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
1941 | return priv->thumbnail_mimetype; |
|
30113
f60cbf3b3ca9
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <malu@pidgin.im>
parents:
29846
diff
changeset
|
1942 | } |
|
f60cbf3b3ca9
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <malu@pidgin.im>
parents:
29846
diff
changeset
|
1943 | |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1944 | void |
|
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1945 | purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, |
|
30113
f60cbf3b3ca9
Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <malu@pidgin.im>
parents:
29846
diff
changeset
|
1946 | gsize size, const gchar *mimetype) |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1947 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1948 | PurpleXferPrivate *priv = NULL; |
|
38368
61f85dabe64e
libpurple/xfer.c: Silence warnings in purple_xfer_set_thumbnail()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1949 | gpointer old_thumbnail_data; |
|
61f85dabe64e
libpurple/xfer.c: Silence warnings in purple_xfer_set_thumbnail()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1950 | gchar *old_mimetype; |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1951 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1952 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1953 | |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1954 | priv = purple_xfer_get_instance_private(xfer); |
|
30115
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
1955 | |
| 38254 | 1956 | /* Hold onto these in case they are equal to passed-in pointers */ |
|
38368
61f85dabe64e
libpurple/xfer.c: Silence warnings in purple_xfer_set_thumbnail()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1957 | old_thumbnail_data = priv->thumbnail_data; |
|
61f85dabe64e
libpurple/xfer.c: Silence warnings in purple_xfer_set_thumbnail()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1958 | old_mimetype = priv->thumbnail_mimetype; |
|
30124
e84a06d70326
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30123
diff
changeset
|
1959 | |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1960 | if (thumbnail && size > 0) { |
|
40756
3a58ef28ee44
Implement mitigation for GHSL-2021-045
Gary Kramlich <grim@reaperworld.com>
parents:
40648
diff
changeset
|
1961 | priv->thumbnail_data = g_memdup2(thumbnail, size); |
|
30115
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
1962 | priv->thumbnail_size = size; |
|
619d2b5758c0
Hide the thumbnail-related stuff from the PurpleXfer struct to
Marcus Lundblad <malu@pidgin.im>
parents:
30114
diff
changeset
|
1963 | priv->thumbnail_mimetype = g_strdup(mimetype); |
|
30124
e84a06d70326
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30123
diff
changeset
|
1964 | } else { |
|
e84a06d70326
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30123
diff
changeset
|
1965 | priv->thumbnail_data = NULL; |
|
e84a06d70326
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30123
diff
changeset
|
1966 | priv->thumbnail_size = 0; |
|
e84a06d70326
Minor cleanup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30123
diff
changeset
|
1967 | priv->thumbnail_mimetype = NULL; |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1968 | } |
| 38254 | 1969 | |
| 1970 | /* Now it's safe to free the pointers */ | |
| 1971 | g_free(old_thumbnail_data); | |
| 1972 | g_free(old_mimetype); | |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1973 | } |
|
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1974 | |
|
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1975 | void |
|
30114
8472e53fbbfc
Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <malu@pidgin.im>
parents:
30113
diff
changeset
|
1976 | purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1977 | { |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1978 | g_return_if_fail(PURPLE_IS_XFER(xfer)); |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
1979 | |
|
40257
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
1980 | g_signal_emit(xfer, signals[SIG_ADD_THUMBNAIL], 0, formats, NULL); |
|
27419
5cdc131e86a2
Added a skeleton for functions to set and get a thumbnail image associated
Marcus Lundblad <malu@pidgin.im>
parents:
26726
diff
changeset
|
1981 | } |
|
8585
23db71a2d432
[gaim-migrate @ 9335]
Pekka Riikonen <priikone@silcnet.org>
parents:
8351
diff
changeset
|
1982 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1983 | /************************************************************************** |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1984 | * GObject code |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
1985 | **************************************************************************/ |
| 34925 | 1986 | static void |
| 1987 | purple_xfer_set_property(GObject *obj, guint param_id, const GValue *value, | |
| 1988 | GParamSpec *pspec) | |
| 1989 | { | |
| 1990 | PurpleXfer *xfer = PURPLE_XFER(obj); | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1991 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
| 34925 | 1992 | |
| 1993 | switch (param_id) { | |
| 1994 | case PROP_TYPE: | |
| 1995 | priv->type = g_value_get_enum(value); | |
| 1996 | break; | |
| 1997 | case PROP_ACCOUNT: | |
| 1998 | priv->account = g_value_get_object(value); | |
| 1999 | break; | |
| 2000 | case PROP_REMOTE_USER: | |
| 2001 | purple_xfer_set_remote_user(xfer, g_value_get_string(value)); | |
| 2002 | break; | |
| 2003 | case PROP_MESSAGE: | |
| 2004 | purple_xfer_set_message(xfer, g_value_get_string(value)); | |
| 2005 | break; | |
| 2006 | case PROP_FILENAME: | |
| 2007 | purple_xfer_set_filename(xfer, g_value_get_string(value)); | |
| 2008 | break; | |
| 2009 | case PROP_LOCAL_FILENAME: | |
| 2010 | purple_xfer_set_local_filename(xfer, g_value_get_string(value)); | |
| 2011 | break; | |
| 2012 | case PROP_FILE_SIZE: | |
| 2013 | purple_xfer_set_size(xfer, g_value_get_int64(value)); | |
| 2014 | break; | |
| 2015 | case PROP_LOCAL_PORT: | |
| 2016 | purple_xfer_set_local_port(xfer, g_value_get_int(value)); | |
| 2017 | break; | |
| 2018 | case PROP_FD: | |
| 2019 | purple_xfer_set_fd(xfer, g_value_get_int(value)); | |
| 2020 | break; | |
| 2021 | case PROP_WATCHER: | |
| 2022 | purple_xfer_set_watcher(xfer, g_value_get_int(value)); | |
| 2023 | break; | |
| 2024 | case PROP_BYTES_SENT: | |
| 2025 | purple_xfer_set_bytes_sent(xfer, g_value_get_int64(value)); | |
| 2026 | break; | |
| 2027 | case PROP_STATUS: | |
| 2028 | purple_xfer_set_status(xfer, g_value_get_enum(value)); | |
| 2029 | break; | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2030 | case PROP_VISIBLE: |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2031 | purple_xfer_set_visible(xfer, g_value_get_boolean(value)); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2032 | break; |
| 34925 | 2033 | default: |
| 2034 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); | |
| 2035 | break; | |
| 2036 | } | |
| 2037 | } | |
| 2038 | ||
| 2039 | static void | |
| 2040 | purple_xfer_get_property(GObject *obj, guint param_id, GValue *value, | |
| 2041 | GParamSpec *pspec) | |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2042 | { |
| 34925 | 2043 | PurpleXfer *xfer = PURPLE_XFER(obj); |
| 2044 | ||
| 2045 | switch (param_id) { | |
| 2046 | case PROP_TYPE: | |
| 2047 | g_value_set_enum(value, purple_xfer_get_xfer_type(xfer)); | |
| 2048 | break; | |
| 2049 | case PROP_ACCOUNT: | |
| 2050 | g_value_set_object(value, purple_xfer_get_account(xfer)); | |
| 2051 | break; | |
| 2052 | case PROP_REMOTE_USER: | |
| 2053 | g_value_set_string(value, purple_xfer_get_remote_user(xfer)); | |
| 2054 | break; | |
| 2055 | case PROP_MESSAGE: | |
| 2056 | g_value_set_string(value, purple_xfer_get_message(xfer)); | |
| 2057 | break; | |
| 2058 | case PROP_FILENAME: | |
| 2059 | g_value_set_string(value, purple_xfer_get_filename(xfer)); | |
| 2060 | break; | |
| 2061 | case PROP_LOCAL_FILENAME: | |
| 2062 | g_value_set_string(value, purple_xfer_get_local_filename(xfer)); | |
| 2063 | break; | |
| 2064 | case PROP_FILE_SIZE: | |
| 2065 | g_value_set_int64(value, purple_xfer_get_size(xfer)); | |
| 2066 | break; | |
| 2067 | case PROP_REMOTE_IP: | |
| 2068 | g_value_set_string(value, purple_xfer_get_remote_ip(xfer)); | |
| 2069 | break; | |
| 2070 | case PROP_LOCAL_PORT: | |
| 2071 | g_value_set_int(value, purple_xfer_get_local_port(xfer)); | |
| 2072 | break; | |
| 2073 | case PROP_REMOTE_PORT: | |
| 2074 | g_value_set_int(value, purple_xfer_get_remote_port(xfer)); | |
| 2075 | break; | |
| 2076 | case PROP_FD: | |
| 2077 | g_value_set_int(value, purple_xfer_get_fd(xfer)); | |
| 2078 | break; | |
| 2079 | case PROP_WATCHER: | |
| 2080 | g_value_set_int(value, purple_xfer_get_watcher(xfer)); | |
| 2081 | break; | |
| 2082 | case PROP_BYTES_SENT: | |
| 2083 | g_value_set_int64(value, purple_xfer_get_bytes_sent(xfer)); | |
| 2084 | break; | |
| 2085 | case PROP_START_TIME: | |
| 2086 | g_value_set_int64(value, purple_xfer_get_start_time(xfer)); | |
| 2087 | break; | |
| 2088 | case PROP_END_TIME: | |
| 2089 | g_value_set_int64(value, purple_xfer_get_end_time(xfer)); | |
| 2090 | break; | |
| 2091 | case PROP_STATUS: | |
| 2092 | g_value_set_enum(value, purple_xfer_get_status(xfer)); | |
| 2093 | break; | |
|
40255
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2094 | case PROP_PROGRESS: |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2095 | g_value_set_double(value, purple_xfer_get_progress(xfer)); |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2096 | break; |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2097 | case PROP_VISIBLE: |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2098 | g_value_set_boolean(value, purple_xfer_get_visible(xfer)); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2099 | break; |
| 34925 | 2100 | default: |
| 2101 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); | |
| 2102 | break; | |
| 2103 | } | |
| 2104 | } | |
| 2105 | ||
| 2106 | static void | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
2107 | purple_xfer_init(PurpleXfer *xfer) |
| 34925 | 2108 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
2109 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
| 34925 | 2110 | |
| 2111 | priv->ui_ops = purple_xfers_get_ui_ops(); | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2112 | priv->current_buffer_size = FT_INITIAL_BUFFER_SIZE; |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2113 | priv->fd = -1; |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2114 | priv->ready = PURPLE_XFER_READY_NONE; |
| 34925 | 2115 | } |
| 2116 | ||
| 2117 | static void | |
| 2118 | purple_xfer_constructed(GObject *object) | |
| 2119 | { | |
| 2120 | PurpleXfer *xfer = PURPLE_XFER(object); | |
| 2121 | PurpleXferUiOps *ui_ops; | |
| 2122 | ||
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
2123 | G_OBJECT_CLASS(purple_xfer_parent_class)->constructed(object); |
| 34925 | 2124 | |
| 2125 | ui_ops = purple_xfers_get_ui_ops(); | |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2126 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2127 | if (ui_ops != NULL && ui_ops->new_xfer != NULL) { |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2128 | ui_ops->new_xfer(xfer); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2129 | } |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2130 | |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2131 | xfers = g_list_prepend(xfers, xfer); |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2132 | } |
|
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2133 | |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2134 | static void |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
2135 | purple_xfer_finalize(GObject *object) |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2136 | { |
| 34925 | 2137 | PurpleXfer *xfer = PURPLE_XFER(object); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
2138 | PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2139 | |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2140 | /* Close the file browser, if it's open */ |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2141 | purple_request_close_with_handle(xfer); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2142 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2143 | if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_STARTED) { |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2144 | purple_xfer_cancel_local(xfer); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2145 | } |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2146 | |
| 34925 | 2147 | xfers = g_list_remove(xfers, xfer); |
| 2148 | ||
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2149 | g_free(priv->who); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2150 | g_free(priv->filename); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2151 | g_free(priv->remote_ip); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2152 | g_free(priv->local_filename); |
|
40648
d575d71dcc56
Convert proxy code in xfer to gio.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40441
diff
changeset
|
2153 | g_clear_object(&priv->conn); |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2154 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2155 | if (priv->buffer) { |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2156 | g_byte_array_free(priv->buffer, TRUE); |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2157 | } |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2158 | |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2159 | g_free(priv->thumbnail_data); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2160 | g_free(priv->thumbnail_mimetype); |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2161 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
2162 | G_OBJECT_CLASS(purple_xfer_parent_class)->finalize(object); |
| 34925 | 2163 | } |
| 2164 | ||
| 2165 | /* Class initializer function */ | |
| 2166 | static void | |
| 2167 | purple_xfer_class_init(PurpleXferClass *klass) | |
| 2168 | { | |
| 2169 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); | |
| 2170 | ||
| 2171 | obj_class->finalize = purple_xfer_finalize; | |
| 2172 | obj_class->constructed = purple_xfer_constructed; | |
| 2173 | obj_class->get_property = purple_xfer_get_property; | |
| 2174 | obj_class->set_property = purple_xfer_set_property; | |
| 2175 | ||
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2176 | klass->write = do_write; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2177 | klass->read = do_read; |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2178 | |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2179 | klass->open_local = do_open_local; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2180 | klass->query_local = do_query_local; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2181 | klass->read_local = do_read_local; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2182 | klass->write_local = do_write_local; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2183 | klass->data_not_sent = do_data_not_sent; |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2184 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2185 | /* Properties */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2186 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2187 | properties[PROP_TYPE] = g_param_spec_enum("type", "Transfer type", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2188 | "The type of file transfer.", PURPLE_TYPE_XFER_TYPE, |
|
34926
c5b444d1447d
Changed prefix of PurpleXferType enums to PURPLE_XFER_TYPE_*
Ankit Vani <a@nevitus.org>
parents:
34925
diff
changeset
|
2189 | PURPLE_XFER_TYPE_UNKNOWN, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
2190 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2191 | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2192 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2193 | properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2194 | "The account sending or receiving the file.", |
| 34925 | 2195 | PURPLE_TYPE_ACCOUNT, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
2196 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2197 | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2198 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2199 | properties[PROP_REMOTE_USER] = g_param_spec_string("remote-user", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2200 | "Remote user", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2201 | "The name of the remote user.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2202 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2203 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2204 | properties[PROP_MESSAGE] = g_param_spec_string("message", "Message", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2205 | "The message for the file transfer.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2206 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2207 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2208 | properties[PROP_FILENAME] = g_param_spec_string("filename", "Filename", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2209 | "The filename for the file transfer.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2210 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2211 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2212 | properties[PROP_LOCAL_FILENAME] = g_param_spec_string("local-filename", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2213 | "Local filename", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2214 | "The local filename for the file transfer.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2215 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2216 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2217 | properties[PROP_FILE_SIZE] = g_param_spec_int64("file-size", "File size", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2218 | "Size of the file in a file transfer.", |
| 34925 | 2219 | G_MININT64, G_MAXINT64, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2220 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2221 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2222 | properties[PROP_REMOTE_IP] = g_param_spec_string("remote-ip", "Remote IP", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2223 | "The remote IP address in the file transfer.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2224 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2225 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2226 | properties[PROP_LOCAL_PORT] = g_param_spec_int("local-port", "Local port", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2227 | "The local port number in the file transfer.", |
| 34925 | 2228 | G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2229 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2230 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2231 | properties[PROP_REMOTE_PORT] = g_param_spec_int("remote-port", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2232 | "Remote port", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2233 | "The remote port number in the file transfer.", |
| 34925 | 2234 | G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2235 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2236 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2237 | properties[PROP_FD] = g_param_spec_int("fd", "Socket FD", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2238 | "The socket file descriptor.", |
| 34925 | 2239 | G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2240 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2241 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2242 | properties[PROP_WATCHER] = g_param_spec_int("watcher", "Watcher", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2243 | "The watcher for the file transfer.", |
| 34925 | 2244 | G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2245 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2246 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2247 | properties[PROP_BYTES_SENT] = g_param_spec_int64("bytes-sent", "Bytes sent", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2248 | "The number of bytes sent (or received) so far.", |
| 34925 | 2249 | G_MININT64, G_MAXINT64, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2250 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2251 | |
|
39823
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2252 | properties[PROP_START_TIME] = g_param_spec_int64( |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2253 | "start-time", "Start time", |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2254 | "The monotonic time the transfer of a file started.", |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2255 | G_MININT64, G_MAXINT64, 0, |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2256 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2257 | |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2258 | properties[PROP_END_TIME] = g_param_spec_int64( |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2259 | "end-time", "End time", |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2260 | "The monotonic time the transfer of a file ended.", G_MININT64, |
|
36acf9e724a5
Convert file transfer times to monotonic clock.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39782
diff
changeset
|
2261 | G_MAXINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2262 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2263 | properties[PROP_STATUS] = g_param_spec_enum("status", "Status", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35029
diff
changeset
|
2264 | "The current status for the file transfer.", |
| 34925 | 2265 | PURPLE_TYPE_XFER_STATUS, PURPLE_XFER_STATUS_UNKNOWN, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
2266 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
2267 | |
|
40255
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2268 | properties[PROP_PROGRESS] = g_param_spec_double( |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2269 | "progress", "Progress", |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2270 | "The current progress of the file transfer.", -1.0, 1.0, -1.0, |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2271 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
42922708e18e
Replace PurpleXferUiOps.update_progress by PurpleXfer.progress.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40254
diff
changeset
|
2272 | |
|
40260
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2273 | properties[PROP_VISIBLE] = g_param_spec_boolean( |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2274 | "visible", "Visible", |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2275 | "Hint for UIs whether this transfer should be visible.", FALSE, |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2276 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
663b8a40dad5
Change PurpleXferUiOps.add_xfer to PurpleXfer:visible property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40258
diff
changeset
|
2277 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
2278 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
40253
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2279 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2280 | /* Signals */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2281 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2282 | /** |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2283 | * PurpleXfer::open-local: |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2284 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2285 | * Open a file locally for a file transfer. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2286 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2287 | * The default class handler will open a file using standard library |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2288 | * functions. If you connect to this signal, you should connect to |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2289 | * PurpleXfer::query-local, PurpleXfer::read-local, PurpleXfer::write-local |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2290 | * and PurpleXfer::data-not-sent as well. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2291 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2292 | * Returns: %TRUE if the file was opened successfully, or %FALSE otherwise, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2293 | * and the transfer should be cancelled (libpurple will cancel). |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2294 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2295 | * Since: 3.0.0 |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2296 | */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2297 | signals[SIG_OPEN_LOCAL] = g_signal_new( |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2298 | "open-local", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2299 | G_STRUCT_OFFSET(PurpleXferClass, open_local), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2300 | g_signal_accumulator_first_wins, NULL, NULL, G_TYPE_BOOLEAN, 0); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2301 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2302 | /** |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2303 | * PurpleXfer::query-local: |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2304 | * @filename: The filename of the transfer. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2305 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2306 | * Query a file's properties locally. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2307 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2308 | * The default class handler will query a file using standard library |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2309 | * functions, and set the transfer's size. If you connect to this signal, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2310 | * you should try to do the same, but it is not necessarily an error if you |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2311 | * cannot. If you connect to this signal, you must connect to |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2312 | * PurpleXfer::open-local, PurpleXfer::read-local, PurpleXfer::write-local |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2313 | * and PurpleXfer::data-not-sent as well. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2314 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2315 | * Returns: %TRUE if the properties were queried successfully, or %FALSE |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2316 | * otherwise, and the transfer should be cancelled (libpurple will |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2317 | * cancel). |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2318 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2319 | * Since: 3.0.0 |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2320 | */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2321 | signals[SIG_QUERY_LOCAL] = g_signal_new( |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2322 | "query-local", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2323 | G_STRUCT_OFFSET(PurpleXferClass, query_local), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2324 | g_signal_accumulator_first_wins, NULL, NULL, G_TYPE_BOOLEAN, 1, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2325 | G_TYPE_STRING); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2326 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2327 | /** |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2328 | * PurpleXfer::read-local: |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2329 | * @buffer: (out): A pointer to a buffer to fill. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2330 | * @size: The maximum amount of data to put in the buffer. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2331 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2332 | * Read data locally to send to the protocol for a file transfer. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2333 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2334 | * The default class handler will read from a file using standard library |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2335 | * functions. If you connect to this signal, you must connect to |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2336 | * PurpleXfer::open-local, PurpleXfer::query-local, PurpleXfer::write-local |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2337 | * and PurpleXfer::data-not-sent as well. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2338 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2339 | * Returns: The amount of data in the buffer, 0 if nothing is available, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2340 | * and a negative value if an error occurred and the transfer |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2341 | * should be cancelled (libpurple will cancel). |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2342 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2343 | * Since: 3.0.0 |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2344 | */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2345 | signals[SIG_READ_LOCAL] = g_signal_new( |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2346 | "read-local", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2347 | G_STRUCT_OFFSET(PurpleXferClass, read_local), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2348 | g_signal_accumulator_first_wins, NULL, NULL, G_TYPE_LONG, 2, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2349 | G_TYPE_POINTER, G_TYPE_LONG); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2350 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2351 | /** |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2352 | * PurpleXfer::write-local: |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2353 | * @buffer: The buffer to write. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2354 | * @size: The size of the buffer. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2355 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2356 | * Write data received from the protocol locally. The signal handler must |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2357 | * deal with the entire buffer and return size, or it is treated as an |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2358 | * error. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2359 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2360 | * The default class handler will write to a file using standard library |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2361 | * functions. If you connect to this signal, you must connect to |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2362 | * PurpleXfer::open-local, PurpleXfer::query-local, PurpleXfer::read-local |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2363 | * and PurpleXfer::data-not-sent as well. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2364 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2365 | * Returns: @size if the write was successful, or a value between 0 and |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2366 | * @size on error. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2367 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2368 | * Since: 3.0.0 |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2369 | */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2370 | signals[SIG_WRITE_LOCAL] = g_signal_new( |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2371 | "write-local", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2372 | G_STRUCT_OFFSET(PurpleXferClass, write_local), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2373 | g_signal_accumulator_first_wins, NULL, NULL, G_TYPE_LONG, 2, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2374 | G_TYPE_POINTER, G_TYPE_LONG); |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2375 | |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2376 | /** |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2377 | * PurpleXfer::data-not-sent: |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2378 | * @buffer: A pointer to the beginning of the unwritten data. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2379 | * @size: The amount of unwritten data. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2380 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2381 | * Notify the UI that not all the data read in was written. The UI should |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2382 | * re-enqueue this data and return it the next time read is called. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2383 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2384 | * If you connect to this signal, you must connect to |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2385 | * PurpleXfer::open-local, PurpleXfer::query-local, PurpleXfer::read-local |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2386 | * and PurpleXfer::write-local as well. |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2387 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2388 | * Returns: %TRUE if the data was re-enqueued successfully, or %FALSE |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2389 | * otherwise, and the transfer should be cancelled (libpurple |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2390 | * will cancel). |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2391 | * |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2392 | * Since: 3.0.0 |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2393 | */ |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2394 | signals[SIG_DATA_NOT_SENT] = g_signal_new( |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2395 | "data-not-sent", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2396 | G_STRUCT_OFFSET(PurpleXferClass, data_not_sent), |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2397 | g_signal_accumulator_first_wins, NULL, NULL, G_TYPE_BOOLEAN, 2, |
|
7f38c3cc5c91
Convert xfer I/O operations from UI ops to signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40195
diff
changeset
|
2398 | G_TYPE_POINTER, G_TYPE_ULONG); |
|
40257
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2399 | |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2400 | /** |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2401 | * PurpleXfer::add-thumbnail: |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2402 | * @formats: A comma-separated string of allowed image formats. |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2403 | * |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2404 | * Request that a thumbnail be added to a file transfer. |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2405 | * |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2406 | * Since: 3.0.0 |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2407 | */ |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2408 | signals[SIG_ADD_THUMBNAIL] = g_signal_new( |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2409 | "add-thumbnail", G_TYPE_FROM_CLASS(klass), G_SIGNAL_ACTION, 0, NULL, |
|
e6692de3b4de
Convert PurpleXferUiOps.add_thumbnail to a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40256
diff
changeset
|
2410 | NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING); |
| 34925 | 2411 | } |
| 2412 | ||
| 2413 | PurpleXfer * | |
| 2414 | purple_xfer_new(PurpleAccount *account, PurpleXferType type, const char *who) | |
| 2415 | { | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2416 | PurpleXfer *xfer; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2417 | PurpleProtocol *protocol; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2418 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
2419 | g_return_val_if_fail(type != PURPLE_XFER_TYPE_UNKNOWN, NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
2420 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
2421 | g_return_val_if_fail(who != NULL, NULL); |
| 34925 | 2422 | |
|
40804
5496016b3c00
Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents:
40756
diff
changeset
|
2423 | protocol = purple_account_get_protocol(account); |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2424 | if (PURPLE_IS_PROTOCOL_XFER(protocol)) { |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2425 | PurpleConnection *connection = purple_account_get_connection(account); |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2426 | |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2427 | xfer = purple_protocol_xfer_new_xfer( |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2428 | PURPLE_PROTOCOL_XFER(protocol), |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2429 | connection, |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2430 | /* TODO: this should support the type */ |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2431 | who |
|
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2432 | ); |
|
38847
6b3d5359cb93
Remove some trailing whitespace and commented code
Gary Kramlich <grim@reaperworld.com>
parents:
38842
diff
changeset
|
2433 | } else { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2434 | xfer = g_object_new(PURPLE_TYPE_XFER, |
| 36872 | 2435 | "account", account, |
| 2436 | "type", type, | |
| 2437 | "remote-user", who, | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2438 | NULL |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2439 | ); |
|
38842
98227c37cd17
start implement the _new_xfer test, stopping here as there a lot more auxiliary work that needs to be done to make it work
Gary Kramlich <grim@reaperworld.com>
parents:
38840
diff
changeset
|
2440 | } |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2441 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36715
diff
changeset
|
2442 | return xfer; |
|
34792
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2443 | } |
|
09228ea79272
Added GBoxed to certificate, certificate pool, xfer, log
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
2444 | |
|
6263
6fec763a314c
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6242
diff
changeset
|
2445 | /************************************************************************** |
|
6fec763a314c
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6242
diff
changeset
|
2446 | * File Transfer Subsystem API |
|
6fec763a314c
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6242
diff
changeset
|
2447 | **************************************************************************/ |
|
34922
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2448 | GList * |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2449 | purple_xfers_get_all() |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2450 | { |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2451 | return xfers; |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2452 | } |
|
6043d2b7f55a
Started GObjectification of xfer.c
Ankit Vani <a@nevitus.org>
parents:
34919
diff
changeset
|
2453 | |
|
11281
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2454 | void * |
| 15884 | 2455 | purple_xfers_get_handle(void) { |
|
11281
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2456 | static int handle = 0; |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2457 | |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2458 | return &handle; |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2459 | } |
|
6241
34d166a31152
[gaim-migrate @ 6735]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
2460 | |
|
34d166a31152
[gaim-migrate @ 6735]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
2461 | void |
| 15884 | 2462 | purple_xfers_init(void) { |
| 2463 | void *handle = purple_xfers_get_handle(); | |
|
11281
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2464 | |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2465 | /* register signals */ |
| 15884 | 2466 | purple_signal_register(handle, "file-recv-request", |
|
34818
a65e961e1e29
Refactored core, ft, imgstore to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
2467 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
a65e961e1e29
Refactored core, ft, imgstore to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34798
diff
changeset
|
2468 | PURPLE_TYPE_XFER); |
|
11281
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2469 | } |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2470 | |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2471 | void |
|
21143
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2472 | purple_xfers_uninit(void) |
|
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2473 | { |
|
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2474 | void *handle = purple_xfers_get_handle(); |
|
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2475 | |
|
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2476 | purple_signals_disconnect_by_handle(handle); |
|
239b2f43bef5
Make purple_xfers_uninit, purple_network_uninit, and purple_plugins_uninit
Etan Reisner <deryni@pidgin.im>
parents:
20661
diff
changeset
|
2477 | purple_signals_unregister_by_instance(handle); |
|
11281
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2478 | } |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2479 | |
|
a5cda37a16be
[gaim-migrate @ 13478]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11231
diff
changeset
|
2480 | void |
| 15884 | 2481 | purple_xfers_set_ui_ops(PurpleXferUiOps *ops) { |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2482 | xfer_ui_ops = ops; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2483 | } |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2484 | |
| 15884 | 2485 | PurpleXferUiOps * |
| 2486 | purple_xfers_get_ui_ops(void) { | |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2487 | return xfer_ui_ops; |
|
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4249
diff
changeset
|
2488 | } |
| 35572 | 2489 | |
| 2490 | /************************************************************************** | |
| 2491 | * GBoxed code | |
| 2492 | **************************************************************************/ | |
| 2493 | static PurpleXferUiOps * | |
| 2494 | purple_xfer_ui_ops_copy(PurpleXferUiOps *ops) | |
| 2495 | { | |
| 2496 | PurpleXferUiOps *ops_new; | |
| 2497 | ||
| 2498 | g_return_val_if_fail(ops != NULL, NULL); | |
| 2499 | ||
| 2500 | ops_new = g_new(PurpleXferUiOps, 1); | |
| 2501 | *ops_new = *ops; | |
| 2502 | ||
| 2503 | return ops_new; | |
| 2504 | } | |
| 2505 | ||
| 2506 | GType | |
| 2507 | purple_xfer_ui_ops_get_type(void) | |
| 2508 | { | |
| 2509 | static GType type = 0; | |
| 2510 | ||
| 2511 | if (type == 0) { | |
| 2512 | type = g_boxed_type_register_static("PurpleXferUiOps", | |
| 2513 | (GBoxedCopyFunc)purple_xfer_ui_ops_copy, | |
|
35597
7fcfcf147b99
Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents:
35574
diff
changeset
|
2514 | (GBoxedFreeFunc)g_free); |
| 35572 | 2515 | } |
| 2516 | ||
| 2517 | return type; | |
| 2518 | } | |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2519 | |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2520 | /************************************************************************** |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2521 | * PurpleXferProtocolInterface |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2522 | **************************************************************************/ |
|
41024
a2ad2d034162
Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41007
diff
changeset
|
2523 | G_DEFINE_INTERFACE(PurpleProtocolXfer, purple_protocol_xfer, |
|
a2ad2d034162
Set the prereq type for all Protocol interfaces to PurpleProtocol
Gary Kramlich <grim@reaperworld.com>
parents:
41007
diff
changeset
|
2524 | PURPLE_TYPE_PROTOCOL) |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2525 | |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2526 | static void |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2527 | purple_protocol_xfer_default_init(PurpleProtocolXferInterface *face) { |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2528 | } |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2529 | |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2530 | gboolean |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2531 | purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer, |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2532 | PurpleConnection *connection, |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2533 | const gchar *who |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2534 | ) { |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2535 | PurpleProtocolXferInterface *iface = NULL; |
|
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2536 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2537 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer), FALSE); |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2538 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), FALSE); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2539 | g_return_val_if_fail(who, FALSE); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2540 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2541 | iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer); |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2542 | if(iface && iface->can_receive) |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2543 | return iface->can_receive(prplxfer, connection, who); |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2544 | |
|
39669
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2545 | /* If the PurpleProtocolXfer doesn't implement this function, we assume |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2546 | * there are no conditions where we can't send a file to the given user. |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2547 | */ |
|
bab07ecb9330
Make PurpleXfer a derivable type and create subclasses in all the protocols that support file transfers
Gary Kramlich <grim@reaperworld.com>
parents:
39380
diff
changeset
|
2548 | return TRUE; |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2549 | } |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2550 | |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2551 | void |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2552 | purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer, |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2553 | PurpleConnection *connection, |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2554 | const gchar *who, |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2555 | const gchar *filename |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2556 | ) { |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2557 | PurpleProtocolXferInterface *iface = NULL; |
|
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2558 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2559 | g_return_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer)); |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2560 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2561 | g_return_if_fail(who); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2562 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2563 | iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer); |
|
39005
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2564 | if(iface && iface->send_file) |
|
6a56e1366809
xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38847
diff
changeset
|
2565 | iface->send_file(prplxfer, connection, who, filename); |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2566 | } |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2567 | |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2568 | PurpleXfer * |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2569 | purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer, |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2570 | PurpleConnection *connection, |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2571 | const gchar *who |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2572 | ) { |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2573 | PurpleProtocolXferInterface *iface = NULL; |
|
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2574 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2575 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer), FALSE); |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2576 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), FALSE); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2577 | g_return_val_if_fail(who, FALSE); |
|
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2578 | |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2579 | iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer); |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2580 | if(iface && iface->new_xfer) |
|
38840
33326576c72b
Fix the argument names so there's no confusion
Gary Kramlich <grim@reaperworld.com>
parents:
38834
diff
changeset
|
2581 | return iface->new_xfer(prplxfer, connection, who); |
|
38834
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2582 | |
|
e4144efa975e
Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents:
38828
diff
changeset
|
2583 | return NULL; |
|
38827
3573c82d32d8
Initial attempt at removing the magic around PurpleProtocolXferInterface
Gary Kramlich <grim@reaperworld.com>
parents:
38368
diff
changeset
|
2584 | } |