Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/yahoo_filexfer.c @ 25630:63033139c590
minor changes in comments style and alphabetic ordering of header files.
author | Sulabh Mahajan <sulabh@soc.pidgin.im> |
---|---|
date | Sat, 12 Jul 2008 19:44:24 +0000 |
parents | 38d188685f2f |
children | 4dd866b83e8e |
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" |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
29 #include "network.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "proxy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "ft.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "yahoo.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "yahoo_packet.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "yahoo_filexfer.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #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
|
37 #include "yahoo_friend.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 struct yahoo_xfer_data { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 gchar *host; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 gchar *path; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 int port; |
15823 | 43 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 long expires; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 gboolean started; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 gchar *txbuf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 gsize txbuflen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 gsize txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 guint tx_handler; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 gchar *rxqueue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 guint rxlen; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
52 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
|
53 gchar *xfer_idstring_for_relay; |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
54 int version; /* 0 for old, 15 for Y7(YMSG 15) */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
55 int info_val_249; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
56 |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
57 enum { |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
58 STARTED = 0, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
59 HEAD_REQUESTED, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
60 HEAD_REPLY_RECEIVED, |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
61 TRANSFER_PHASE, |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
62 ACCEPTED, |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
63 P2P_HEAD_REQUESTED, |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
64 P2P_HEAD_REPLIED, |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
65 P2P_GET_REQUESTED |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
66 } status_15; |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
67 |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
68 /* 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
|
69 * 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
|
70 GSList *filename_list; |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
71 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
|
72 gboolean firstoflist; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
73 gchar *xfer_url; /* url of the file, used when we are p2p server */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
74 int yahoo_local_p2p_ft_server_fd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
75 int yahoo_local_p2p_ft_server_port; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
76 int yahoo_p2p_ft_server_watcher; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
77 int input_event; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 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
|
81 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
82 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
83 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
84 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
85 GSList *l; |
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 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
88 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
89 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
90 /* remove entry from map */ |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
91 if(xd->xfer_peer_idstring) { |
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
92 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
|
93 if(xfer) |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
94 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
|
95 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
96 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
97 /* empty file & filesize list */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
98 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
|
99 g_free(l->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
100 l->data=NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
101 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
102 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
|
103 g_free(l->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
104 l->data=NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
105 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
106 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
|
107 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
|
108 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 g_free(xd->host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 g_free(xd->path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 g_free(xd->txbuf); |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
112 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
|
113 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
|
114 if (xd->tx_handler) |
15823 | 115 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 g_free(xd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
15823 | 119 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
|
120 { |
15823 | 121 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 int remaining, written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 xfer = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 remaining = xd->txbuflen - xd->txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 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
|
130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 if (written < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 else if (written <= 0) { |
15823 | 134 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
135 purple_xfer_cancel_remote(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 if (written < remaining) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 xd->txbuf_written += written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 |
15823 | 144 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 xd->tx_handler = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 g_free(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 xd->txbuf = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 xd->txbuflen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
15823 | 150 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
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 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
|
155 { |
15823 | 156 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
15823 | 159 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 "AAA - in yahoo_receivefile_connected\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 if (!(xfer = data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 if (!(xd = xfer->data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { |
15823 | 166 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
|
167 xfer->who, _("Unable to connect.")); |
15823 | 168 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 } |
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 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 /* 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
|
175 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
|
176 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
|
177 xd->path, xd->host); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 xd->txbuflen = strlen(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 xd->txbuf_written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 if (!xd->tx_handler) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 { |
15823 | 184 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
|
185 yahoo_receivefile_send_cb, xfer); |
15823 | 186 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
|
187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
15823 | 190 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
|
191 { |
15823 | 192 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 int written, remaining; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 xfer = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 remaining = xd->txbuflen - xd->txbuf_written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 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
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 if (written < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 else if (written <= 0) { |
15823 | 205 purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); |
206 purple_xfer_cancel_remote(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 if (written < remaining) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 xd->txbuf_written += written; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 return; |
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 |
15823 | 215 purple_input_remove(xd->tx_handler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 xd->tx_handler = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 g_free(xd->txbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 xd->txbuf = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 xd->txbuflen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
15823 | 221 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
|
222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 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
|
225 { |
15823 | 226 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 struct yahoo_xfer_data *xd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 struct yahoo_packet *pkt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 gchar *size, *filename, *encoded_filename, *header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 guchar *pkt_buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 const char *host; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 int port; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 size_t content_length, header_len, pkt_buf_len; |
15823 | 234 PurpleConnection *gc; |
235 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 struct yahoo_data *yd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
15823 | 238 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 "AAA - in yahoo_sendfile_connected\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 if (!(xfer = data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 if (!(xd = xfer->data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 return; |
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 if (source < 0) { |
15823 | 246 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
|
247 xfer->who, _("Unable to connect.")); |
15823 | 248 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 /* Assemble the tx buffer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 gc = xd->gc; |
15823 | 256 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 YAHOO_STATUS_AVAILABLE, yd->session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
15823 | 262 size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); |
263 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
|
264 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
|
265 |
15823 | 266 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
|
267 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
|
268 g_free(size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 g_free(encoded_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 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
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 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
|
275 yahoo_packet_free(pkt); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
15823 | 277 host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST); |
278 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
|
279 header = g_strdup_printf( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 "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
|
281 "Content-length: %" G_GSIZE_FORMAT "\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 "Host: %s:%d\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 "Cookie: Y=%s; T=%s\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 "\r\n", |
15823 | 285 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
|
286 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
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 header_len = strlen(header); |
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->txbuflen = header_len + pkt_buf_len + 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 xd->txbuf = g_malloc(xd->txbuflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 memcpy(xd->txbuf, header, header_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 g_free(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 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
|
296 g_free(pkt_buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 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
|
298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 xd->txbuf_written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 if (xd->tx_handler == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 { |
15823 | 303 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
|
304 yahoo_sendfile_send_cb, xfer); |
15823 | 305 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
|
306 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
15823 | 309 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
|
310 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 struct yahoo_xfer_data *xfer_data; |
15823 | 312 PurpleConnection *gc; |
313 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 struct yahoo_data *yd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 gc = xfer_data->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 yd = gc->proto_data; |
15823 | 319 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
15823 | 321 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
|
322 if (yd->jp) { |
15823 | 323 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_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 } else { |
15823 | 332 if (purple_proxy_connect(NULL, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), |
333 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
|
334 yahoo_sendfile_connected, xfer) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 { |
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 } else { |
20208
63b1ce39965c
applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
342 xfer->fd = -1; |
15823 | 343 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
|
344 yahoo_receivefile_connected, xfer) == NULL) { |
15823 | 345 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
|
346 _("Unable to establish file descriptor.")); |
15823 | 347 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
352 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
|
353 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
354 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
|
355 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
356 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
357 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
358 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
359 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
360 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
361 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
362 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
363 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
|
364 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
365 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
|
366 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
367 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
|
368 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
|
369 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
370 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
371 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
|
372 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
|
373 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
374 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
|
375 222, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
376 266, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
377 302, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
378 300, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
379 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
380 28, xfer->size, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
381 301, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
382 303, 268); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
383 g_free(filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
384 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
385 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
|
386 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
|
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 222, 3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
394 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
395 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
|
396 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
|
397 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
398 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
|
399 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
|
400 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
401 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
|
402 271, 1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
403 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
404 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
405 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
|
406 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
407 |
15823 | 408 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
|
409 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 /* 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
|
411 } |
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 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
|
414 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 for (i = 0; i < len; i++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 if (!g_ascii_isdigit(l[i])) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 return strtol(l + i, NULL, 10); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 |
15823 | 425 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
|
426 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 gchar buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 gchar *start = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 gchar *length; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 gchar *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 int filelen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 struct yahoo_xfer_data *xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 |
15823 | 435 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
|
436 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 len = read(xfer->fd, buf, sizeof(buf)); |
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 (len <= 0) { |
15823 | 442 if ((purple_xfer_get_size(xfer) > 0) && |
443 (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) { | |
444 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 if (!xd->started) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 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
|
452 memcpy(xd->rxqueue + xd->rxlen, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 xd->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 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
|
456 /* 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
|
457 * 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
|
458 * [RFC 2616, section 4.2] */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 if (length == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 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
|
461 if (length) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 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
|
463 if (!end) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 if ((filelen = calculate_length(length, len - (length - xd->rxqueue)))) |
15823 | 466 purple_xfer_set_size(xfer, filelen); |
15374
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 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
|
469 if (start) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 start += 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 if (!start || start > (xd->rxqueue + len)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 xd->started = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 len -= (start - xd->rxqueue); |
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 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 memcpy(*buffer, start, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 g_free(xd->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 xd->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 xd->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 memcpy(*buffer, buf, len); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
15823 | 490 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
|
491 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 struct yahoo_xfer_data *xd = xfer->data; |
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 (!xd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 |
15823 | 498 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
|
499 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 } |
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 len = write(xfer->fd, buffer, size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 if (len == -1) { |
15823 | 505 if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) |
506 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 if ((errno != EAGAIN) && (errno != EINTR)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 return 0; |
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 |
15823 | 512 if ((purple_xfer_get_bytes_sent(xfer) + len) >= purple_xfer_get_size(xfer)) |
513 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 |
15823 | 518 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
|
519 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
524 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
|
525 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
526 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
527 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
528 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
529 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
530 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
531 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
532 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
533 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
|
534 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
|
535 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
536 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
|
537 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
538 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
539 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
|
540 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
|
541 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
542 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
|
543 66, -1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
544 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
545 else |
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 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
|
548 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
549 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
550 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
|
551 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
|
552 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
553 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
|
554 222, 2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
555 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
556 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
|
557 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
558 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
559 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 if (xfer_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 |
15823 | 565 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
|
566 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
571 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
|
572 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
573 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
574 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
575 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
576 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
577 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
578 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
579 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
580 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
581 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
|
582 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
|
583 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
584 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
|
585 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
586 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
587 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
|
588 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
|
589 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
590 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
|
591 222, 4); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
592 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
593 else |
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 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
|
596 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
597 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
598 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
|
599 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
|
600 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
601 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
|
602 66, -1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
603 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
604 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
|
605 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
606 |
22017
97d530d11cc0
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21803
diff
changeset
|
607 if (xfer_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
612 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
|
613 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
614 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
|
615 PurpleXfer *xfer = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
616 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
617 struct yahoo_data *yd; |
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 = xfer_old->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
620 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
|
621 && 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
|
622 && 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 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
624 /* 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
|
625 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
|
626 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
|
627 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
628 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
|
629 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
|
630 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
631 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
|
632 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
|
633 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
634 /* 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
|
635 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
|
636 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
637 gchar* filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
638 long filesize; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
639 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
640 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
|
641 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
|
642 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
643 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
644 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
645 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
646 /* 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
|
647 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
|
648 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
|
649 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
|
650 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
|
651 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
|
652 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
|
653 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
|
654 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
655 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
656 xfer_data->port = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
657 xfer_data->expires = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
658 xfer_data->started = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
659 xfer_data->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
660 xfer_data->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
661 xfer_data->txbuf_written = 0; |
22022
eeba86c553be
Fix a couple compile warnings.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22020
diff
changeset
|
662 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
|
663 xfer_data->rxqueue = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
664 xfer_data->rxlen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
665 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
|
666 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
|
667 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
|
668 xfer_data->firstoflist = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
669 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
670 /* 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
|
671 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
672 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
673 /* 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
|
674 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
|
675 |
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 if (xfer) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
678 /* 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
|
679 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
|
680 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
|
681 g_free(utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
682 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
|
683 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
684 xfer->data = xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
685 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
686 /* 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 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
|
695 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
696 /* update map to current xfer */ |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
697 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
|
698 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
|
699 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
700 /* Now perform the request */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
701 purple_xfer_request(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
702 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
703 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
704 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
705 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
706 if (xfer_data) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
707 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
|
708 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
709 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
710 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
711 |
15823 | 712 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
|
713 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 GSList *l = pkt->hash; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 char *me = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 char *message = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 char *command = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 char *unknown = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 /* 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
|
725 while(l != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
729 switch(pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
730 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
|
731 me = 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 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
|
734 from = 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 49: /* Get the type of service */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 service = 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 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
|
740 message = pair->value; |
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 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
|
743 command = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
744 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
745 case 63: /* IMVironment name and version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
747 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
748 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
|
749 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
|
750 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
751 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 /* 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
|
757 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
|
758 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 /* 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
|
760 if(strstr(imv, "doodle;") != NULL) |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
761 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
|
762 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 /* 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
|
764 if(!strcmp(imv, ";0")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 /* 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
|
767 yahoo_doodle_command_got_shutdown(gc, from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 |
15823 | 772 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
|
773 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 char *to = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 char *msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 char *url = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 long expires = 0; |
15823 | 780 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 struct yahoo_data *yd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 char *filename = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 unsigned long filesize = 0L; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 GSList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 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
|
791 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
793 switch (pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
794 case 4: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 from = 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 5: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 to = pair->value; |
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 14: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 msg = 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 20: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 url = 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 38: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 expires = strtol(pair->value, NULL, 10); |
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 27: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 filename = 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 case 28: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 filesize = atol(pair->value); |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
814 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
815 case 49: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 service = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
817 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
818 case 63: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
820 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
821 } |
15374
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 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 * 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
|
826 * record it for later use. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 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
|
829 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
|
830 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 if (service && (strcmp("FILEXFER", service) != 0)) { |
15823 | 835 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
|
836 return; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 if (msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 tmp = strchr(msg, '\006'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 if (tmp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 *tmp = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 if (!url || !from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 /* Setup the Yahoo-specific file transfer data */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 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
|
852 xfer_data->gc = gc; |
15823 | 853 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
|
854 g_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
15823 | 858 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
|
859 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
|
860 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 /* Build the file transfer handle. */ |
15823 | 862 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
|
863 if (xfer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 xfer->data = xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 /* Set the info about the incoming file. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 if (filename) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
15823 | 870 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
|
871 g_free(utf8_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 gchar *start, *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 start = g_strrstr(xfer_data->path, "/"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 if (start) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 start++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 end = g_strrstr(xfer_data->path, "?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 if (start && *start && end) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 char *utf8_filename; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 filename = g_strndup(start, end - start); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 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
|
882 g_free(filename); |
15823 | 883 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
|
884 g_free(utf8_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 filename = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 |
15823 | 889 purple_xfer_set_size(xfer, filesize); |
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 /* Setup our I/O op functions */ |
15823 | 892 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
893 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); | |
894 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); | |
895 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); | |
896 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); | |
897 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); | |
898 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
|
899 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 /* Now perform the request */ |
15823 | 901 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 |
15823 | 905 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
|
906 { |
15823 | 907 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 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
|
909 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 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
|
911 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 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
|
913 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
|
914 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 /* Build the file transfer handle. */ |
15823 | 916 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
|
917 if (xfer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 xfer->data = xfer_data; |
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 /* Setup our I/O op functions */ |
15823 | 922 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
923 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); | |
924 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); | |
925 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); | |
926 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); | |
927 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); | |
928 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
|
929 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 return xfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
934 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
|
935 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
936 gchar *ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
937 int i,j; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
938 ans = g_strnfill(24, ' '); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
939 ans[23] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
940 ans[22] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
941 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
|
942 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
943 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
|
944 if(j < 26) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
945 ans[i] = j + 'a'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
946 else if(j < 52) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
947 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
|
948 else |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
949 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
|
950 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
951 return ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
952 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
953 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
954 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
|
955 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
956 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
957 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
|
958 struct sockaddr_in *addr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
959 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
960 long actaddr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
961 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
|
962 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
963 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
964 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
965 gchar *url; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
966 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
967 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
968 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
969 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
970 if (!(xd = xfer->data)) |
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 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
973 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
|
974 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
975 |
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 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
984 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
|
985 if(!hosts) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
986 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
987 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
|
988 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
|
989 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
990 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
991 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
992 /* TODO:actually, u must try with addr no.1 , if its not working addr no.2 ..... */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
993 addr = hosts->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
994 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
|
995 d = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
996 actaddr = (actaddr - d) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
997 c = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
998 actaddr = (actaddr - c) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
999 b = actaddr % 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1000 actaddr = (actaddr - b) / 256; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1001 a = actaddr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1002 if(yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1003 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
|
1004 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1005 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
|
1006 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1007 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
|
1008 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
|
1009 purple_xfer_cancel_remote(xfer); |
22794 | 1010 g_free(url); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1011 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1012 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1013 g_free(url); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1014 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1015 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1016 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
|
1017 addr = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1018 while (hosts != NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1019 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1020 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1021 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
|
1022 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1023 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1024 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
|
1025 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1026 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1027 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
|
1028 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
|
1029 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1030 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
|
1031 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
|
1032 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1033 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
|
1034 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1035 249, 3, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1036 250, xd->host); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1037 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1038 g_free(filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1039 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
|
1040 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1041 |
15823 | 1042 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
|
1043 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1044 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
|
1045 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
|
1046 int ver = 0; |
15823 | 1047 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
|
1048 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
|
1049 |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1050 /* 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
|
1051 * 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
|
1052 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
|
1053 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
|
1054 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1057 if(ver == 15) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1058 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1059 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
|
1060 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
|
1061 xfer_data->version = 15; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1062 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
|
1063 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
|
1064 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1065 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 /* Now perform the request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 if (file) |
15823 | 1068 purple_xfer_request_accepted(xfer, file); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 else |
15823 | 1070 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1072 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1073 static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data); /* using this in yahoo_xfer_send_cb_15 */ |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1074 static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message);/* using this in recv_cb */ |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1075 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1076 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
|
1077 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1078 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1079 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
|
1080 int did; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1081 gchar* buf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1082 gchar* t; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1083 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1084 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1085 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1086 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1087 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1088 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
|
1089 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1090 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1091 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
|
1092 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
|
1093 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1094 xd->txbuflen += did; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1095 buf[did] = '\0'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1096 t = xd->txbuf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1097 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
|
1098 g_free(t); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1099 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1100 g_free(buf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1101 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1102 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
|
1103 else if (did < 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1104 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
|
1105 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
|
1106 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1107 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1108 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1109 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
|
1110 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1111 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1112 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1113 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
|
1114 xd->status_15 = HEAD_REPLY_RECEIVED; |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1115 close(source);/* Is this required? */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1116 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1117 xd->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1118 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
|
1119 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1120 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
|
1121 _("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
|
1122 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
|
1123 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1124 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1125 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
|
1126 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
|
1127 xd->status_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1128 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1129 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1130 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1131 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1132 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
|
1133 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1134 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1135 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
|
1136 int remaining, written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1137 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1138 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1139 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1140 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
|
1141 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
|
1142 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1143 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
|
1144 written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1145 else if (written <= 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1146 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
|
1147 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
|
1148 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1149 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1150 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1151 if (written < remaining) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1152 xd->txbuf_written += written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1153 return; |
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 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1156 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
|
1157 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1158 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1159 xd->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1160 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1161 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1162 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1163 if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1164 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1165 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
|
1166 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
|
1167 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
|
1168 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1169 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
|
1170 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1171 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
|
1172 xfer->fd = source; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1173 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
|
1174 } |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1175 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && (xd->status_15 == ACCEPTED || xd->status_15 == P2P_GET_REQUESTED) ) |
22018
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 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
|
1178 xfer->fd = source; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1179 /* Remove Read event */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1180 purple_input_remove(xd->input_event); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1181 xd->input_event = 0; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1182 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
|
1183 } |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1184 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == P2P_HEAD_REQUESTED) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1185 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1186 xd->status_15 = P2P_HEAD_REPLIED; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1187 /* Remove Read event and close descriptor */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1188 purple_input_remove(xd->input_event); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1189 xd->input_event = 0; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1190 close(source); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1191 xfer->fd = -1; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1192 /* start local server, listen for connections */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1193 purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1194 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1195 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1196 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1197 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
|
1198 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1199 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1200 } |
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 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
|
1203 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1204 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1205 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
|
1206 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1207 struct yahoo_data* yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1208 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1209 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1210 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1211 if (!(xd = xfer->data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1212 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1213 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
|
1214 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
|
1215 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
|
1216 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
|
1217 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
|
1218 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
|
1219 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1220 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1221 /* 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
|
1222 if (xd->txbuflen == 0) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1223 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1224 gchar* cookies; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1225 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
|
1226 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
|
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 == 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
|
1229 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1230 /* sending file via p2p, we are connected as client */ |
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
|
1231 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
|
1232 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
|
1233 xd->host, |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1234 (long int)xfer->size); /* to do, add Referer */ |
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 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1236 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
|
1237 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1238 /* sending file via relaying */ |
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
|
1239 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
|
1240 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
|
1241 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
|
1242 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1243 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1244 xd->host, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1245 (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
|
1246 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1247 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1248 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
|
1249 { |
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
|
1250 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
|
1251 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1252 /* 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
|
1253 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
|
1254 } |
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
|
1255 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1256 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1257 /* receiving file via relaying */ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1258 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
|
1259 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
|
1260 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
|
1261 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1262 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1263 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1264 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1265 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1266 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
|
1267 { |
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
|
1268 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
|
1269 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1270 /* 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
|
1271 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
|
1272 } |
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
|
1273 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1274 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1275 /* receiving file via relaying */ |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1276 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
|
1277 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
|
1278 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
|
1279 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1280 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1281 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1282 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1283 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1284 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1285 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1286 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
|
1287 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1288 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1289 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1290 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
|
1291 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1292 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1293 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1294 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1295 if (!xd->tx_handler) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1296 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1297 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
|
1298 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
|
1299 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
|
1300 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1301 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1302 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1303 static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputCondition cond) |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1304 { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1305 PurpleXfer *xfer; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1306 struct yahoo_xfer_data *xd; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1307 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1308 xfer = data; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1309 if (!(xd = xfer->data)) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1310 purple_input_remove(xd->input_event); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1311 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1312 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1313 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1314 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1315 purple_input_remove(xd->input_event); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1316 xd->status_15 = TRANSFER_PHASE; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1317 xfer->fd = source; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1318 purple_xfer_start(xfer, source, NULL, 0); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1319 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1320 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1321 static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCondition cond) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1322 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1323 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1324 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1325 guchar buf[1024]; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1326 int len; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1327 char *url_head; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1328 char *url_get; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1329 time_t unix_time; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1330 char *time_str; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1331 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1332 xfer = data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1333 if (!(xd = xfer->data)) { |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1334 purple_input_remove(xd->input_event); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1335 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1336 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1337 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1338 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1339 len = read(source, buf, sizeof(buf)); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1340 if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1341 return ; /* No Worries*/ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1342 else if (len <= 0) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1343 purple_debug_warning("yahoo","p2p-ft: Error in connection, or host disconnected\n"); |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1344 purple_input_remove(xd->input_event); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1345 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1346 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1347 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1348 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1349 url_head = g_strdup_printf("HEAD %s", xd->xfer_url); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1350 url_get = g_strdup_printf("GET %s", xd->xfer_url); |
25623
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1351 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1352 if( strncmp(url_head, (char *)buf, strlen(url_head)) == 0 ) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1353 xd->status_15 = P2P_HEAD_REQUESTED; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1354 else if( strncmp(url_get, (char *)buf, strlen(url_get)) == 0 ) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1355 xd->status_15 = P2P_GET_REQUESTED; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1356 else { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1357 purple_debug_warning("yahoo","p2p-ft: Wrong HEAD/GET request from peer, disconnecting host\n"); |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1358 purple_input_remove(xd->input_event); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1359 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1360 g_free(url_head); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1361 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1362 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1363 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1364 unix_time = time(NULL); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1365 time_str = ctime(&unix_time); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1366 strcpy(time_str + strlen(time_str) - 1, "\0"); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1367 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1368 if (xd->txbuflen == 0) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1369 xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\nDate: %s GMT\r\nServer: Y!/1.0\r\nMIME-version: 1.0\r\nLast-modified: %s GMT\r\nContent-length: %d\r\n\r\n", time_str, time_str, xfer->size); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1370 xd->txbuflen = strlen(xd->txbuf); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1371 xd->txbuf_written = 0; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1372 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1373 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1374 if (!xd->tx_handler) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1375 xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_xfer_send_cb_15, xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1376 yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1377 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1378 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1379 g_free(url_head); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1380 g_free(url_get); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1381 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1382 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1383 static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1384 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1385 int acceptfd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1386 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1387 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1388 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1389 xfer = data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1390 if (!(xd = xfer->data)) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1391 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1392 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1393 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1394 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1395 acceptfd = accept(source, NULL, 0); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1396 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1397 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1398 else if(acceptfd == -1) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1399 purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1400 purple_xfer_cancel_remote(xfer); |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1401 /* remove watcher and close p2p ft server */ |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1402 purple_input_remove(xd->yahoo_p2p_ft_server_watcher); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1403 close(xd->yahoo_local_p2p_ft_server_fd); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1404 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1405 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1406 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1407 /* remove watcher and close p2p ft server */ |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1408 purple_input_remove(xd->yahoo_p2p_ft_server_watcher); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1409 close(xd->yahoo_local_p2p_ft_server_fd); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1410 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1411 /* Add an Input Read event to the file descriptor */ |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1412 xfer->fd = acceptfd; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1413 if(xfer->type == PURPLE_XFER_RECEIVE) |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1414 xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1415 else |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1416 xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_HEAD_GET_cb, data); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1417 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1418 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1419 static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1420 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1421 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1422 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1423 struct yahoo_packet *pkt; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1424 PurpleAccount *account; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1425 struct yahoo_data *yd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1426 gchar *filename; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1427 const char *local_ip; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1428 gchar *url_to_send = NULL; |
25623
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1429 char **split; |
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1430 char *filename_without_spaces = NULL; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1431 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1432 xfer = data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1433 if ( !( (xd = xfer->data) || (listenfd != -1) ) ) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1434 purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1435 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1436 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1437 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1438 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1439 if( (xfer->type == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1440 yd = xd->gc->proto_data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1441 account = purple_connection_get_account(xd->gc); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1442 local_ip = purple_network_get_my_ip(listenfd); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1443 xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd); |
25623
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1444 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1445 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
25623
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1446 split = g_strsplit(filename, " ", 0); |
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1447 filename_without_spaces = g_strjoinv("+", split); |
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1448 xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1449 url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1450 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1451 if(xfer->type == PURPLE_XFER_RECEIVE) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1452 xd->info_val_249 = 2; /* 249=2: we are p2p server, and receiving file */ |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1453 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1454 YAHOO_STATUS_AVAILABLE, yd->session_id); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1455 yahoo_packet_hash(pkt, "ssssis", |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1456 1, purple_normalize(account, purple_account_get_username(account)), |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1457 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1458 265, xd->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1459 27, xfer->filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1460 249, 2, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1461 250, url_to_send); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1462 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1463 else { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1464 xd->info_val_249 = 1; /* 249=1: we are p2p server, and sending file */ |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1465 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1466 yahoo_packet_hash(pkt, "ssssis", |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1467 1, purple_normalize(account, purple_account_get_username(account)), |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1468 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1469 265, xd->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1470 27, filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1471 249, 1, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1472 250, url_to_send); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1473 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1474 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1475 yahoo_packet_send_and_free(pkt, yd); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1476 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1477 g_free(filename); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1478 g_free(url_to_send); |
25623
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1479 g_strfreev(split); |
d96190de653a
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25622
diff
changeset
|
1480 g_free(filename_without_spaces); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1481 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1482 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1483 /* Add an Input Read event to the file descriptor */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1484 xd->yahoo_local_p2p_ft_server_fd = listenfd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1485 xd->yahoo_p2p_ft_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_ft_server_send_connected_cb, data); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1486 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1487 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1488 /* send (p2p) file transfer information */ |
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
|
1489 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
|
1490 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1491 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
|
1492 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
|
1493 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
|
1494 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
|
1495 gchar *filename; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1496 struct yahoo_p2p_data *p2p_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
|
1497 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1498 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
|
1499 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
|
1500 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1501 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
|
1502 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
|
1503 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1504 p2p_data = g_hash_table_lookup(yd->peers, xfer->who); |
25629
38d188685f2f
changed gboolean connection_type to enum yahoo_p2p_connection_type
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25624
diff
changeset
|
1505 if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1506 if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1507 return; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1508 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1509 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1510 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1511 |
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
|
1512 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
|
1513 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
|
1514 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
|
1515 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
|
1516 27, filename, |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1517 249, 2); /* 249=2: we are p2p client */ |
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
|
1518 xd->info_val_249 = 2; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1519 yahoo_packet_send_and_free(pkt, yd); |
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
|
1520 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1521 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
|
1522 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1523 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1524 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
|
1525 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1526 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1527 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1528 char *imv = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1529 long val_222 = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1530 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1531 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1532 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
|
1533 char *service = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1534 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1535 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
|
1536 unsigned long filesize = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1537 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1538 GSList *filename_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1539 GSList *size_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1540 int nooffiles = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1541 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1542 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1543 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1544 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
|
1545 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
|
1546 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1547 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1548 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1549 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1550 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1551 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1552 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1553 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1554 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1555 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
|
1556 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1557 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1558 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
|
1559 nooffiles++; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1560 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1561 case 28: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1562 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
|
1563 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1564 case 222: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1565 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
|
1566 /* 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
|
1567 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1568 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1569 /* 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. */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1570 case 49: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1571 service = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1572 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1573 case 63: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1574 imv = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1575 break; |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1576 /* end check */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1577 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1578 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1579 } |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1580 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
|
1581 return; |
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 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
|
1584 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1585 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
|
1586 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1587 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1588 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
|
1589 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1590 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1591 if(val_222 == 3) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1592 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1593 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
|
1594 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1595 if(!xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1596 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1597 /* |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1598 * 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
|
1599 * 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
|
1600 * 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
|
1601 * 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
|
1602 * 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
|
1603 */ |
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
|
1604 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1605 /* To send through p2p */ |
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
|
1606 if( g_hash_table_lookup(yd->peers, from) ) { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1607 /* send p2p file transfer information */ |
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
|
1608 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
|
1609 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
|
1610 } |
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 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1612 if (yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1613 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1614 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
|
1615 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
|
1616 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1617 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1618 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1619 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
|
1620 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
|
1621 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1622 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1623 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1624 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1625 /* 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. */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1626 /* |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1627 * 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
|
1628 * 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
|
1629 */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1630 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
|
1631 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
|
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 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
|
1636 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
|
1637 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
|
1638 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1639 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1640 } |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1641 /* end processing */ |
22018
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(!filename_list) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1644 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1645 /* 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
|
1646 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
|
1647 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
|
1648 filename = filename_list->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1649 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
|
1650 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1651 if(!from) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1652 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
|
1653 xfer_data->version = 15; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1654 xfer_data->firstoflist = TRUE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1655 xfer_data->gc = gc; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1656 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
|
1657 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
|
1658 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
|
1659 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1660 /* 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
|
1661 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
|
1662 xfer->message = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1663 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1664 if (xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1665 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1666 /* 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
|
1667 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
|
1668 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
|
1669 g_free(utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1670 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
|
1671 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1672 xfer->data = xfer_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1673 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1674 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1675 /* 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
|
1676 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
|
1677 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
|
1678 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
|
1679 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
|
1680 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
|
1681 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
|
1682 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
|
1683 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
|
1684 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1685 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
|
1686 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
|
1687 xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1688 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1689 if(nooffiles > 1) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1690 gchar* message; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1691 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
|
1692 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
|
1693 g_free(message); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1694 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1695 /* Now perform the request */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1696 purple_xfer_request(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1697 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1698 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1699 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1700 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
|
1701 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1702 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1703 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1704 char *url = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1705 long val_249 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1706 long val_66 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1707 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1708 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1709 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
|
1710 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1711 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
|
1712 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
|
1713 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1714 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
|
1715 PurpleAccount *account; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1716 struct yahoo_p2p_data *p2p_data; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1717 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1718 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1719 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1720 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
|
1721 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
|
1722 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1723 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1724 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1725 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1726 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1727 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1728 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1729 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1730 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1731 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
|
1732 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1733 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1734 filename = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1735 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1736 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1737 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
|
1738 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1739 case 249: |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1740 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
|
1741 /* 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
|
1742 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1743 case 250: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1744 url = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1745 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1746 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1747 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
|
1748 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1749 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1750 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1751 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1752 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
|
1753 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1754 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1755 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
|
1756 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1757 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1758 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1759 if(val_66==-1) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1760 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1761 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
|
1762 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1763 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1764 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1765 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1766 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1767 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
|
1768 xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1769 if(val_249 == 1 || val_249 == 3) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1770 if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1771 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1772 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1773 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1774 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1775 account = purple_connection_get_account(xfer_data->gc); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1776 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1777 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1778 YAHOO_STATUS_AVAILABLE, yd->session_id); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1779 yahoo_packet_hash(pkt_to_send, "ssssisi", |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1780 1, purple_normalize(account, purple_account_get_username(account)), |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1781 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1782 265, xfer_data->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1783 27, xfer->filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1784 249, xfer_data->info_val_249, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1785 251, xfer_data->xfer_idstring_for_relay, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1786 222, 3); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1787 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1788 yahoo_packet_send_and_free(pkt_to_send, yd); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1789 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1790 if (purple_proxy_connect(NULL, account, xfer_data->host, xfer_data->port, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1791 yahoo_xfer_connected_15, xfer) == NULL) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1792 purple_notify_error(gc, NULL, _("File Transfer Failed"), |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1793 _("Unable to establish file descriptor.")); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1794 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1795 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1796 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1797 else if(val_249 == 2) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1798 p2p_data = g_hash_table_lookup(yd->peers, xfer->who); |
25629
38d188685f2f
changed gboolean connection_type to enum yahoo_p2p_connection_type
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25624
diff
changeset
|
1799 if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) ) { |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1800 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1801 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1802 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1803 if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1804 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1805 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1806 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1807 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1808 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1809 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1810 /* TODO: Check filename etc. No probs till some hacker comes in the way */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1811 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
|
1812 { |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1813 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
|
1814 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
|
1815 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1816 struct yahoo_data *yd; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1817 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
|
1818 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1819 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1820 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
|
1821 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
|
1822 int val_249; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1823 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1824 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1825 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
|
1826 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
|
1827 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1828 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1829 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1830 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
|
1831 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1832 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1833 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
|
1834 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1835 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1836 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
|
1837 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
|
1838 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
|
1839 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
|
1840 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
|
1841 case 250: |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1842 url = pair->value; /* we get a p2p url here when sending file, connected as client */ |
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
|
1843 break; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1844 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1845 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1846 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1847 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
|
1848 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1849 |
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
|
1850 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
|
1851 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1852 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
|
1853 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
|
1854 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1855 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1856 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
|
1857 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1858 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
|
1859 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1860 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1861 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1862 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
|
1863 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
|
1864 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
|
1865 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1866 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
|
1867 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
|
1868 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
|
1869 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1870 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
|
1871 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
|
1872 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1873 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
|
1874 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
|
1875 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1876 } |