Mercurial > pidgin
annotate src/protocols/irc/dcc_send.c @ 13967:99b9b58b19dd
[gaim-migrate @ 16523]
Fix a crazy MSN crash. Basically it's possible to have more than one
slplink associated with a given switchboard, but our code did not
allow for that. I think it happens when you're in a multi-user
chat and you do stuff with multiple users that involves slplinks.
Like maybe file transfer and buddy icon related stuff.
Tracking this down took an ungodly amount of time, but thanks to
Meebo for letting me do it :-)
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 20 Jul 2006 07:31:15 +0000 |
parents | 5ddde4ad1ca2 |
children |
rev | line source |
---|---|
8351 | 1 /** |
2 * @file dcc_send.c Functions used in sending files with DCC SEND | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2004, Timothy T Ringenbach <omarvo@hotmail.com> | |
7 * Copyright (C) 2003, Robbert Haarman <gaim@inglorion.net> | |
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; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 | |
24 #include "internal.h" | |
25 #include "irc.h" | |
26 #include "debug.h" | |
27 #include "ft.h" | |
28 #include "notify.h" | |
29 #include "network.h" | |
30 | |
31 /*************************************************************************** | |
32 * Functions related to receiving files via DCC SEND | |
33 ***************************************************************************/ | |
34 | |
35 struct irc_xfer_rx_data { | |
36 gchar *ip; | |
37 }; | |
38 | |
39 static void irc_dccsend_recv_destroy(GaimXfer *xfer) | |
40 { | |
41 struct irc_xfer_rx_data *xd = xfer->data; | |
42 | |
43 if (xd->ip != NULL) | |
44 g_free(xd->ip); | |
45 | |
46 g_free(xd); | |
47 } | |
48 | |
49 /* | |
50 * This function is called whenever data is received. | |
51 * It sends the acknowledgement (in the form of a total byte count as an | |
52 * unsigned 4 byte integer in network byte order) | |
53 */ | |
11159 | 54 static void irc_dccsend_recv_ack(GaimXfer *xfer, const guchar *data, size_t size) { |
8351 | 55 unsigned long l; |
56 | |
57 l = htonl(xfer->bytes_sent); | |
58 write(xfer->fd, &l, sizeof(l)); | |
59 } | |
60 | |
61 static void irc_dccsend_recv_init(GaimXfer *xfer) { | |
62 struct irc_xfer_rx_data *xd = xfer->data; | |
63 | |
64 gaim_xfer_start(xfer, -1, xd->ip, xfer->remote_port); | |
65 g_free(xd->ip); | |
66 xd->ip = NULL; | |
67 } | |
68 | |
69 /* This function makes the necessary arrangements for receiving files */ | |
70 void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { | |
71 GaimXfer *xfer; | |
72 struct irc_xfer_rx_data *xd; | |
73 gchar **token; | |
74 struct in_addr addr; | |
75 GString *filename; | |
76 int i = 0; | |
77 guint32 nip; | |
78 | |
79 token = g_strsplit(msg, " ", 0); | |
80 if (!token[0] || !token[1] || !token[2]) { | |
81 g_strfreev(token); | |
82 return; | |
83 } | |
84 | |
85 filename = g_string_new(""); | |
86 if (token[0][0] == '"') { | |
87 if (!strchr(&(token[0][1]), '"')) { | |
88 g_string_append(filename, &(token[0][1])); | |
89 for (i = 1; token[i]; i++) | |
90 if (!strchr(token[i], '"')) { | |
91 g_string_append_printf(filename, " %s", token[i]); | |
92 } else { | |
93 g_string_append_len(filename, token[i], strlen(token[i]) - 1); | |
94 break; | |
95 } | |
96 } else { | |
97 g_string_append_len(filename, &(token[0][1]), strlen(&(token[0][1])) - 1); | |
98 } | |
99 } else { | |
100 g_string_append(filename, token[0]); | |
101 } | |
102 | |
103 if (!token[i] || !token[i+1] || !token[i+2]) { | |
104 g_strfreev(token); | |
105 g_string_free(filename, TRUE); | |
106 return; | |
107 } | |
108 i++; | |
109 | |
110 xfer = gaim_xfer_new(irc->account, GAIM_XFER_RECEIVE, from); | |
111 xd = g_new0(struct irc_xfer_rx_data, 1); | |
112 xfer->data = xd; | |
113 | |
114 gaim_xfer_set_filename(xfer, filename->str); | |
115 xfer->remote_port = atoi(token[i+1]); | |
116 | |
117 nip = strtoul(token[i], NULL, 10); | |
118 if (nip) { | |
119 addr.s_addr = htonl(nip); | |
120 xd->ip = g_strdup(inet_ntoa(addr)); | |
121 } else { | |
122 xd->ip = g_strdup(token[i]); | |
123 } | |
124 gaim_debug(GAIM_DEBUG_INFO, "irc", "Receiving file from %s\n", | |
125 xd->ip); | |
126 gaim_xfer_set_size(xfer, token[i+2] ? atoi(token[i+2]) : 0); | |
127 | |
128 gaim_xfer_set_init_fnc(xfer, irc_dccsend_recv_init); | |
129 gaim_xfer_set_ack_fnc(xfer, irc_dccsend_recv_ack); | |
130 | |
131 gaim_xfer_set_end_fnc(xfer, irc_dccsend_recv_destroy); | |
132 gaim_xfer_set_request_denied_fnc(xfer, irc_dccsend_recv_destroy); | |
133 gaim_xfer_set_cancel_send_fnc(xfer, irc_dccsend_recv_destroy); | |
134 | |
135 gaim_xfer_request(xfer); | |
136 g_strfreev(token); | |
137 g_string_free(filename, TRUE); | |
138 } | |
139 | |
140 /******************************************************************* | |
141 * Functions related to sending files via DCC SEND | |
142 *******************************************************************/ | |
143 | |
144 struct irc_xfer_send_data { | |
145 gint inpa; | |
146 int fd; | |
147 guchar *rxqueue; | |
148 guint rxlen; | |
149 }; | |
150 | |
151 static void irc_dccsend_send_destroy(GaimXfer *xfer) | |
152 { | |
153 struct irc_xfer_send_data *xd = xfer->data; | |
154 | |
155 if (xd == NULL) | |
156 return; | |
157 | |
158 if (xd->inpa > 0) | |
159 gaim_input_remove(xd->inpa); | |
160 if (xd->fd != -1) | |
161 close(xd->fd); | |
162 | |
163 if (xd->rxqueue) | |
164 g_free(xd->rxqueue); | |
165 | |
166 g_free(xd); | |
167 } | |
168 | |
169 /* just in case you were wondering, this is why DCC is gay */ | |
170 static void irc_dccsend_send_read(gpointer data, int source, GaimInputCondition cond) | |
171 { | |
172 GaimXfer *xfer = data; | |
173 struct irc_xfer_send_data *xd = xfer->data; | |
174 char *buffer[16]; | |
175 int len; | |
176 | |
13200
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
177 len = read(source, buffer, sizeof(buffer)); |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
178 |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
179 if (len < 0 && errno == EAGAIN) |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
180 return; |
13786
5ddde4ad1ca2
[gaim-migrate @ 16198]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
13200
diff
changeset
|
181 else if (len <= 0) { |
13200
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
182 /* XXX: Shouldn't this be canceling the transfer? */ |
8351 | 183 gaim_input_remove(xd->inpa); |
184 xd->inpa = 0; | |
185 return; | |
186 } | |
187 | |
188 xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen); | |
189 memcpy(xd->rxqueue + xd->rxlen, buffer, len); | |
190 xd->rxlen += len; | |
191 | |
192 while (1) { | |
11318 | 193 size_t acked; |
8351 | 194 |
195 if (xd->rxlen < 4) | |
196 break; | |
197 | |
198 acked = ntohl(*((gint32 *)xd->rxqueue)); | |
199 | |
200 xd->rxlen -= 4; | |
201 if (xd->rxlen) { | |
10388 | 202 unsigned char *tmp = g_memdup(xd->rxqueue + 4, xd->rxlen); |
8351 | 203 g_free(xd->rxqueue); |
204 xd->rxqueue = tmp; | |
205 } else { | |
206 g_free(xd->rxqueue); | |
207 xd->rxqueue = NULL; | |
208 } | |
209 | |
210 if (acked >= gaim_xfer_get_size(xfer)) { | |
211 gaim_input_remove(xd->inpa); | |
212 xd->inpa = 0; | |
213 gaim_xfer_set_completed(xfer, TRUE); | |
214 gaim_xfer_end(xfer); | |
215 return; | |
216 } | |
217 } | |
218 } | |
219 | |
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
12151
diff
changeset
|
220 static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, GaimXfer *xfer) |
8351 | 221 { |
12151
de798f2f4bf1
[gaim-migrate @ 14452]
Richard Laager <rlaager@wiktel.com>
parents:
12143
diff
changeset
|
222 gssize s; |
13200
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
223 int ret; |
8351 | 224 |
225 s = MIN(gaim_xfer_get_bytes_remaining(xfer), size); | |
226 if (!s) | |
227 return 0; | |
228 | |
13200
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
229 ret = write(xfer->fd, buffer, s); |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
230 |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
231 if (ret < 0 && errno == EAGAIN) |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
232 ret = 0; |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
233 |
33bef17125c2
[gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12909
diff
changeset
|
234 return ret; |
8351 | 235 } |
236 | |
237 static void irc_dccsend_send_connected(gpointer data, int source, GaimInputCondition cond) { | |
238 GaimXfer *xfer = (GaimXfer *) data; | |
239 struct irc_xfer_send_data *xd = xfer->data; | |
240 int conn; | |
241 | |
242 conn = accept(xd->fd, NULL, 0); | |
243 if (conn == -1) { | |
244 /* Accepting the connection failed. This could just be related | |
245 * to the nonblocking nature of the listening socket, so we'll | |
246 * just try again next time */ | |
247 /* Let's print an error message anyway */ | |
248 gaim_debug_warning("irc", "accept: %s\n", strerror(errno)); | |
249 return; | |
250 } | |
251 | |
252 gaim_input_remove(xfer->watcher); | |
253 xfer->watcher = 0; | |
254 close(xd->fd); | |
255 xd->fd = -1; | |
256 | |
257 xd->inpa = gaim_input_add(conn, GAIM_INPUT_READ, irc_dccsend_send_read, xfer); | |
258 /* Start the transfer */ | |
259 gaim_xfer_start(xfer, conn, NULL, 0); | |
260 } | |
261 | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
262 static void |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
263 irc_dccsend_network_listen_cb(int sock, gpointer data) |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
264 { |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
265 GaimXfer *xfer = data; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
266 struct irc_xfer_send_data *xd; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
267 GaimConnection *gc; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
268 struct irc_conn *irc; |
8351 | 269 const char *arg[2]; |
270 char *tmp; | |
271 struct in_addr addr; | |
272 unsigned short int port; | |
273 | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
274 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
275 || gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_REMOTE) { |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
276 gaim_xfer_unref(xfer); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
277 return; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
278 } |
8351 | 279 |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
280 xd = xfer->data; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
281 gc = gaim_account_get_connection(gaim_xfer_get_account(xfer)); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
282 irc = gc->proto_data; |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
283 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
284 gaim_xfer_unref(xfer); |
8351 | 285 |
286 if (sock < 0) { | |
10654 | 287 gaim_notify_error(gc, NULL, _("File Transfer Failed"), |
8351 | 288 _("Gaim could not open a listening port.")); |
289 gaim_xfer_cancel_local(xfer); | |
290 return; | |
291 } | |
292 | |
293 xd->fd = sock; | |
294 | |
295 port = gaim_network_get_port_from_fd(sock); | |
296 gaim_debug_misc("irc", "port is %hu\n", port); | |
297 /* Monitor the listening socket */ | |
298 xfer->watcher = gaim_input_add(sock, GAIM_INPUT_READ, | |
299 irc_dccsend_send_connected, xfer); | |
300 | |
301 /* Send the intended recipient the DCC request */ | |
302 arg[0] = xfer->who; | |
8838 | 303 inet_aton(gaim_network_get_my_ip(irc->fd), &addr); |
11656
f9c5480ad0ce
[gaim-migrate @ 13940]
Richard Laager <rlaager@wiktel.com>
parents:
11318
diff
changeset
|
304 arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", |
8351 | 305 xfer->filename, ntohl(addr.s_addr), |
306 port, xfer->size); | |
307 | |
10555 | 308 irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); |
8351 | 309 g_free(tmp); |
310 } | |
311 | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
312 /* |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
313 * This function is called after the user has selected a file to send. |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
314 */ |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
315 static void irc_dccsend_send_init(GaimXfer *xfer) { |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
316 GaimConnection *gc = gaim_account_get_connection(gaim_xfer_get_account(xfer)); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
317 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
318 xfer->filename = g_path_get_basename(xfer->local_filename); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
319 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
320 gaim_xfer_ref(xfer); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
321 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
322 /* Create a listening socket */ |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
323 if (!gaim_network_listen_range(0, 0, SOCK_STREAM, |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
324 irc_dccsend_network_listen_cb, xfer)) { |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
325 gaim_xfer_unref(xfer); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
326 gaim_notify_error(gc, NULL, _("File Transfer Failed"), |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
327 _("Gaim could not open a listening port.")); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
328 gaim_xfer_cancel_local(xfer); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
329 } |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
330 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
331 } |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
12730
diff
changeset
|
332 |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
333 GaimXfer *irc_dccsend_new_xfer(GaimConnection *gc, const char *who) { |
8351 | 334 GaimXfer *xfer; |
335 struct irc_xfer_send_data *xd; | |
336 | |
337 /* Build the file transfer handle */ | |
9466 | 338 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, who); |
8351 | 339 |
340 xd = g_new0(struct irc_xfer_send_data, 1); | |
341 xd->fd = -1; | |
342 xfer->data = xd; | |
343 | |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
344 /* Setup our I/O op functions */ |
8351 | 345 gaim_xfer_set_init_fnc(xfer, irc_dccsend_send_init); |
346 gaim_xfer_set_write_fnc(xfer, irc_dccsend_send_write); | |
347 gaim_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy); | |
348 gaim_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy); | |
349 gaim_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy); | |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
350 |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
351 return xfer; |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
352 } |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
353 |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
354 /** |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
355 * Gaim calls this function when the user selects Send File from the |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
356 * buddy menu |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
357 * It sets up the GaimXfer struct and tells Gaim to go ahead |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
358 */ |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
359 void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) { |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
360 GaimXfer *xfer = irc_dccsend_new_xfer(gc, who); |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
361 |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
11656
diff
changeset
|
362 /* Perform the request */ |
9466 | 363 if (file) |
364 gaim_xfer_request_accepted(xfer, file); | |
365 else | |
366 gaim_xfer_request(xfer); | |
8351 | 367 } |