Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/yahoo_filexfer.c @ 25616:ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
author | Sulabh Mahajan <sulabh@soc.pidgin.im> |
---|---|
date | Sat, 21 Jun 2008 14:34:38 +0000 |
parents | ef47df3e5dd4 |
children | 2fb8c39d0494 |
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 | 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" |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
24 #include "dnsquery.h" |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
25 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "proxy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "ft.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "yahoo.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "yahoo_packet.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "yahoo_filexfer.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "yahoo_doodle.h" |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
36 #include "yahoo_friend.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 struct yahoo_xfer_data { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 gchar *host; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 gchar *path; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 int port; |
15823 | 42 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 long expires; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 gboolean started; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 gchar *txbuf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 gsize txbuflen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 gsize txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 guint tx_handler; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 gchar *rxqueue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 guint rxlen; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
51 gchar *xfer_peer_idstring; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
52 gchar *xfer_idstring_for_relay; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
53 int version; /*0 for old, 15 for Y7(YMSG 15)*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
54 int info_val_249; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
55 |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
56 enum { |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
57 STARTED = 0, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
58 HEAD_REQUESTED, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
59 HEAD_REPLY_RECEIVED, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
60 TRANSFER_PHASE, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
61 ACCEPTED |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
62 } status_15; |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
63 |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
64 /* contains all filenames, in case of multiple transfers, with the first |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
65 * one in the list being the current file's name (ymsg15) */ |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
66 GSList *filename_list; |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
67 GSList *size_list; /*corresponds to filename_list, with size as **STRING** */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
68 gboolean firstoflist; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 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
|
72 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
73 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
74 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
75 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
76 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
77 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
78 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
79 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
80 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
81 /*remove entry from map*/ |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
82 if(xd->xfer_peer_idstring) { |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
83 xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
84 if(xfer) |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
85 g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
86 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
87 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
88 /*empty file & filesize list*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
89 for (l = xd->filename_list; l; l = l->next) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
90 g_free(l->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
91 l->data=NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
92 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
93 for (l = xd->size_list; l; l = l->next) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
94 g_free(l->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
95 l->data=NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
96 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
97 g_slist_free(xd->filename_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
98 g_slist_free(xd->size_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
99 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 g_free(xd->host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 g_free(xd->path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 g_free(xd->txbuf); |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
103 g_free(xd->xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
104 g_free(xd->xfer_idstring_for_relay); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if (xd->tx_handler) |
15823 | 106 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 g_free(xd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
15823 | 110 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
|
111 { |
15823 | 112 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 int remaining, written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 xfer = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 remaining = xd->txbuflen - xd->txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 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
|
121 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 if (written < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 else if (written <= 0) { |
15823 | 125 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
126 purple_xfer_cancel_remote(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 } |
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 if (written < remaining) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 xd->txbuf_written += written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 |
15823 | 135 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 xd->tx_handler = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 g_free(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 xd->txbuf = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 xd->txbuflen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
15823 | 141 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
|
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 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
|
146 { |
15823 | 147 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
15823 | 150 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 "AAA - in yahoo_receivefile_connected\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 if (!(xfer = data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 if (!(xd = xfer->data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { |
15823 | 157 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
|
158 xfer->who, _("Unable to connect.")); |
15823 | 159 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 /* 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
|
166 if (xd->txbuflen == 0) { |
22017
97d530d11cc0
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21803
diff
changeset
|
167 xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", |
97d530d11cc0
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21803
diff
changeset
|
168 xd->path, xd->host); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 xd->txbuflen = strlen(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 xd->txbuf_written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 if (!xd->tx_handler) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 { |
15823 | 175 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
|
176 yahoo_receivefile_send_cb, xfer); |
15823 | 177 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
|
178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
15823 | 181 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
|
182 { |
15823 | 183 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 int written, remaining; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 xfer = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 remaining = xd->txbuflen - xd->txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 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
|
192 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 if (written < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 else if (written <= 0) { |
15823 | 196 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
197 purple_xfer_cancel_remote(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 if (written < remaining) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 xd->txbuf_written += written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 return; |
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 |
15823 | 206 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 xd->tx_handler = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 g_free(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 xd->txbuf = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 xd->txbuflen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
15823 | 212 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
|
213 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 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
|
216 { |
15823 | 217 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 struct yahoo_packet *pkt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 gchar *size, *filename, *encoded_filename, *header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 guchar *pkt_buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 const char *host; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 int port; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 size_t content_length, header_len, pkt_buf_len; |
15823 | 225 PurpleConnection *gc; |
226 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 struct yahoo_data *yd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 |
15823 | 229 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 "AAA - in yahoo_sendfile_connected\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 if (!(xfer = data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 if (!(xd = xfer->data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 if (source < 0) { |
15823 | 237 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
|
238 xfer->who, _("Unable to connect.")); |
15823 | 239 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 /* Assemble the tx buffer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 gc = xd->gc; |
15823 | 247 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 YAHOO_STATUS_AVAILABLE, yd->session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 |
15823 | 253 size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); |
254 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
|
255 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
|
256 |
15823 | 257 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
|
258 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
|
259 g_free(size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 g_free(encoded_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 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
|
264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 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
|
266 yahoo_packet_free(pkt); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
15823 | 268 host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST); |
269 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
|
270 header = g_strdup_printf( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 "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
|
272 "Content-length: %" G_GSIZE_FORMAT "\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 "Host: %s:%d\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 "Cookie: Y=%s; T=%s\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 "\r\n", |
15823 | 276 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
|
277 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
|
278 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 header_len = strlen(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 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
|
282 xd->txbuf = g_malloc(xd->txbuflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 memcpy(xd->txbuf, header, header_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 g_free(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 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
|
287 g_free(pkt_buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 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
|
289 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 xd->txbuf_written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 if (xd->tx_handler == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 { |
15823 | 294 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
|
295 yahoo_sendfile_send_cb, xfer); |
15823 | 296 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
|
297 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
15823 | 300 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
|
301 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 struct yahoo_xfer_data *xfer_data; |
15823 | 303 PurpleConnection *gc; |
304 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 struct yahoo_data *yd; |
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 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 gc = xfer_data->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 yd = gc->proto_data; |
15823 | 310 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
15823 | 312 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
|
313 if (yd->jp) { |
15823 | 314 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), |
315 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
|
316 yahoo_sendfile_connected, xfer) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 { |
15823 | 318 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
|
319 _("Unable to establish file descriptor.")); |
15823 | 320 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } else { |
15823 | 323 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), |
324 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
|
325 yahoo_sendfile_connected, xfer) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 { |
15823 | 327 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
|
328 _("Unable to establish file descriptor.")); |
15823 | 329 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } else { |
20208
63b1ce39965c
applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
333 xfer->fd = -1; |
15823 | 334 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
|
335 yahoo_receivefile_connected, xfer) == NULL) { |
15823 | 336 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
|
337 _("Unable to establish file descriptor.")); |
15823 | 338 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
343 static void yahoo_xfer_init_15(PurpleXfer *xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
344 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
345 struct yahoo_xfer_data *xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
346 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
347 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
348 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
349 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
350 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
351 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
352 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
353 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
354 account = purple_connection_get_account(gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
355 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
356 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
357 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
358 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
359 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
360 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
361 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
362 yahoo_packet_hash(pkt, "sssiiiisiii", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
363 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
364 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
365 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
366 222, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
367 266, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
368 302, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
369 300, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
370 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
371 28, xfer->size, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
372 301, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
373 303, 268); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
374 g_free(filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
375 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
376 if(xfer_data->firstoflist == TRUE) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
377 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
378 YAHOO_STATUS_AVAILABLE, yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
379 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
380 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
381 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
382 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
383 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
384 222, 3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
385 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
386 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
387 YAHOO_STATUS_AVAILABLE, yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
388 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
389 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
390 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
391 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
392 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
393 271, 1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
394 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
395 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
396 yahoo_packet_send_and_free(pkt, yd); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
397 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
398 |
15823 | 399 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
|
400 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 /* 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
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 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
|
405 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 for (i = 0; i < len; i++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 if (!g_ascii_isdigit(l[i])) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 return strtol(l + i, NULL, 10); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 return 0; |
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 |
15823 | 416 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
|
417 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 gchar buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 gchar *start = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 gchar *length; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 gchar *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 int filelen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 struct yahoo_xfer_data *xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
15823 | 426 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
|
427 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 len = read(xfer->fd, buf, sizeof(buf)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 if (len <= 0) { |
15823 | 433 if ((purple_xfer_get_size(xfer) > 0) && |
434 (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) { | |
435 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 if (!xd->started) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 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
|
443 memcpy(xd->rxqueue + xd->rxlen, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 xd->rxlen += len; |
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 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
|
447 /* 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
|
448 * 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
|
449 * [RFC 2616, section 4.2] */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 if (length == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 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
|
452 if (length) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 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
|
454 if (!end) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 if ((filelen = calculate_length(length, len - (length - xd->rxqueue)))) |
15823 | 457 purple_xfer_set_size(xfer, filelen); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 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
|
460 if (start) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 start += 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 if (!start || start > (xd->rxqueue + len)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 xd->started = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 len -= (start - xd->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 memcpy(*buffer, start, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 g_free(xd->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 xd->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 xd->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 memcpy(*buffer, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 return len; |
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 |
15823 | 481 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
|
482 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 struct yahoo_xfer_data *xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 if (!xd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 |
15823 | 489 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
|
490 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 } |
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 len = write(xfer->fd, buffer, size); |
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 if (len == -1) { |
15823 | 496 if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) |
497 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 if ((errno != EAGAIN) && (errno != EINTR)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 return 0; |
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 |
15823 | 503 if ((purple_xfer_get_bytes_sent(xfer) + len) >= purple_xfer_get_size(xfer)) |
504 purple_xfer_set_completed(xfer, TRUE); | |
15374
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 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
15823 | 509 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
|
510 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
515 if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
516 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
517 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
518 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
519 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
520 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
521 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
522 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
523 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
524 account = purple_connection_get_account(gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
525 if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
526 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
527 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
528 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
529 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
530 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
531 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
532 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
533 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
534 66, -1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
535 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
536 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
537 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
538 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
539 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
540 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
541 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
542 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
543 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
544 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
545 222, 2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
546 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
547 yahoo_packet_send_and_free(pkt, yd); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
548 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
549 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
550 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 if (xfer_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 |
15823 | 556 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
|
557 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
562 if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
563 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
564 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
565 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
566 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
567 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
568 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
569 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
570 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
571 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
572 account = purple_connection_get_account(gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
573 if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
574 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
575 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
576 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
577 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
578 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
579 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
580 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
581 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
582 222, 4); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
583 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
584 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
585 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
586 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
587 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
588 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
589 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
590 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
591 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
592 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
593 66, -1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
594 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
595 yahoo_packet_send_and_free(pkt, yd); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
596 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
597 |
22017
97d530d11cc0
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21803
diff
changeset
|
598 if (xfer_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
603 static void yahoo_xfer_end(PurpleXfer *xfer_old) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
604 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
605 struct yahoo_xfer_data *xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
606 PurpleXfer *xfer = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
607 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
608 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
609 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
610 xfer_data = xfer_old->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
611 if(xfer_data && xfer_data->version == 15 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
612 && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
613 && xfer_data->filename_list) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
614 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
615 /* removing top of filename & size list completely */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
616 g_free( xfer_data->filename_list->data ); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
617 g_free( xfer_data->size_list->data ); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
618 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
619 xfer_data->filename_list->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
620 xfer_data->size_list->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
621 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
622 xfer_data->filename_list = g_slist_delete_link(xfer_data->filename_list, xfer_data->filename_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
623 xfer_data->size_list = g_slist_delete_link(xfer_data->size_list, xfer_data->size_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
624 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
625 /* if there are still more files */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
626 if(xfer_data->filename_list) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
627 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
628 gchar* filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
629 long filesize; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
630 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
631 filename = xfer_data->filename_list->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
632 filesize = atol( xfer_data->size_list->data ); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
633 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
634 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
635 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
636 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
637 /* setting up xfer_data for next file's tranfer */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
638 g_free(xfer_data->host); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
639 g_free(xfer_data->path); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
640 g_free(xfer_data->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
641 g_free(xfer_data->rxqueue); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
642 g_free(xfer_data->xfer_idstring_for_relay); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
643 if (xfer_data->tx_handler) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
644 purple_input_remove(xfer_data->tx_handler); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
645 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
646 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
647 xfer_data->port = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
648 xfer_data->expires = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
649 xfer_data->started = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
650 xfer_data->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
651 xfer_data->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
652 xfer_data->txbuf_written = 0; |
22022
eeba86c553be
Fix a couple compile warnings.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22020
diff
changeset
|
653 xfer_data->tx_handler = 0; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
654 xfer_data->rxqueue = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
655 xfer_data->rxlen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
656 xfer_data->xfer_idstring_for_relay = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
657 xfer_data->info_val_249 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
658 xfer_data->status_15 = STARTED; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
659 xfer_data->firstoflist = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
660 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
661 /* Dereference xfer_data from old xfer */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
662 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
663 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
664 /* Build the file transfer handle. */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
665 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
666 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
667 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
668 if (xfer) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
669 /* Set the info about the incoming file. */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
670 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
671 purple_xfer_set_filename(xfer, utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
672 g_free(utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
673 purple_xfer_set_size(xfer, filesize); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
674 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
675 xfer->data = xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
676 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
677 /* Setup our I/O op functions */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
678 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
679 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
680 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
681 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
682 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
683 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
684 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
685 purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
686 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
687 /*update map to current xfer*/ |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
688 g_hash_table_remove(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring); |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
689 g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
690 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
691 /* Now perform the request */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
692 purple_xfer_request(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
693 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
694 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
695 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
696 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
697 if (xfer_data) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
698 yahoo_xfer_data_free(xfer_data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
699 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
700 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
701 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
702 |
15823 | 703 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
|
704 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 GSList *l = pkt->hash; |
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 char *me = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 char *message = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 char *command = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 char *unknown = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 /* 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
|
716 while(l != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
720 switch(pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
721 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
|
722 me = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
723 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
724 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
|
725 from = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
726 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
727 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
|
728 service = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
729 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
730 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
|
731 message = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
732 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
733 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
|
734 command = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
735 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
736 case 63: /* IMVironment name and version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
738 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
739 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
|
740 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
|
741 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
742 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 /* 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
|
748 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
|
749 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 /* 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
|
751 if(strstr(imv, "doodle;") != NULL) |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
752 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
|
753 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 /* 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
|
755 if(!strcmp(imv, ";0")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 /* 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
|
758 yahoo_doodle_command_got_shutdown(gc, from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 |
15823 | 763 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
|
764 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 char *to = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 char *msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 char *url = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 long expires = 0; |
15823 | 771 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 struct yahoo_data *yd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 char *filename = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 unsigned long filesize = 0L; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 GSList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 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
|
782 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
784 switch (pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
785 case 4: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 from = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
787 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
788 case 5: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 to = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
790 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
791 case 14: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 msg = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
793 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
794 case 20: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 url = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
796 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
797 case 38: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 expires = strtol(pair->value, NULL, 10); |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
799 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
800 case 27: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 filename = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
802 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
803 case 28: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 filesize = atol(pair->value); |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
805 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
806 case 49: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 service = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
808 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
809 case 63: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
811 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
812 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 * 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
|
817 * record it for later use. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 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
|
820 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
|
821 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 if (service && (strcmp("FILEXFER", service) != 0)) { |
15823 | 826 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
|
827 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 if (msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 tmp = strchr(msg, '\006'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 if (tmp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 *tmp = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 if (!url || !from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 /* Setup the Yahoo-specific file transfer data */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 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
|
843 xfer_data->gc = gc; |
15823 | 844 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
|
845 g_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
15823 | 849 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
|
850 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
|
851 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 /* Build the file transfer handle. */ |
15823 | 853 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
|
854 if (xfer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 xfer->data = xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 /* Set the info about the incoming file. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 if (filename) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
15823 | 861 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
|
862 g_free(utf8_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 gchar *start, *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 start = g_strrstr(xfer_data->path, "/"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 if (start) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 start++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 end = g_strrstr(xfer_data->path, "?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 if (start && *start && end) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 char *utf8_filename; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 filename = g_strndup(start, end - start); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 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
|
873 g_free(filename); |
15823 | 874 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
|
875 g_free(utf8_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 filename = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 |
15823 | 880 purple_xfer_set_size(xfer, filesize); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 /* Setup our I/O op functions */ |
15823 | 883 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
884 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); | |
885 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); | |
886 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); | |
887 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); | |
888 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); | |
889 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
|
890 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 /* Now perform the request */ |
15823 | 892 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 |
15823 | 896 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
|
897 { |
15823 | 898 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 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
|
900 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 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
|
902 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 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
|
904 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
|
905 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 /* Build the file transfer handle. */ |
15823 | 907 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
|
908 if (xfer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 xfer->data = xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 /* Setup our I/O op functions */ |
15823 | 913 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
914 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); | |
915 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); | |
916 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); | |
917 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); | |
918 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); | |
919 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
|
920 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 return xfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
925 static gchar* yahoo_xfer_new_xfer_id(void) |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
926 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
927 gchar *ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
928 int i,j; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
929 ans = g_strnfill(24, ' '); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
930 ans[23] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
931 ans[22] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
932 for(i = 0; i < 22; i++) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
933 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
934 j = g_random_int_range (0,61); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
935 if(j < 26) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
936 ans[i] = j + 'a'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
937 else if(j < 52) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
938 ans[i] = j - 26 + 'A'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
939 else |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
940 ans[i] = j - 52 + '0'; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
941 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
942 return ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
943 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
944 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
945 static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char *error_message) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
946 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
947 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
948 struct yahoo_xfer_data *xd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
949 struct sockaddr_in *addr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
950 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
951 long actaddr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
952 long a,b,c,d; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
953 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
954 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
955 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
956 gchar *url; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
957 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
958 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
959 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
960 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
961 if (!(xd = xfer->data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
962 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
963 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
964 account = purple_connection_get_account(gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
965 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
966 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
967 if(!hosts) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
968 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
969 purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
970 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
971 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
972 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
973 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
974 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
975 hosts = g_slist_remove(hosts, hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
976 if(!hosts) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
977 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
978 purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
979 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
980 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
981 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
982 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
983 /*TODO:actually, u must try with addr no.1 , if its not working addr no.2 .....*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
984 addr = hosts->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
985 actaddr = addr->sin_addr.s_addr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
986 d = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
987 actaddr = (actaddr - d) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
988 c = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
989 actaddr = (actaddr - c) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
990 b = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
991 actaddr = (actaddr - b) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
992 a = actaddr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
993 if(yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
994 xd->port = YAHOOJP_XFER_RELAY_PORT; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
995 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
996 xd->port = YAHOO_XFER_RELAY_PORT; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
997 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
998 url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
999 if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1000 purple_xfer_cancel_remote(xfer); |
22794 | 1001 g_free(url); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1002 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1003 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1004 g_free(url); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1005 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1006 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1007 hosts = g_slist_remove(hosts, hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1008 addr = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1009 while (hosts != NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1010 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1011 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1012 hosts = g_slist_remove(hosts, hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1013 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1014 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1015 hosts = g_slist_remove(hosts, hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1016 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1017 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1018 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1019 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1020 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1021 yahoo_packet_hash(pkt, "ssssis", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1022 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1023 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1024 265, xd->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1025 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1026 249, 3, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1027 250, xd->host); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1028 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1029 g_free(filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1030 yahoo_packet_send_and_free(pkt, yd); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1031 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1032 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1033 |
15823 | 1034 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
|
1035 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1036 struct yahoo_xfer_data *xfer_data; |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1037 struct yahoo_data *yd = gc->proto_data; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1038 int ver = 0; |
15823 | 1039 PurpleXfer *xfer = yahoo_new_xfer(gc, who); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1040 YahooFriend *yf = yahoo_friend_find(gc, who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1042 /* To determine if we should use yahoo p15 for transfer. Check other user's |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1043 * reported version, but if we're on Yahoo Japan, ignore it. */ |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1044 if(yf && yf->version_id > 500000 && !yd->jp) |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1045 ver = 15; |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1046 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1049 if(ver == 15) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1050 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1051 xfer_data->status_15 = STARTED; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1052 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1053 xfer_data->version = 15; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1054 xfer_data->xfer_peer_idstring = yahoo_xfer_new_xfer_id(); |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1055 g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1056 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1057 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 /* Now perform the request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 if (file) |
15823 | 1060 purple_xfer_request_accepted(xfer, file); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 else |
15823 | 1062 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1064 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1065 static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message);/*using this in recv_cb*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1066 static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputCondition condition) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1067 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1068 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1069 struct yahoo_xfer_data *xd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1070 int did; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1071 gchar* buf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1072 gchar* t; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1073 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1074 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1075 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1076 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1077 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1078 account = purple_connection_get_account(xd->gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1079 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1080 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1081 buf=g_strnfill(1000, 0); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1082 while((did = read(source, buf, 998)) > 0) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1083 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1084 xd->txbuflen += did; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1085 buf[did] = '\0'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1086 t = xd->txbuf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1087 xd->txbuf = g_strconcat(t,buf,NULL); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1088 g_free(t); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1089 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1090 g_free(buf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1091 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1092 if (did < 0 && errno == EAGAIN) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1093 else if (did < 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1094 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1095 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1096 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1097 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1098 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1099 purple_input_remove(xd->tx_handler); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1100 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1101 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1102 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1103 if(xd->status_15 == HEAD_REQUESTED) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1104 xd->status_15 = HEAD_REPLY_RECEIVED; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1105 close(source);/*Is this required?*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1106 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1107 xd->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1108 if (purple_proxy_connect(NULL, account, xd->host, xd->port, yahoo_xfer_connected_15, xfer) == NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1109 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1110 purple_notify_error(gc, NULL, _("File Transfer Failed"), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1111 _("Unable to establish file descriptor.")); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1112 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1113 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1114 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1115 purple_debug_error("yahoo","Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1116 purple_xfer_get_type(xfer), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1117 xd->status_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1118 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1119 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1120 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1121 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1122 static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputCondition condition) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1123 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1124 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1125 struct yahoo_xfer_data *xd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1126 int remaining, written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1127 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1128 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1129 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1130 remaining = xd->txbuflen - xd->txbuf_written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1131 written = write(source, xd->txbuf + xd->txbuf_written, remaining); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1132 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1133 if (written < 0 && errno == EAGAIN) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1134 written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1135 else if (written <= 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1136 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1137 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1138 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1139 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1140 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1141 if (written < remaining) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1142 xd->txbuf_written += written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1143 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1144 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1145 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1146 purple_input_remove(xd->tx_handler); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1147 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1148 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1149 xd->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1150 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1151 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1152 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1153 if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1154 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1155 xd->status_15 = HEAD_REQUESTED; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1156 xd->tx_handler = purple_input_add(source, PURPLE_INPUT_READ, yahoo_xfer_recv_cb_15, xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1157 yahoo_xfer_recv_cb_15(xfer, source, PURPLE_INPUT_READ); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1158 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1159 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1160 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1161 xd->status_15 = TRANSFER_PHASE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1162 xfer->fd = source; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1163 purple_xfer_start(xfer, source, NULL, 0); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1164 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1165 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1166 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1167 xd->status_15 = TRANSFER_PHASE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1168 xfer->fd = source; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1169 purple_xfer_start(xfer, source, NULL, 0); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1170 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1171 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1172 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1173 purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1174 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1175 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1176 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1177 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1178 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1179 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1180 static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1181 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1182 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1183 struct yahoo_xfer_data *xd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1184 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1185 struct yahoo_data* yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1186 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1187 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1188 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1189 if (!(xd = xfer->data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1190 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1191 yd = xd->gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1192 account = purple_connection_get_account(xd->gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1193 if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1194 purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1195 xfer->who, _("Unable to connect.")); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1196 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1197 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1198 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1199 /* The first time we get here, assemble the tx buffer */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1200 if (xd->txbuflen == 0) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1201 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1202 gchar* cookies; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1203 cookies = yahoo_get_cookies(xd->gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1204 if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1205 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1206 if(xd->info_val_249 == 2) |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1207 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1208 /*sending file via p2p, we are connected as client*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1209 xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nContent-Length: %ld\r\nCache-Control: no-cache\r\n\r\n", |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1210 xd->path, |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1211 xd->host, |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1212 (long int)xfer->size); /*to do, add Referer*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1213 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1214 else |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1215 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1216 /*sending file via relaying*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1217 xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\nCookie:%s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nContent-Length: %ld\r\nCache-Control: no-cache\r\n\r\n", |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1218 purple_url_encode(xd->xfer_idstring_for_relay), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1219 purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1220 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1221 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1222 xd->host, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1223 (long int)xfer->size); |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1224 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1225 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1226 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1227 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1228 if(xd->info_val_249 == 1) |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1229 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1230 /*receiving file via p2p, connected as client*/ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1231 xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\nAccept:*/*\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nContent-Length: 0\r\nCache-Control: no-cache\r\n\r\n",xd->path,xd->host); |
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1232 } |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1233 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1234 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1235 /*receiving file via relaying*/ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1236 xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\nAccept:*/*\r\nCookie:%s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost:%s\r\nContent-Length: 0\r\nCache-Control: no-cache\r\n\r\n", |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1237 purple_url_encode(xd->xfer_idstring_for_relay), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1238 purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1239 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1240 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1241 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1242 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1243 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1244 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1245 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1246 if(xd->info_val_249 == 1) |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1247 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1248 /*receiving file via p2p, connected as client*/ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1249 xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nConnection: Keep-Alive\r\n\r\n",xd->path,xd->host); |
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1250 } |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1251 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1252 { |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1253 /*receiving file via relaying*/ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1254 xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\nCookie:%s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost:%s\r\nConnection: Keep-Alive\r\n\r\n", |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1255 purple_url_encode(xd->xfer_idstring_for_relay), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1256 purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1257 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1258 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1259 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1260 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1261 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1262 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1263 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1264 purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1265 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1266 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1267 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1268 xd->txbuflen = strlen(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1269 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1270 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1271 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1272 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1273 if (!xd->tx_handler) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1274 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1275 xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1276 yahoo_xfer_send_cb_15, xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1277 yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1278 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1279 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1280 |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1281 /*send (p2p) file transfer information when we are connected as client*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1282 static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer) |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1283 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1284 struct yahoo_xfer_data *xd; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1285 struct yahoo_packet *pkt; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1286 PurpleAccount *account; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1287 struct yahoo_data *yd; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1288 gchar *filename; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1289 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1290 if (!(xd = xfer->data)) |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1291 return; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1292 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1293 account = purple_connection_get_account(gc); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1294 yd = gc->proto_data; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1295 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1296 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1297 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1298 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1299 yahoo_packet_hash(pkt, "ssssi", |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1300 1, purple_normalize(account, purple_account_get_username(account)), |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1301 5, xfer->who, |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1302 265, xd->xfer_peer_idstring, |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1303 27, filename, |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1304 249, 2); /*249= 2:we are connected as p2p client, and sending file*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1305 xd->info_val_249 = 2; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1306 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1307 g_free(filename); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1308 yahoo_packet_send_and_free(pkt, yd); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1309 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1310 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1311 void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1312 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1313 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1314 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1315 char *imv = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1316 long val_222 = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1317 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1318 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1319 struct yahoo_xfer_data *xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1320 char *service = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1321 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1322 char *xfer_peer_idstring = NULL; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1323 unsigned long filesize = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1324 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1325 GSList *filename_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1326 GSList *size_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1327 int nooffiles = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1328 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1329 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1330 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1331 for (l = pkt->hash; l; l = l->next) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1332 struct yahoo_pair *pair = l->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1333 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1334 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1335 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1336 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1337 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1338 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1339 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1340 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1341 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1342 xfer_peer_idstring = pair->value; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1343 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1344 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1345 filename_list = g_slist_prepend(filename_list, g_strdup(pair->value)); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1346 nooffiles++; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1347 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1348 case 28: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1349 size_list = g_slist_prepend(size_list, g_strdup(pair->value)); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1350 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1351 case 222: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1352 val_222 = atol(pair->value); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1353 /* 1=send, 2=cancel, 3=accept, 4=reject */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1354 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1355 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1356 /*check for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it.*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1357 case 49: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1358 service = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1359 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1360 case 63: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1361 imv = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1362 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1363 /*end check*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1364 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1365 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1366 } |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1367 if(!xfer_peer_idstring) |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1368 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1369 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1370 if(val_222 == 2 || val_222 == 4) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1371 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1372 xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1373 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1374 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1375 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1376 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1377 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1378 if(val_222 == 3) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1379 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1380 xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1381 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1382 if(!xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1383 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1384 /* |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1385 * In the file trans info packet that we must reply with, we are |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1386 * supposed to mention the ip address... |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1387 * purple connect does not give me a way of finding the ip address... |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1388 * so, purple dnsquery is used... but retries, trying with next ip |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1389 * address etc. is not implemented..TODO |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1390 */ |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1391 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1392 /*p2p connection exists, we being p2p client*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1393 if( g_hash_table_lookup(yd->peers, from) ) { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1394 /*send p2p file transfer information when we are connected as client*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1395 yahoo_p2p_client_send_ft_info(gc, xfer); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1396 return; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1397 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1398 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1399 if (yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1400 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1401 purple_dnsquery_a(YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1402 yahoo_xfer_dns_connected_15, xfer); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1403 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1404 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1405 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1406 purple_dnsquery_a(YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, |
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1407 yahoo_xfer_dns_connected_15, xfer); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1408 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1409 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1410 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1411 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1412 /*processing for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it.*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1413 /* |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1414 * The remote user has changed their IMVironment. We |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1415 * record it for later use. |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1416 */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1417 if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1418 g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1419 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1420 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1421 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1422 if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1423 if (service && (strcmp("FILEXFER", service) != 0)) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1424 purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1425 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1426 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1427 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1428 /*end processing*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1429 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1430 if(!filename_list) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1431 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1432 /* have to change list into order in which client at other end sends */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1433 filename_list = g_slist_reverse(filename_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1434 size_list = g_slist_reverse(size_list); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1435 filename = filename_list->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1436 filesize = atol(size_list->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1437 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1438 if(!from) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1439 xfer_data = g_new0(struct yahoo_xfer_data, 1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1440 xfer_data->version = 15; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1441 xfer_data->firstoflist = TRUE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1442 xfer_data->gc = gc; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1443 xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1444 xfer_data->filename_list = filename_list; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1445 xfer_data->size_list = size_list; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1446 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1447 /* Build the file transfer handle. */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1448 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1449 xfer->message = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1450 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1451 if (xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1452 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1453 /* Set the info about the incoming file. */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1454 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1455 purple_xfer_set_filename(xfer, utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1456 g_free(utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1457 purple_xfer_set_size(xfer, filesize); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1458 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1459 xfer->data = xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1460 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1461 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1462 /* Setup our I/O op functions */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1463 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1464 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1465 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1466 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1467 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1468 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1469 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1470 purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1471 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1472 g_hash_table_insert(yd->xfer_peer_idstring_map, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1473 xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1474 xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1475 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1476 if(nooffiles > 1) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1477 gchar* message; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1478 message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1479 purple_xfer_conversation_write(xfer, message, FALSE); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1480 g_free(message); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1481 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1482 /* Now perform the request */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1483 purple_xfer_request(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1484 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1485 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1486 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1487 void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1488 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1489 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1490 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1491 char *url = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1492 long val_249 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1493 long val_66 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1494 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1495 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1496 struct yahoo_xfer_data *xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1497 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1498 char *xfer_peer_idstring = NULL; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1499 char *xfer_idstring_for_relay = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1500 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1501 struct yahoo_packet *pkt_to_send; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1502 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1503 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1504 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1505 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1506 for (l = pkt->hash; l; l = l->next) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1507 struct yahoo_pair *pair = l->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1508 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1509 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1510 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1511 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1512 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1513 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1514 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1515 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1516 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1517 xfer_peer_idstring = pair->value; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1518 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1519 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1520 filename = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1521 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1522 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1523 val_66 = strtol(pair->value, NULL, 10); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1524 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1525 case 249: |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1526 val_249 = strtol(pair->value, NULL, 10); |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1527 /* 249 has value 1 or 2 when doing p2p transfer and value 3 when relaying through yahoo server */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1528 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1529 case 250: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1530 url = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1531 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1532 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1533 xfer_idstring_for_relay = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1534 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1535 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1536 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1537 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1538 if(!xfer_peer_idstring) |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1539 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1540 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1541 xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1542 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1543 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1544 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1545 if(val_66==-1) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1546 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1547 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1548 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1549 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1550 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1551 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1552 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1553 xfer_data->info_val_249 = val_249; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1554 xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1555 if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1556 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1557 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1558 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1559 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1560 account = purple_connection_get_account(xfer_data->gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1561 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1562 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1563 YAHOO_STATUS_AVAILABLE, yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1564 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1565 yahoo_packet_hash(pkt_to_send, "ssssisi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1566 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1567 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1568 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1569 27, xfer->filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1570 249, xfer_data->info_val_249, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1571 251, xfer_data->xfer_idstring_for_relay, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1572 222, 3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1573 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1574 yahoo_packet_send_and_free(pkt_to_send, yd); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1575 if (purple_proxy_connect(NULL, account, xfer_data->host, xfer_data->port, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1576 yahoo_xfer_connected_15, xfer) == NULL) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1577 purple_notify_error(gc, NULL, _("File Transfer Failed"), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1578 _("Unable to establish file descriptor.")); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1579 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1580 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1581 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1582 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1583 /*TODO: Check filename etc. No probs till some hacker comes in the way*/ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1584 void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1585 { |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1586 gchar *xfer_peer_idstring = NULL; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1587 gchar *xfer_idstring_for_relay = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1588 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1589 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1590 struct yahoo_xfer_data *xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1591 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1592 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1593 long val_66 = 0; |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1594 gchar *url = NULL; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1595 int val_249; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1596 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1597 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1598 for (l = pkt->hash; l; l = l->next) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1599 struct yahoo_pair *pair = l->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1600 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1601 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1602 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1603 xfer_idstring_for_relay = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1604 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1605 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1606 xfer_peer_idstring = pair->value; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1607 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1608 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1609 val_66 = atol(pair->value); |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1610 break; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1611 case 249: |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1612 val_249 = atol(pair->value); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1613 break; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1614 case 250: |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1615 url = pair->value; /*we get a p2p url here when sending file, connected as client*/ |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1616 break; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1617 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1618 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1619 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1620 xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1621 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1622 |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1623 if(val_66 == -1 || ( (!(xfer_idstring_for_relay)) && (val_249 != 2) )) |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1624 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1625 purple_xfer_cancel_remote(xfer); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1626 return; |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1627 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1628 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1629 if( (val_249 == 2) && (!(url)) ) |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1630 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1631 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1632 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1633 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1634 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1635 xfer_data = xfer->data; |
25616
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1636 if(url) |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1637 purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1638 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1639 xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1640 xfer_data->status_15 = ACCEPTED; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1641 account = purple_connection_get_account(gc); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1642 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1643 if (purple_proxy_connect(NULL, account, xfer_data->host, xfer_data->port, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1644 yahoo_xfer_connected_15, xfer) == NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1645 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1646 purple_notify_error(gc, NULL, _("File Transfer Failed"),_("Unable to connect")); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1647 purple_xfer_cancel_remote(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1648 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1649 } |