annotate libpurple/protocols/yahoo/yahoo_filexfer.c @ 21803:ffbd2e3e10e4

Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 10 Dec 2007 02:07:01 +0000
parents f379a2e9e939
children 97d530d11cc0 754a82f1371b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file yahoo_filexfer.c Yahoo Filetransfer
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18769
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
18210
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
23 #include "internal.h"
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
24
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "proxy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "ft.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "yahoo.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "yahoo_packet.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "yahoo_filexfer.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "yahoo_doodle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 struct yahoo_xfer_data {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 gchar *host;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 gchar *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 int port;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
40 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 long expires;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 gboolean started;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 gchar *txbuf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 gsize txbuflen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 gsize txbuf_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 guint tx_handler;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 gchar *rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 guint rxlen;
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
49
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
50 gboolean y7; /* true for Y7 transfers (receive only for now) */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
51 gchar *token;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
52 gchar *tid;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 static void yahoo_xfer_data_free(struct yahoo_xfer_data *xd)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 g_free(xd->host);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 g_free(xd->path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 g_free(xd->txbuf);
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
60 g_free(xd->token);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
61 g_free(xd->tid);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 if (xd->tx_handler)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
63 purple_input_remove(xd->tx_handler);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 g_free(xd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
67
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
68 static void yahoo_xfer_y7_request_next_file(PurpleXfer *xfer)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
69 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
70 struct yahoo_packet *pack;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
71 struct yahoo_xfer_data *xd = xfer->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
72 PurpleConnection *gc = xd->gc;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
73 struct yahoo_data *yd = gc->proto_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
74
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
75 g_return_if_fail(xd->y7);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
76
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
77 pack = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER_ACCEPT, YAHOO_STATUS_AVAILABLE, 0);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
78 yahoo_packet_hash(pack, "sssi",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
79 1, purple_connection_get_display_name(xd->gc),
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
80 5, xfer->who,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
81 265, xd->tid,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
82 271, 1);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
83 yahoo_packet_send_and_free(pack, yd);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
84 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
85
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
86 static void yahoo_xfer_y7_cancel_receive(PurpleXfer *xfer)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
87 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
88 struct yahoo_packet *pack;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
89 struct yahoo_xfer_data *xd = xfer->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
90 PurpleConnection *gc = xd->gc;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
91 struct yahoo_data *yd = gc->proto_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
92
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
93 g_return_if_fail(xd->y7);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
94
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
95 pack = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER_ACCEPT, -1, 0);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
96 yahoo_packet_hash(pack, "sssi",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
97 1, purple_connection_get_display_name(gc),
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
98 5, xfer->who,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
99 265, xd->tid,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
100 66, -1);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
101 yahoo_packet_send_and_free(pack, yd);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
102 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
103
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
104 static void yahoo_xfer_y7_accept_file(PurpleXfer *xfer)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
105 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
106 struct yahoo_packet *pack;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
107 struct yahoo_xfer_data *xd = xfer->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
108 PurpleConnection *gc = xd->gc;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
109 struct yahoo_data *yd = gc->proto_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
110
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
111 g_return_if_fail(xd->y7);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
112
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
113 pack = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER_ACCEPT, YAHOO_STATUS_AVAILABLE, 0);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
114 yahoo_packet_hash(pack, "ssssis",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
115 1, purple_connection_get_display_name(gc),
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
116 5, xfer->who, /* XXX this needs an accessor */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
117 265, xd->tid,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
118 27, purple_xfer_get_filename(xfer), /* XXX this might be of incorrect encoding */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
119 249, 3,
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
120 251, xd->token);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
121 yahoo_packet_send_and_free(pack, yd);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
122 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
123
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
124 static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCondition condition)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
126 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 struct yahoo_xfer_data *xd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 int remaining, written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 xfer = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 xd = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 remaining = xd->txbuflen - xd->txbuf_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 if (written < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 else if (written <= 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
139 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
140 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 if (written < remaining) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 xd->txbuf_written += written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
149 purple_input_remove(xd->tx_handler);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 xd->tx_handler = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 g_free(xd->txbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 xd->txbuf = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 xd->txbuflen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
155 purple_xfer_start(xfer, source, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 static void yahoo_receivefile_connected(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
161 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 struct yahoo_xfer_data *xd;
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
163 struct yahoo_data *yd;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
165 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 "AAA - in yahoo_receivefile_connected\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 if (!(xfer = data))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 if (!(xd = xfer->data))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
172 purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 xfer->who, _("Unable to connect."));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
174 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 xfer->fd = source;
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
179 yd = xd->gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 /* The first time we get here, assemble the tx buffer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 if (xd->txbuflen == 0) {
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
183 if (!xd->y7)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
184 xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
185 xd->path, xd->host);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
186 else
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
187 xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\n"
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
188 "Connection: close\r\n"
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
189 "Accept: */*\r\n"
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
190 "Host: %s\r\n"
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
191 "Cookie: Y=%s; T=%s\r\n"
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
192 "\r\n",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
193 xd->path, xd->host, yd->cookie_y, yd->cookie_t);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
194 purple_debug(PURPLE_DEBUG_INFO, "yahoo_filexfer", "HTTP request: [%s]\n", xd->txbuf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 xd->txbuflen = strlen(xd->txbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 xd->txbuf_written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 if (!xd->tx_handler)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
201 xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 yahoo_receivefile_send_cb, xfer);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
203 yahoo_receivefile_send_cb(xfer, source, PURPLE_INPUT_WRITE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
207 static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondition condition)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
209 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 struct yahoo_xfer_data *xd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 int written, remaining;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 xfer = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 xd = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 remaining = xd->txbuflen - xd->txbuf_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 if (written < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 else if (written <= 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
222 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
223 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 if (written < remaining) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 xd->txbuf_written += written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
232 purple_input_remove(xd->tx_handler);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 xd->tx_handler = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 g_free(xd->txbuf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 xd->txbuf = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 xd->txbuflen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
238 purple_xfer_start(xfer, source, NULL, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
243 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 struct yahoo_xfer_data *xd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 gchar *size, *filename, *encoded_filename, *header;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 guchar *pkt_buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 const char *host;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 int port;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 size_t content_length, header_len, pkt_buf_len;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
251 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
252 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
255 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 "AAA - in yahoo_sendfile_connected\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 if (!(xfer = data))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 if (!(xd = xfer->data))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 if (source < 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
263 purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 xfer->who, _("Unable to connect."));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
265 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 xfer->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 /* Assemble the tx buffer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 gc = xd->gc;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
273 account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 YAHOO_STATUS_AVAILABLE, yd->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
279 size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
280 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 encoded_filename = yahoo_string_encode(gc, filename, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
283 yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 5, xfer->who, 14, "", 27, encoded_filename, 28, size);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 g_free(size);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 g_free(encoded_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 pkt_buf_len = yahoo_packet_build(pkt, 8, FALSE, yd->jp, &pkt_buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
294 host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
295 port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 header = g_strdup_printf(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 "POST http://%s:%d/notifyft HTTP/1.0\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 "Content-length: %" G_GSIZE_FORMAT "\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 "Host: %s:%d\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 "Cookie: Y=%s; T=%s\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 "\r\n",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
302 host, port, content_length + 4 + purple_xfer_get_size(xfer),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 host, port, yd->cookie_y, yd->cookie_t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 header_len = strlen(header);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 xd->txbuflen = header_len + pkt_buf_len + 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 xd->txbuf = g_malloc(xd->txbuflen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 memcpy(xd->txbuf, header, header_len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 g_free(header);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 memcpy(xd->txbuf + header_len, pkt_buf, pkt_buf_len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 g_free(pkt_buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 memcpy(xd->txbuf + header_len + pkt_buf_len, "29\xc0\x80", 4);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 xd->txbuf_written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 if (xd->tx_handler == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
320 xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 yahoo_sendfile_send_cb, xfer);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
322 yahoo_sendfile_send_cb(xfer, source, PURPLE_INPUT_WRITE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
326 static void yahoo_xfer_init(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 struct yahoo_xfer_data *xfer_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
329 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
330 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 xfer_data = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 gc = xfer_data->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 yd = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
336 account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
338 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 if (yd->jp) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
340 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
341 purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 yahoo_sendfile_connected, xfer) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
344 purple_notify_error(gc, NULL, _("File Transfer Failed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 _("Unable to establish file descriptor."));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
346 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
349 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
350 purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 yahoo_sendfile_connected, xfer) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
353 purple_notify_error(gc, NULL, _("File Transfer Failed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 _("Unable to establish file descriptor."));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
355 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 } else {
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
359 if (xfer_data->y7)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
360 yahoo_xfer_y7_accept_file(xfer);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
361
20208
63b1ce39965c applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
362 xfer->fd = -1;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
363 if (purple_proxy_connect(NULL, account, xfer_data->host, xfer_data->port,
20208
63b1ce39965c applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents: 19680
diff changeset
364 yahoo_receivefile_connected, xfer) == NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
365 purple_notify_error(gc, NULL, _("File Transfer Failed"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 _("Unable to establish file descriptor."));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
367 purple_xfer_cancel_remote(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
372 static void yahoo_xfer_start(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 /* We don't need to do anything here, do we? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
377 static void yahoo_xfer_end(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 struct yahoo_xfer_data *xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 xfer_data = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 if (xfer_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 yahoo_xfer_data_free(xfer_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 xfer->data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 static guint calculate_length(const gchar *l, size_t len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 for (i = 0; i < len; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 if (!g_ascii_isdigit(l[i]))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 return strtol(l + i, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
401 static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 gchar buf[4096];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 gssize len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 gchar *start = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 gchar *length;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 gchar *end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 int filelen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 struct yahoo_xfer_data *xd = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
411 if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 len = read(xfer->fd, buf, sizeof(buf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 if (len <= 0) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
418 if ((purple_xfer_get_size(xfer) > 0) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
419 (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
420 purple_xfer_set_completed(xfer, TRUE);
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
421 if (xd->y7)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
422 yahoo_xfer_y7_request_next_file(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 if (!xd->started) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 memcpy(xd->rxqueue + xd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 xd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 length = g_strstr_len(xd->rxqueue, len, "Content-length:");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 /* some proxies re-write this header, changing the capitalization :(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 * technically that's allowed since headers are case-insensitive
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 * [RFC 2616, section 4.2] */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 if (length == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 length = g_strstr_len(xd->rxqueue, len, "Content-Length:");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 if (length) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 end = g_strstr_len(length, length - xd->rxqueue, "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 if (!end)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 if ((filelen = calculate_length(length, len - (length - xd->rxqueue))))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
444 purple_xfer_set_size(xfer, filelen);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 start = g_strstr_len(xd->rxqueue, len, "\r\n\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 if (start)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 start += 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 if (!start || start > (xd->rxqueue + len))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 xd->started = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 len -= (start - xd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 *buffer = g_malloc(len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 memcpy(*buffer, start, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 g_free(xd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 xd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 xd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 *buffer = g_malloc(len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 memcpy(*buffer, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 return len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
468 static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 gssize len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 struct yahoo_xfer_data *xd = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 if (!xd)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
476 if (purple_xfer_get_type(xfer) != PURPLE_XFER_SEND) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 len = write(xfer->fd, buffer, size);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 if (len == -1) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
483 if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
484 purple_xfer_set_completed(xfer, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 if ((errno != EAGAIN) && (errno != EINTR))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 return -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
490 if ((purple_xfer_get_bytes_sent(xfer) + len) >= purple_xfer_get_size(xfer))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
491 purple_xfer_set_completed(xfer, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 return len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
496 static void yahoo_xfer_cancel_send(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 struct yahoo_xfer_data *xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 xfer_data = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 if (xfer_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 yahoo_xfer_data_free(xfer_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 xfer->data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
507 static void yahoo_xfer_cancel_recv(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 struct yahoo_xfer_data *xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 xfer_data = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
513 if (xfer_data) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
514 if (xfer_data->y7)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
515 yahoo_xfer_y7_cancel_receive(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 yahoo_xfer_data_free(xfer_data);
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
517 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 xfer->data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
521 static void yahoo_xfer_request_denied(PurpleXfer *xfer)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
522 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
523 struct yahoo_xfer_data *xfer_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
524
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
525 xfer_data = xfer->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
526
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
527 if (xfer_data->y7)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
528 yahoo_xfer_y7_cancel_receive(xfer);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
529 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
530
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
531 void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 char *me = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 char *from = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 char *service = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 char *message = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 char *command = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 char *imv = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 char *unknown = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 /* Get all the necessary values from this new packet */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 while(l != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
548 switch(pair->key) {
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
549 case 5: /* Get who the packet is for */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 me = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
551 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
552 case 4: /* Get who the packet is from */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 from = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
554 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
555 case 49: /* Get the type of service */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 service = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
557 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
558 case 14: /* Get the 'message' of the packet */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 message = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
560 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
561 case 13: /* Get the command associated with this packet */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 command = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
563 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
564 case 63: /* IMVironment name and version */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 imv = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
566 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
567 case 64: /* Not sure, but it does vary with initialization of Doodle */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 unknown = pair->value; /* So, I'll keep it (for a little while atleast) */
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
569 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
570 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 /* If this packet is an IMVIRONMENT, handle it accordingly */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 /* Check for a Doodle packet and handle it accordingly */
18769
cddf062baa71 Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18210
diff changeset
579 if(strstr(imv, "doodle;") != NULL)
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
580 yahoo_doodle_process(gc, me, from, command, message, imv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 /* If an IMVIRONMENT packet comes without a specific imviroment name */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 if(!strcmp(imv, ";0"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 /* It is unfortunately time to close all IMVironments with the remote client */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 yahoo_doodle_command_got_shutdown(gc, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
591 void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 char *from = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 char *to = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 char *url = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 char *imv = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 long expires = 0;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
599 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 struct yahoo_xfer_data *xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 char *service = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 char *filename = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 unsigned long filesize = 0L;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 for (l = pkt->hash; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
612 switch (pair->key) {
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
613 case 4:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 from = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
615 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
616 case 5:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 to = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
618 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
619 case 14:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 msg = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
621 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
622 case 20:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 url = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
624 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
625 case 38:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 expires = strtol(pair->value, NULL, 10);
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
627 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
628 case 27:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 filename = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
630 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
631 case 28:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 filesize = atol(pair->value);
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
633 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
634 case 49:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 service = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
636 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
637 case 63:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 imv = pair->value;
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
639 break;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 20208
diff changeset
640 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 * The remote user has changed their IMVironment. We
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 * record it for later use.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 if (service && (strcmp("FILEXFER", service) != 0)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
654 purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 if (msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 tmp = strchr(msg, '\006');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 if (tmp)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 *tmp = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 if (!url || !from)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 /* Setup the Yahoo-specific file transfer data */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 xfer_data = g_new0(struct yahoo_xfer_data, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 xfer_data->gc = gc;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
672 if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 g_free(xfer_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
677 purple_debug_misc("yahoo_filexfer", "Host is %s, port is %d, path is %s, and the full url was %s.\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 xfer_data->host, xfer_data->port, xfer_data->path, url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 /* Build the file transfer handle. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
681 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 if (xfer)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 xfer->data = xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 /* Set the info about the incoming file. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 if (filename) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
689 purple_xfer_set_filename(xfer, utf8_filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 g_free(utf8_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 gchar *start, *end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 start = g_strrstr(xfer_data->path, "/");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 if (start)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 start++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 end = g_strrstr(xfer_data->path, "?");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 if (start && *start && end) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 char *utf8_filename;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 filename = g_strndup(start, end - start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 utf8_filename = yahoo_string_decode(gc, filename, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 g_free(filename);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
702 purple_xfer_set_filename(xfer, utf8_filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 g_free(utf8_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 filename = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
708 purple_xfer_set_size(xfer, filesize);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 /* Setup our I/O op functions */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
711 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
712 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
713 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
714 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
715 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
716 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
717 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 /* Now perform the request */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
720 purple_xfer_request(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
21803
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
724 void yahoo_process_y7_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
725 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
726 struct yahoo_data *yd = gc->proto_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
727 char *who = NULL, *name = NULL;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
728 int ttype = 0;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
729 char *tid = NULL;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
730 GSList *l = pkt->hash;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
731
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
732 while (l) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
733 struct yahoo_pair *pair = l->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
734
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
735 switch (pair->key) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
736 case 4:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
737 /* them */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
738 who = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
739 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
740 case 5:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
741 /* us */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
742 name = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
743 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
744 case 222:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
745 /* 1=send, 2=cancel, 3=accept, 4=reject */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
746 if(pair->value)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
747 ttype = atoi(pair->value);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
748 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
749 case 265:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
750 /* transfer ID */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
751 tid = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
752 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
753 case 266:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
754 /* number of files */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
755 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
756 case 27:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
757 /* filename */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
758 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
759 case 28:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
760 /* filesize */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
761 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
762 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
763
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
764 l = l->next;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
765 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
766 if (ttype == 1 && tid) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
767 /* We auto-accept all offers here, and ask the user about each individual
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
768 * file in yahoo_process_y7_filetransfer_info. This works fine for receiving
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
769 * a single file; when receiving multiple canceling one in the middle
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
770 * will also cancel the rest of them.
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
771 * Maybe TODO: UI and API allowing transfer of multiple files as a package. */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
772 struct yahoo_packet *pack;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
773 pack = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER, YAHOO_STATUS_AVAILABLE, 0);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
774 yahoo_packet_hash(pack, "sssi", 1, name, 5, who, 265, tid, 222, 3);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
775 yahoo_packet_send_and_free(pack, yd);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
776 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
777 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
778
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
779 void yahoo_process_y7_filetransfer_info(PurpleConnection *gc, struct yahoo_packet *pkt)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
780 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
781 struct yahoo_data *yd = gc->proto_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
782 char *who = NULL, *name = NULL;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
783 int medium = 0;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
784 char *tid = NULL, *server_host = NULL, *server_token = NULL, *filename = NULL;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
785 GSList *l = pkt->hash;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
786 struct yahoo_packet *pack;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
787 PurpleXfer *xfer;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
788 struct yahoo_xfer_data *xfer_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
789
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
790 while (l) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
791 struct yahoo_pair *pair = l->data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
792
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
793 switch (pair->key) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
794 case 4:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
795 /* them */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
796 who = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
797 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
798 case 5:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
799 /* us */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
800 name = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
801 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
802 case 249:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
803 /* 1=p2p, 3=reflection server */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
804 if(pair->value)
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
805 medium = atoi(pair->value);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
806 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
807 case 265:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
808 /* transfer ID */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
809 tid = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
810 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
811 case 27:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
812 filename = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
813 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
814 case 250:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
815 server_host = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
816 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
817 case 251:
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
818 server_token = pair->value;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
819 break;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
820 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
821
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
822 l = l->next;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
823 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
824 if (medium == 1) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
825 /* reject P2P transfers */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
826 pack = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER_ACCEPT, YAHOO_STATUS_AVAILABLE, 0);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
827 yahoo_packet_hash(pack, "sssi", 1, name, 5, who, 265, tid, 66, -3);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
828 yahoo_packet_send_and_free(pack, yd);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
829 return;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
830 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
831
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
832 if (medium != 3) {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
833 purple_debug_error("yahoo", "Unexpected medium %d.\n", medium);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
834 /* weird */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
835 return;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
836 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
837
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
838 /* Setup the Yahoo-specific file transfer data */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
839 xfer_data = g_new0(struct yahoo_xfer_data, 1);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
840 xfer_data->gc = gc;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
841 xfer_data->host = g_strdup(server_host);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
842 xfer_data->token = g_strdup(server_token);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
843 xfer_data->tid = g_strdup(tid);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
844 xfer_data->port = 80;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
845 xfer_data->y7 = TRUE;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
846
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
847 /* TODO: full urlencode here */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
848 server_token = purple_strreplace(server_token, "\002", "%02");
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
849 xfer_data->path = g_strdup_printf("relay?token=%s&sender=%s&recver=%s",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
850 server_token, who, name);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
851 g_free(server_token);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
852
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
853 purple_debug_misc("yahoo_filexfer", "Host is %s, port is %d, path is %s.\n",
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
854 xfer_data->host, xfer_data->port, xfer_data->path);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
855
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
856 /* Build the file transfer handle. */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
857 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, who);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
858 xfer->data = xfer_data;
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
859
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
860 /* Set the info about the incoming file. */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
861 {
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
862 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
863 purple_xfer_set_filename(xfer, utf8_filename);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
864 g_free(utf8_filename);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
865 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
866
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
867 /* purple_xfer_set_size(xfer, filesize); */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
868
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
869 /* Setup our I/O op functions */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
870 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
871 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
872 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
873 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
874 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
875 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
876 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
877 purple_xfer_set_request_denied_fnc(xfer, yahoo_xfer_request_denied);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
878
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
879 /* Now perform the request */
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
880 purple_xfer_request(xfer);
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
881 }
ffbd2e3e10e4 Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20254
diff changeset
882
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
883 PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
885 PurpleXfer *xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 struct yahoo_xfer_data *xfer_data;
18769
cddf062baa71 Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18210
diff changeset
887
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 g_return_val_if_fail(who != NULL, NULL);
18769
cddf062baa71 Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18210
diff changeset
889
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 xfer_data = g_new0(struct yahoo_xfer_data, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 xfer_data->gc = gc;
18769
cddf062baa71 Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18210
diff changeset
892
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 /* Build the file transfer handle. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
894 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 if (xfer)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 xfer->data = xfer_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 /* Setup our I/O op functions */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
900 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
901 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
902 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
903 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
904 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
905 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
906 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 return xfer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
912 void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
914 PurpleXfer *xfer = yahoo_new_xfer(gc, who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 /* Now perform the request */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 if (file)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
920 purple_xfer_request_accepted(xfer, file);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
922 purple_xfer_request(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 }