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