Fri, 12 Feb 2021 23:47:53 -0600
Fix SILC compilation
* Move `_purple_fstat` to silc and rename to `silcpurple_fstat`
* Replace unknown `g_fchmod` with `fchmod`
* Fix `PurpleProtocol*` prototypes
* Derive `SilcPurpleXfer` from `PurpleXfer`
Testing Done:
Compile.
Bugs closed: PIDGIN-17436
Reviewed at https://reviews.imfreedom.org/r/481/
| 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 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
20 | #include <glib/gi18n-lib.h> |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
21 | #include <glib/gstdio.h> |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
22 | |
| 15884 | 23 | #include "silcpurple.h" |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
24 | #include "ft.h" |
| 8849 | 25 | |
| 26 | /****************************** File Transfer ********************************/ | |
| 27 | ||
| 28 | /* This implements the secure file transfer protocol (SFTP) using the SILC | |
| 29 | SFTP library implementation. The API we use from the SILC Toolkit is the | |
| 30 | SILC Client file transfer API, as it provides a simple file transfer we | |
| 31 | need in this case. We could use the SILC SFTP API directly, but it would | |
| 32 | be an overkill since we'd effectively re-implement the file transfer what | |
| 33 | the SILC Client's file transfer API already provides. | |
| 34 | ||
| 15884 | 35 | From Purple we do NOT use the FT API to do the transfer as it is very limiting. |
| 8849 | 36 | In fact it does not suite to file transfers like SFTP at all. For example, |
| 37 | it assumes that read operations are synchronous what they are not in SFTP. | |
| 15884 | 38 | It also assumes that the file transfer socket is to be handled by the Purple |
| 8849 | 39 | eventloop, and this naturally is something we don't want to do in case of |
| 40 | SILC Toolkit. The FT API suites well to purely stream based file transfers | |
| 41 | like HTTP GET and similar. | |
| 42 | ||
| 15884 | 43 | For this reason, we directly access the Purple GKT FT API and hack the FT |
| 8849 | 44 | API to merely provide the user interface experience and all the magic |
| 45 | is done in the SILC Toolkit. Ie. we update the statistics information in | |
| 46 | the FT API for user interface, and that's it. A bit dirty but until the | |
| 47 | FT API gets better this is the way to go. Good thing that FT API allowed | |
| 48 | us to do this. */ | |
| 49 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
50 | struct _SilcPurpleXfer { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
51 | PurpleXfer parent; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
52 | |
| 15884 | 53 | SilcPurple sg; |
| 8849 | 54 | SilcClientEntry client_entry; |
| 55 | SilcUInt32 session_id; | |
| 56 | char *hostname; | |
| 57 | SilcUInt16 port; | |
| 58 | ||
| 59 | SilcClientFileName completion; | |
| 60 | void *completion_context; | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
61 | }; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
62 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
63 | G_DEFINE_DYNAMIC_TYPE(SilcPurpleXfer, silcpurple_xfer, PURPLE_TYPE_XFER); |
| 8849 | 64 | |
| 65 | static void | |
| 15884 | 66 | silcpurple_ftp_monitor(SilcClient client, |
| 8849 | 67 | SilcClientConnection conn, |
| 68 | SilcClientMonitorStatus status, | |
| 69 | SilcClientFileError error, | |
| 70 | SilcUInt64 offset, | |
| 71 | SilcUInt64 filesize, | |
| 72 | SilcClientEntry client_entry, | |
| 73 | SilcUInt32 session_id, | |
| 74 | const char *filepath, | |
| 75 | void *context) | |
| 76 | { | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
77 | PurpleXfer *xfer = context; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
78 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
79 | PurpleConnection *gc = spx->sg->gc; |
| 8849 | 80 | char tmp[256]; |
| 81 | ||
| 82 | 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
|
83 | /* All started sessions terminate here */ |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
84 | g_object_unref(xfer); |
| 8849 | 85 | return; |
| 86 | } | |
| 87 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
88 | if (status == SILC_CLIENT_FILE_MONITOR_DISCONNECT) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
89 | purple_notify_error(gc, _("Secure File Transfer"), _("Error " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
90 | "during file transfer"), _("Remote disconnected"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
91 | purple_request_cpar_from_connection(gc)); |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
92 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
93 | 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
|
94 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
95 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
96 | |
| 8849 | 97 | if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) |
| 98 | return; | |
| 99 | ||
| 100 | if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { | |
| 101 | if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { | |
| 102 | g_snprintf(tmp, sizeof(tmp), "No such file %s", | |
| 103 | filepath ? filepath : "[N/A]"); | |
| 15884 | 104 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
105 | _("Error during file transfer"), tmp, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
106 | purple_request_cpar_from_connection(gc)); |
| 8849 | 107 | } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { |
| 15884 | 108 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
109 | _("Error during file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
110 | _("Permission denied"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
111 | purple_request_cpar_from_connection(gc)); |
| 8849 | 112 | } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { |
| 15884 | 113 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
114 | _("Error during file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
115 | _("Key agreement failed"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
116 | purple_request_cpar_from_connection(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
|
117 | } 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
|
118 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
119 | _("Error during file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
120 | _("Connection timed out"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
121 | purple_request_cpar_from_connection(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
|
122 | } 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
|
123 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
124 | _("Error during file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
125 | _("Creating connection failed"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
126 | purple_request_cpar_from_connection(gc)); |
| 8849 | 127 | } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { |
| 15884 | 128 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
129 | _("Error during file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
130 | _("File transfer session does not exist"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
131 | purple_request_cpar_from_connection(gc)); |
| 8849 | 132 | } |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
133 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); |
| 8849 | 134 | silc_client_file_close(client, conn, session_id); |
| 135 | return; | |
| 136 | } | |
| 137 | ||
| 138 | /* Update file transfer UI */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
139 | if (!offset && filesize) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
140 | purple_xfer_set_size(xfer, filesize); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
141 | } |
| 8849 | 142 | if (offset && filesize) { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
143 | purple_xfer_set_bytes_sent(xfer, offset); |
| 8849 | 144 | } |
| 145 | ||
| 146 | if (status == SILC_CLIENT_FILE_MONITOR_SEND || | |
| 147 | status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { | |
| 148 | if (offset == filesize) { | |
| 149 | /* Download finished */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
150 | purple_xfer_set_completed(xfer, TRUE); |
| 8849 | 151 | silc_client_file_close(client, conn, session_id); |
| 152 | } | |
| 153 | } | |
| 154 | } | |
| 155 | ||
| 156 | static void | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
157 | silcpurple_ftp_cancel(PurpleXfer *xfer) |
| 8849 | 158 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
159 | SilcPurpleXfer *spx = SILCPURPLE_XFER(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
|
160 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
161 | if (!spx) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
162 | return; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
163 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
164 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
165 | purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
166 | silc_client_file_close(spx->sg->client, spx->sg->conn, spx->session_id); |
| 8849 | 167 | } |
| 168 | ||
| 169 | static void | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
170 | silcpurple_ftp_ask_name_ok(PurpleXfer *xfer) |
| 8849 | 171 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
172 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
| 8849 | 173 | const char *name; |
| 174 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
175 | if (!spx) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
176 | return; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
177 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
178 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
179 | name = purple_xfer_get_local_filename(xfer); |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10254
diff
changeset
|
180 | g_unlink(name); |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
181 | spx->completion(name, spx->completion_context); |
| 8849 | 182 | } |
| 183 | ||
| 184 | static void | |
| 15884 | 185 | silcpurple_ftp_ask_name(SilcClient client, |
| 8849 | 186 | SilcClientConnection conn, |
| 187 | SilcUInt32 session_id, | |
| 188 | const char *remote_filename, | |
| 189 | SilcClientFileName completion, | |
| 190 | void *completion_context, | |
| 191 | void *context) | |
| 192 | { | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
193 | PurpleXfer *xfer = context; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
194 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
| 8849 | 195 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
196 | spx->completion = completion; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
197 | spx->completion_context = completion_context; |
| 8849 | 198 | |
| 199 | /* Request to save the file */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
200 | purple_xfer_set_filename(xfer, remote_filename); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
201 | purple_xfer_request(xfer); |
| 8849 | 202 | } |
| 203 | ||
| 204 | static void | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
205 | silcpurple_ftp_request_result(PurpleXfer *xfer) |
| 8849 | 206 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
207 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
| 8849 | 208 | SilcClientFileError status; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
209 | PurpleConnection *gc = spx->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
|
210 | SilcClientConnectionParams params; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
211 | gboolean local = spx->hostname ? FALSE : 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
|
212 | 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
|
213 | SilcSocket sock; |
| 8849 | 214 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
215 | if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) { |
| 8849 | 216 | return; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
217 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
218 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
219 | silc_socket_stream_get_info(silc_packet_stream_get_stream(spx->sg->conn->stream), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
220 | &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
|
221 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
222 | 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
|
223 | /* 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
|
224 | 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
|
225 | 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
|
226 | /* 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
|
227 | 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
|
228 | 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
|
229 | /* 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
|
230 | 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
|
231 | 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
|
232 | &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
|
233 | 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
|
234 | /* 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
|
235 | 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
|
236 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
237 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
238 | |
|
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 (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
|
240 | 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
|
241 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
242 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
243 | 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
|
244 | 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
|
245 | 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
|
246 | /* 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
|
247 | params.local_ip = local_ip; |
| 8849 | 248 | |
| 249 | /* Start the file transfer */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
250 | status = silc_client_file_receive(spx->sg->client, spx->sg->conn, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
251 | ¶ms, spx->sg->public_key, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
252 | spx->sg->private_key, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
253 | silcpurple_ftp_monitor, xfer, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
254 | NULL, spx->session_id, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
255 | silcpurple_ftp_ask_name, xfer); |
| 8849 | 256 | switch (status) { |
| 257 | 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
|
258 | 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
|
259 | silc_free(remote_ip); |
| 8849 | 260 | return; |
| 261 | break; | |
| 262 | ||
| 263 | case SILC_CLIENT_FILE_UNKNOWN_SESSION: | |
| 15884 | 264 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
265 | _("No file transfer session active"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
266 | purple_request_cpar_from_connection(gc)); |
| 8849 | 267 | break; |
| 268 | ||
| 269 | case SILC_CLIENT_FILE_ALREADY_STARTED: | |
| 15884 | 270 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
271 | _("File transfer already started"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
272 | purple_request_cpar_from_connection(gc)); |
| 8849 | 273 | break; |
| 274 | ||
| 275 | case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: | |
| 15884 | 276 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
277 | _("Could not perform key agreement for file transfer"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
278 | NULL, purple_request_cpar_from_connection(gc)); |
| 8849 | 279 | break; |
| 280 | ||
| 281 | default: | |
| 15884 | 282 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
283 | _("Could not start the file transfer"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
284 | purple_request_cpar_from_connection(gc)); |
| 8849 | 285 | break; |
| 286 | } | |
| 287 | ||
| 288 | /* Error */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
289 | g_object_unref(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
|
290 | 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
|
291 | silc_free(remote_ip); |
| 8849 | 292 | } |
| 293 | ||
| 294 | static void | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
295 | silcpurple_ftp_request_init(PurpleXfer *xfer) |
| 8849 | 296 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
297 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
| 8849 | 298 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
299 | if (spx->completion) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
300 | silcpurple_ftp_ask_name_ok(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
301 | } else { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
302 | silcpurple_ftp_request_result(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
303 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
304 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
305 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
306 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
307 | silcpurple_ftp_request_denied(PurpleXfer *xfer) |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
308 | { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
309 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
310 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
311 | if (!spx) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
312 | return; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
313 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
314 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
315 | /* Cancel the transmission */ |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
316 | if (spx->completion) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
317 | spx->completion(NULL, spx->completion_context); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
318 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
319 | silc_client_file_close(spx->sg->client, spx->sg->conn, spx->session_id); |
| 8849 | 320 | } |
| 321 | ||
| 15884 | 322 | 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
|
323 | 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
|
324 | const char *hostname, SilcUInt16 port) |
| 8849 | 325 | { |
| 15884 | 326 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32270
diff
changeset
|
327 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
328 | SilcPurpleXfer *spx; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
329 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
330 | spx = g_object_new(SILCPURPLE_TYPE_XFER, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
331 | "account", sg->account, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
332 | "type", PURPLE_XFER_TYPE_RECEIVE, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
333 | "remote-user", client_entry->nickname, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
334 | NULL); |
| 8849 | 335 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
336 | spx->sg = sg; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
337 | spx->client_entry = client_entry; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
338 | spx->session_id = session_id; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
339 | spx->hostname = g_strdup(hostname); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
340 | spx->port = port; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
341 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
342 | purple_xfer_start(PURPLE_XFER(spx), -1, hostname, port); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
343 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
344 | /* File transfer request */ |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
345 | purple_xfer_request(PURPLE_XFER(spx)); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
346 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
347 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
348 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
349 | silcpurple_ftp_send_cancel(PurpleXfer *xfer) |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
350 | { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
351 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
352 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
353 | if (!spx) { |
| 8849 | 354 | return; |
| 355 | } | |
| 356 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
357 | /* This call will free all resources */ |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
358 | silc_client_file_close(spx->sg->client, spx->sg->conn, spx->session_id); |
| 8849 | 359 | } |
| 360 | ||
| 361 | static void | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
362 | silcpurple_ftp_send(PurpleXfer *xfer) |
| 8849 | 363 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
364 | SilcPurpleXfer *spx = SILCPURPLE_XFER(xfer); |
| 8849 | 365 | const char *name; |
| 8910 | 366 | char *local_ip = NULL, *remote_ip = NULL; |
| 8849 | 367 | 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
|
368 | 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
|
369 | 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
|
370 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
371 | if (!spx) { |
|
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 | return; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
373 | } |
| 8849 | 374 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
375 | name = purple_xfer_get_local_filename(xfer); |
| 8849 | 376 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
377 | silc_socket_stream_get_info(silc_packet_stream_get_stream(spx->sg->conn->stream), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
378 | &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
|
379 | |
| 15884 | 380 | /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) |
| 8849 | 381 | 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
|
382 | if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { |
| 8849 | 383 | /* Check if the IP is private */ |
| 15884 | 384 | if (silcpurple_ip_is_private(local_ip)) { |
| 8849 | 385 | local = FALSE; |
| 386 | /* Local IP is private, resolve the remote server IP to see whether | |
| 387 | 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
|
388 | if (silc_net_check_host_by_sock(sock, NULL, |
| 8849 | 389 | &remote_ip)) |
| 15884 | 390 | if (silcpurple_ip_is_private(remote_ip)) |
| 8849 | 391 | /* We assume we are in LAN. Let's provide the connection point. */ |
| 392 | local = TRUE; | |
| 393 | } | |
| 394 | } | |
| 395 | ||
| 396 | if (local && !local_ip) | |
| 397 | local_ip = silc_net_localip(); | |
| 398 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
399 | 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
|
400 | 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
|
401 | 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
|
402 | /* 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
|
403 | 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
|
404 | |
| 8849 | 405 | /* Send the file */ |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
406 | silc_client_file_send(spx->sg->client, spx->sg->conn, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
407 | spx->client_entry, ¶ms, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
408 | spx->sg->public_key, spx->sg->private_key, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
409 | silcpurple_ftp_monitor, xfer, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
410 | name, &spx->session_id); |
| 8849 | 411 | |
| 412 | silc_free(local_ip); | |
| 413 | silc_free(remote_ip); | |
| 414 | } | |
| 415 | ||
| 416 | static void | |
| 15884 | 417 | 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
|
418 | 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
|
419 | 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
|
420 | 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
|
421 | void *context) |
| 8849 | 422 | { |
| 15884 | 423 | PurpleConnection *gc = client->application; |
| 8849 | 424 | char tmp[256]; |
| 425 | ||
| 426 | if (!clients) { | |
| 427 | g_snprintf(tmp, sizeof(tmp), | |
| 428 | _("User %s is not present in the network"), | |
| 429 | (const char *)context); | |
| 15884 | 430 | purple_notify_error(gc, _("Secure File Transfer"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
431 | _("Cannot send file"), tmp, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33774
diff
changeset
|
432 | purple_request_cpar_from_connection(gc)); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
18168
diff
changeset
|
433 | g_free(context); |
| 8849 | 434 | return; |
| 435 | } | |
| 436 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
437 | silcpurple_ftp_send_file(NULL, 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
|
438 | g_free(context); |
| 8849 | 439 | } |
| 440 | ||
|
38841
518362268798
make sure all the PurpleProtocolXfer parameters are named prplxfer
Gary Kramlich <grim@reaperworld.com>
parents:
35681
diff
changeset
|
441 | PurpleXfer *silcpurple_ftp_new_xfer(PurpleProtocolXfer *prplxfer, PurpleConnection *gc, const char *name) |
| 8849 | 442 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32270
diff
changeset
|
443 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 444 | SilcClient client = sg->client; |
| 445 | 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
|
446 | SilcDList clients; |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
447 | SilcClientEntry client_entry; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
448 | SilcPurpleXfer *spx; |
| 8849 | 449 | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
450 | g_return_val_if_fail(name != NULL, NULL); |
| 8849 | 451 | |
| 452 | /* 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
|
453 | clients = silc_client_get_clients_local(client, conn, name, FALSE); |
| 8849 | 454 | 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
|
455 | 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
|
456 | 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
|
457 | g_strdup(name)); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
458 | return NULL; |
| 8849 | 459 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
460 | silc_dlist_start(clients); |
| 8849 | 461 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
462 | client_entry = silc_dlist_get(clients); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
463 | silc_free(clients); |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
464 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
465 | spx = g_object_new(SILCPURPLE_TYPE_XFER, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
466 | "account", sg->account, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
467 | "type", PURPLE_XFER_TYPE_SEND, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
468 | "remote-user", client_entry->nickname, |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
469 | NULL); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
470 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
471 | spx->sg = sg; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
472 | spx->client_entry = client_entry; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
473 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
474 | return PURPLE_XFER(spx); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
475 | } |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
476 | |
|
38841
518362268798
make sure all the PurpleProtocolXfer parameters are named prplxfer
Gary Kramlich <grim@reaperworld.com>
parents:
35681
diff
changeset
|
477 | void silcpurple_ftp_send_file(PurpleProtocolXfer *prplxfer, PurpleConnection *gc, const char *name, const char *file) |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
478 | { |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
479 | PurpleXfer *xfer = silcpurple_ftp_new_xfer(prplxfer, gc, name); |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
480 | |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
481 | g_return_if_fail(xfer != NULL); |
|
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
11015
diff
changeset
|
482 | |
| 8849 | 483 | /* Choose file to send */ |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9353
diff
changeset
|
484 | if (file) |
| 15884 | 485 | purple_xfer_request_accepted(xfer, file); |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9353
diff
changeset
|
486 | else |
| 15884 | 487 | purple_xfer_request(xfer); |
| 8849 | 488 | } |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
489 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
490 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
491 | silcpurple_ftp_init(PurpleXfer *xfer) |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
492 | { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
493 | switch(purple_xfer_get_xfer_type(xfer)) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
494 | case PURPLE_XFER_TYPE_SEND: |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
495 | silcpurple_ftp_send(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
496 | break; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
497 | case PURPLE_XFER_TYPE_RECEIVE: |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
498 | silcpurple_ftp_request_init(xfer); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
499 | break; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
500 | case PURPLE_XFER_TYPE_UNKNOWN: |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
501 | g_return_if_reached(); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
502 | break; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
503 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
504 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
505 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
506 | /****************************************************************************** |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
507 | * GObject Implementation |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
508 | *****************************************************************************/ |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
509 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
510 | silcpurple_xfer_init(SilcPurpleXfer *spx) |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
511 | { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
512 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
513 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
514 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
515 | silcpurple_xfer_finalize(GObject *obj) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
516 | SilcPurpleXfer *spx = SILCPURPLE_XFER(obj); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
517 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
518 | g_free(spx->hostname); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
519 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
520 | G_OBJECT_CLASS(silcpurple_xfer_parent_class)->finalize(obj); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
521 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
522 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
523 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
524 | silcpurple_xfer_class_init(SilcPurpleXferClass *klass) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
525 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
526 | PurpleXferClass *xfer_class = PURPLE_XFER_CLASS(klass); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
527 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
528 | obj_class->finalize = silcpurple_xfer_finalize; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
529 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
530 | xfer_class->init = silcpurple_ftp_init; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
531 | xfer_class->request_denied = silcpurple_ftp_request_denied; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
532 | xfer_class->cancel_send = silcpurple_ftp_send_cancel; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
533 | xfer_class->cancel_recv = silcpurple_ftp_cancel; |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
534 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
535 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
536 | static void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
537 | silcpurple_xfer_class_finalize(SilcPurpleXferClass *klass) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
538 | } |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
539 | |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
540 | /****************************************************************************** |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
541 | * Public API |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
542 | *****************************************************************************/ |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
543 | void |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
544 | silcpurple_xfer_register(GTypeModule *module) { |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
545 | silcpurple_xfer_register_type(module); |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40255
diff
changeset
|
546 | } |