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