Mon, 13 Jul 2009 05:01:42 +0000
On MSN, pop up an "invite message" request similar to oscar, and send that
in the add request. We really should try and move this into the add buddy
dialog instead of an extra prompt.
Fixes #8503.
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple_ft.c |
| 8849 | 4 | |
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
7 | Copyright (C) 2004 - 2007 Pekka Riikonen |
| 8849 | 8 | |
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
20 | #include "silc.h" |
| 8849 | 21 | #include "silcclient.h" |
| 15884 | 22 | #include "silcpurple.h" |
| 8849 | 23 | |
| 24 | /****************************** File Transfer ********************************/ | |
| 25 | ||
| 26 | /* This implements the secure file transfer protocol (SFTP) using the SILC | |
| 27 | SFTP library implementation. The API we use from the SILC Toolkit is the | |
| 28 | SILC Client file transfer API, as it provides a simple file transfer we | |
| 29 | need in this case. We could use the SILC SFTP API directly, but it would | |
| 30 | be an overkill since we'd effectively re-implement the file transfer what | |
| 31 | the SILC Client's file transfer API already provides. | |
| 32 | ||
| 15884 | 33 | From Purple we do NOT use the FT API to do the transfer as it is very limiting. |
| 8849 | 34 | In fact it does not suite to file transfers like SFTP at all. For example, |
| 35 | it assumes that read operations are synchronous what they are not in SFTP. | |
| 15884 | 36 | It also assumes that the file transfer socket is to be handled by the Purple |
| 8849 | 37 | eventloop, and this naturally is something we don't want to do in case of |
| 38 | SILC Toolkit. The FT API suites well to purely stream based file transfers | |
| 39 | like HTTP GET and similar. | |
| 40 | ||
| 15884 | 41 | For this reason, we directly access the Purple GKT FT API and hack the FT |
| 8849 | 42 | API to merely provide the user interface experience and all the magic |
| 43 | is done in the SILC Toolkit. Ie. we update the statistics information in | |
| 44 | the FT API for user interface, and that's it. A bit dirty but until the | |
| 45 | FT API gets better this is the way to go. Good thing that FT API allowed | |
| 46 | us to do this. */ | |
| 47 | ||
| 48 | typedef struct { | |
| 15884 | 49 | SilcPurple sg; |
| 8849 | 50 | SilcClientEntry client_entry; |
| 51 | SilcUInt32 session_id; | |
| 52 | char *hostname; | |
| 53 | SilcUInt16 port; | |
| 15884 | 54 | PurpleXfer *xfer; |
| 8849 | 55 | |
| 56 | SilcClientFileName completion; | |
| 57 | void *completion_context; | |
| 15884 | 58 | } *SilcPurpleXfer; |
| 8849 | 59 | |
| 60 | static void | |
| 15884 | 61 | silcpurple_ftp_monitor(SilcClient client, |
| 8849 | 62 | SilcClientConnection conn, |
| 63 | SilcClientMonitorStatus status, | |
| 64 | SilcClientFileError error, | |
| 65 | SilcUInt64 offset, | |
| 66 | SilcUInt64 filesize, | |
| 67 | SilcClientEntry client_entry, | |
| 68 | SilcUInt32 session_id, | |
| 69 | const char *filepath, | |
| 70 | void *context) | |
| 71 | { | |
| 15884 | 72 | SilcPurpleXfer xfer = context; |
| 73 | PurpleConnection *gc = xfer->sg->gc; | |
| 8849 | 74 | char tmp[256]; |
| 75 | ||
| 76 | if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
77 | /* All started sessions terminate here */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
78 | xfer->xfer->data = NULL; |
| 15884 | 79 | purple_xfer_unref(xfer->xfer); |
| 8849 | 80 | silc_free(xfer); |
| 81 | return; | |
| 82 | } | |
| 83 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
84 | if (status == SILC_CLIENT_FILE_MONITOR_DISCONNECT) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
85 | purple_notify_error(gc, _("Secure File Transfer"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
86 | _("Error during file transfer"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
87 | _("Remote disconnected")); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
88 | xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
89 | purple_xfer_update_progress(xfer->xfer); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
90 | silc_client_file_close(client, conn, session_id); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
91 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
92 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
93 | |
| 8849 | 94 | if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) |
| 95 | return; | |
| 96 | ||
| 97 | if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { | |
| 98 | if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { | |
| 99 | g_snprintf(tmp, sizeof(tmp), "No such file %s", | |
| 100 | filepath ? filepath : "[N/A]"); | |
| 15884 | 101 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 102 | _("Error during file transfer"), tmp); |
| 103 | } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { | |
| 15884 | 104 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 105 | _("Error during file transfer"), |
| 106 | _("Permission denied")); | |
| 107 | } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { | |
| 15884 | 108 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 109 | _("Error during file transfer"), |
| 110 | _("Key agreement failed")); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
111 | } else if (error == SILC_CLIENT_FILE_TIMEOUT) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
112 | purple_notify_error(gc, _("Secure File Transfer"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
113 | _("Error during file transfer"), |
|
18168
07f5c0108577
Replace "timedout" with "timed out".
Richard Laager <rlaager@pidgin.im>
parents:
17675
diff
changeset
|
114 | _("Connection timed out")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
115 | } else if (error == SILC_CLIENT_FILE_CONNECT_FAILED) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
116 | purple_notify_error(gc, _("Secure File Transfer"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
117 | _("Error during file transfer"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
118 | _("Creating connection failed")); |
| 8849 | 119 | } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { |
| 15884 | 120 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 121 | _("Error during file transfer"), |
|
10254
e7938826d550
[gaim-migrate @ 11394]
Mark Doliner <markdoliner@pidgin.im>
parents:
9788
diff
changeset
|
122 | _("File transfer session does not exist")); |
| 8849 | 123 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
124 | xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
125 | purple_xfer_update_progress(xfer->xfer); |
| 8849 | 126 | silc_client_file_close(client, conn, session_id); |
| 127 | return; | |
| 128 | } | |
| 129 | ||
| 130 | /* Update file transfer UI */ | |
| 131 | if (!offset && filesize) | |
| 15884 | 132 | purple_xfer_set_size(xfer->xfer, filesize); |
| 8849 | 133 | if (offset && filesize) { |
| 134 | xfer->xfer->bytes_sent = offset; | |
| 135 | xfer->xfer->bytes_remaining = filesize - offset; | |
| 136 | } | |
| 15884 | 137 | purple_xfer_update_progress(xfer->xfer); |
| 8849 | 138 | |
| 139 | if (status == SILC_CLIENT_FILE_MONITOR_SEND || | |
| 140 | status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { | |
| 141 | if (offset == filesize) { | |
| 142 | /* Download finished */ | |
| 15884 | 143 | purple_xfer_set_completed(xfer->xfer, TRUE); |
| 8849 | 144 | silc_client_file_close(client, conn, session_id); |
| 145 | } | |
| 146 | } | |
| 147 | } | |
| 148 | ||
| 149 | static void | |
| 15884 | 150 | silcpurple_ftp_cancel(PurpleXfer *x) |
| 8849 | 151 | { |
| 15884 | 152 | SilcPurpleXfer xfer = x->data; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
153 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
154 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
155 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
156 | |
| 15884 | 157 | xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; |
| 158 | purple_xfer_update_progress(xfer->xfer); | |
| 8849 | 159 | silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); |
| 160 | } | |
| 161 | ||
| 162 | static void | |
| 15884 | 163 | silcpurple_ftp_ask_name_cancel(PurpleXfer *x) |
| 8849 | 164 | { |
| 15884 | 165 | SilcPurpleXfer xfer = x->data; |
| 8849 | 166 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
167 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
168 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
169 | |
| 8849 | 170 | /* Cancel the transmission */ |
| 171 | xfer->completion(NULL, xfer->completion_context); | |
| 172 | silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); | |
| 173 | } | |
| 174 | ||
| 175 | static void | |
| 15884 | 176 | silcpurple_ftp_ask_name_ok(PurpleXfer *x) |
| 8849 | 177 | { |
| 15884 | 178 | SilcPurpleXfer xfer = x->data; |
| 8849 | 179 | const char *name; |
| 180 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
181 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
182 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
183 | |
| 15884 | 184 | name = purple_xfer_get_local_filename(x); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10254
diff
changeset
|
185 | g_unlink(name); |
| 8849 | 186 | xfer->completion(name, xfer->completion_context); |
| 187 | } | |
| 188 | ||
| 189 | static void | |
| 15884 | 190 | silcpurple_ftp_ask_name(SilcClient client, |
| 8849 | 191 | SilcClientConnection conn, |
| 192 | SilcUInt32 session_id, | |
| 193 | const char *remote_filename, | |
| 194 | SilcClientFileName completion, | |
| 195 | void *completion_context, | |
| 196 | void *context) | |
| 197 | { | |
| 15884 | 198 | SilcPurpleXfer xfer = context; |
| 8849 | 199 | |
| 200 | xfer->completion = completion; | |
| 201 | xfer->completion_context = completion_context; | |
| 202 | ||
| 15884 | 203 | purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); |
| 204 | purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); | |
| 8849 | 205 | |
| 206 | /* Request to save the file */ | |
| 15884 | 207 | purple_xfer_set_filename(xfer->xfer, remote_filename); |
| 208 | purple_xfer_request(xfer->xfer); | |
| 8849 | 209 | } |
| 210 | ||
| 211 | static void | |
| 15884 | 212 | silcpurple_ftp_request_result(PurpleXfer *x) |
| 8849 | 213 | { |
| 15884 | 214 | SilcPurpleXfer xfer = x->data; |
| 8849 | 215 | SilcClientFileError status; |
| 15884 | 216 | PurpleConnection *gc = xfer->sg->gc; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
217 | SilcClientConnectionParams params; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
218 | gboolean local = xfer->hostname ? FALSE : TRUE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
219 | char *local_ip = NULL, *remote_ip = NULL; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
220 | SilcSocket sock; |
| 8849 | 221 | |
| 15884 | 222 | if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) |
| 8849 | 223 | return; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
224 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
225 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
226 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
227 | silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
228 | &sock, NULL, NULL, NULL); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
229 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
230 | if (local) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
231 | /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
232 | to see if we are behind NAT. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
233 | if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
234 | /* Check if the IP is private */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
235 | if (silcpurple_ip_is_private(local_ip)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
236 | local = TRUE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
237 | /* Local IP is private, resolve the remote server IP to see whether |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
238 | we are talking to Internet or just on LAN. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
239 | if (silc_net_check_host_by_sock(sock, NULL, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
240 | &remote_ip)) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
241 | if (silcpurple_ip_is_private(remote_ip)) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
242 | /* We assume we are in LAN. Let's provide the connection point. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
243 | local = TRUE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
244 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
245 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
246 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
247 | if (local && !local_ip) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
248 | local_ip = silc_net_localip(); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
249 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
250 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
251 | memset(¶ms, 0, sizeof(params)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
252 | params.timeout_secs = 60; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
253 | if (local) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
254 | /* Provide connection point */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
255 | params.local_ip = local_ip; |
| 8849 | 256 | |
| 257 | /* Start the file transfer */ | |
| 258 | status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
259 | ¶ms, xfer->sg->public_key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
260 | xfer->sg->private_key, |
| 15884 | 261 | silcpurple_ftp_monitor, xfer, |
| 8849 | 262 | NULL, xfer->session_id, |
| 15884 | 263 | silcpurple_ftp_ask_name, xfer); |
| 8849 | 264 | switch (status) { |
| 265 | case SILC_CLIENT_FILE_OK: | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
266 | silc_free(local_ip); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
267 | silc_free(remote_ip); |
| 8849 | 268 | return; |
| 269 | break; | |
| 270 | ||
| 271 | case SILC_CLIENT_FILE_UNKNOWN_SESSION: | |
| 15884 | 272 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 273 | _("No file transfer session active"), NULL); |
| 274 | break; | |
| 275 | ||
| 276 | case SILC_CLIENT_FILE_ALREADY_STARTED: | |
| 15884 | 277 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 278 | _("File transfer already started"), NULL); |
| 279 | break; | |
| 280 | ||
| 281 | case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: | |
| 15884 | 282 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 283 | _("Could not perform key agreement for file transfer"), |
| 284 | NULL); | |
| 285 | break; | |
| 286 | ||
| 287 | default: | |
| 15884 | 288 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 289 | _("Could not start the file transfer"), NULL); |
| 290 | break; | |
| 291 | } | |
| 292 | ||
| 293 | /* Error */ | |
| 15884 | 294 | purple_xfer_unref(xfer->xfer); |
| 8849 | 295 | g_free(xfer->hostname); |
| 296 | silc_free(xfer); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
297 | silc_free(local_ip); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
298 | silc_free(remote_ip); |
| 8849 | 299 | } |
| 300 | ||
| 301 | static void | |
| 15884 | 302 | silcpurple_ftp_request_denied(PurpleXfer *x) |
| 8849 | 303 | { |
| 304 | ||
| 305 | } | |
| 306 | ||
| 15884 | 307 | void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
308 | SilcClientEntry client_entry, SilcUInt32 session_id, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
309 | const char *hostname, SilcUInt16 port) |
| 8849 | 310 | { |
| 15884 | 311 | PurpleConnection *gc = client->application; |
| 312 | SilcPurple sg = gc->proto_data; | |
| 313 | SilcPurpleXfer xfer; | |
| 8849 | 314 | |
| 315 | xfer = silc_calloc(1, sizeof(*xfer)); | |
| 316 | if (!xfer) { | |
|
13453
4000a28ae1f5
[gaim-migrate @ 15827]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12149
diff
changeset
|
317 | silc_client_file_close(sg->client, sg->conn, session_id); |
| 8849 | 318 | return; |
| 319 | } | |
| 320 | ||
| 321 | xfer->sg = sg; | |
| 322 | xfer->client_entry = client_entry; | |
| 323 | xfer->session_id = session_id; | |
| 324 | xfer->hostname = g_strdup(hostname); | |
| 325 | xfer->port = port; | |
| 15884 | 326 | xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
327 | xfer->client_entry->nickname); |
| 8849 | 328 | if (!xfer->xfer) { |
| 329 | silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); | |
| 330 | g_free(xfer->hostname); | |
| 331 | silc_free(xfer); | |
| 332 | return; | |
| 333 | } | |
| 15884 | 334 | purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); |
| 335 | purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); | |
| 336 | purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); | |
| 8849 | 337 | xfer->xfer->remote_ip = g_strdup(hostname); |
| 338 | xfer->xfer->remote_port = port; | |
| 339 | xfer->xfer->data = xfer; | |
| 340 | ||
| 341 | /* File transfer request */ | |
| 15884 | 342 | purple_xfer_request(xfer->xfer); |
| 8849 | 343 | } |
| 344 | ||
| 345 | static void | |
| 15884 | 346 | silcpurple_ftp_send_cancel(PurpleXfer *x) |
| 8849 | 347 | { |
| 15884 | 348 | SilcPurpleXfer xfer = x->data; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
349 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
350 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
351 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
352 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
353 | /* This call will free all resources */ |
| 8849 | 354 | silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); |
| 355 | } | |
| 356 | ||
| 357 | static void | |
| 15884 | 358 | silcpurple_ftp_send(PurpleXfer *x) |
| 8849 | 359 | { |
| 15884 | 360 | SilcPurpleXfer xfer = x->data; |
| 8849 | 361 | const char *name; |
| 8910 | 362 | char *local_ip = NULL, *remote_ip = NULL; |
| 8849 | 363 | gboolean local = TRUE; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
364 | SilcClientConnectionParams params; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
365 | SilcSocket sock; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
366 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
367 | if (!xfer) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
368 | return; |
| 8849 | 369 | |
| 15884 | 370 | name = purple_xfer_get_local_filename(x); |
| 8849 | 371 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
372 | silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
373 | &sock, NULL, NULL, NULL); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
374 | |
| 15884 | 375 | /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) |
| 8849 | 376 | to see if we are behind NAT. */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
377 | if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { |
| 8849 | 378 | /* Check if the IP is private */ |
| 15884 | 379 | if (silcpurple_ip_is_private(local_ip)) { |
| 8849 | 380 | local = FALSE; |
| 381 | /* Local IP is private, resolve the remote server IP to see whether | |
| 382 | we are talking to Internet or just on LAN. */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
383 | if (silc_net_check_host_by_sock(sock, NULL, |
| 8849 | 384 | &remote_ip)) |
| 15884 | 385 | if (silcpurple_ip_is_private(remote_ip)) |
| 8849 | 386 | /* We assume we are in LAN. Let's provide the connection point. */ |
| 387 | local = TRUE; | |
| 388 | } | |
| 389 | } | |
| 390 | ||
| 391 | if (local && !local_ip) | |
| 392 | local_ip = silc_net_localip(); | |
| 393 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
394 | memset(¶ms, 0, sizeof(params)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
395 | params.timeout_secs = 60; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
396 | if (local) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
397 | /* Provide connection point */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
398 | params.local_ip = local_ip; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
399 | |
| 8849 | 400 | /* Send the file */ |
| 401 | silc_client_file_send(xfer->sg->client, xfer->sg->conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
402 | xfer->client_entry, ¶ms, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
403 | xfer->sg->public_key, xfer->sg->private_key, |
| 15884 | 404 | silcpurple_ftp_monitor, xfer, |
| 8849 | 405 | name, &xfer->session_id); |
| 406 | ||
| 407 | silc_free(local_ip); | |
| 408 | silc_free(remote_ip); | |
| 409 | } | |
| 410 | ||
| 411 | static void | |
| 15884 | 412 | silcpurple_ftp_send_file_resolved(SilcClient client, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
413 | SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
414 | SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
415 | SilcDList clients, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
416 | void *context) |
| 8849 | 417 | { |
| 15884 | 418 | PurpleConnection *gc = client->application; |
| 8849 | 419 | char tmp[256]; |
| 420 | ||
| 421 | if (!clients) { | |
| 422 | g_snprintf(tmp, sizeof(tmp), | |
| 423 | _("User %s is not present in the network"), | |
| 424 | (const char *)context); | |
| 15884 | 425 | purple_notify_error(gc, _("Secure File Transfer"), |
| 8849 | 426 | _("Cannot send file"), tmp); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
18168
diff
changeset
|
427 | g_free(context); |
| 8849 | 428 | return; |
| 429 | } | |
| 430 | ||
| 15884 | 431 | silcpurple_ftp_send_file(client->application, (const char *)context, NULL); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
18168
diff
changeset
|
432 | g_free(context); |
| 8849 | 433 | } |
| 434 | ||
| 15884 | 435 | PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) |
| 8849 | 436 | { |
| 15884 | 437 | SilcPurple sg = gc->proto_data; |
| 8849 | 438 | SilcClient client = sg->client; |
| 439 | SilcClientConnection conn = sg->conn; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
440 | SilcDList clients; |
| 15884 | 441 | SilcPurpleXfer xfer; |
| 8849 | 442 | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
443 | g_return_val_if_fail(name != NULL, NULL); |
| 8849 | 444 | |
| 445 | /* Find client entry */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
446 | clients = silc_client_get_clients_local(client, conn, name, FALSE); |
| 8849 | 447 | if (!clients) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
448 | silc_client_get_clients(client, conn, name, NULL, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
449 | silcpurple_ftp_send_file_resolved, |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
18168
diff
changeset
|
450 | g_strdup(name)); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
451 | return NULL; |
| 8849 | 452 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
453 | silc_dlist_start(clients); |
| 8849 | 454 | |
| 455 | xfer = silc_calloc(1, sizeof(*xfer)); | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
456 | g_return_val_if_fail(xfer != NULL, NULL); |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
457 | |
| 8849 | 458 | xfer->sg = sg; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
459 | xfer->client_entry = silc_dlist_get(clients); |
| 15884 | 460 | xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
461 | xfer->client_entry->nickname); |
| 8849 | 462 | if (!xfer->xfer) { |
| 463 | silc_free(xfer); | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
464 | return NULL; |
| 8849 | 465 | } |
| 15884 | 466 | purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); |
| 467 | purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); | |
| 468 | purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); | |
| 8849 | 469 | xfer->xfer->data = xfer; |
| 470 | ||
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
471 | silc_free(clients); |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
472 | |
|
12149
9706e9a4fad3
[gaim-migrate @ 14450]
Richard Laager <rlaager@pidgin.im>
parents:
12143
diff
changeset
|
473 | return xfer->xfer; |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
474 | } |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
475 | |
| 15884 | 476 | void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
477 | { |
| 15884 | 478 | PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
479 | |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
480 | g_return_if_fail(xfer != NULL); |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
481 | |
| 8849 | 482 | /* Choose file to send */ |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9353
diff
changeset
|
483 | if (file) |
| 15884 | 484 | purple_xfer_request_accepted(xfer, file); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9353
diff
changeset
|
485 | else |
| 15884 | 486 | purple_xfer_request(xfer); |
| 8849 | 487 | } |