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