Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/yahoo_filexfer.c @ 31648:fa88dc1dcabb
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 12 Feb 2011 04:17:09 +0900 |
parents | c5ba7dd399fa |
children | 6b3bc0947068 |
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" |
27395
ef5f0cde8d74
Update for file renames.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27384
diff
changeset
|
33 #include "libymsg.h" |
15374
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; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
83 YahooData *yd; |
22018
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 |
27384
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27263
diff
changeset
|
159 purple_debug_info("yahoo", "in yahoo_receivefile_connected\n"); |
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27263
diff
changeset
|
160 |
15374
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; |
27754
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
229 gchar *size, *filename, *encoded_filename, *header, *tmp = NULL; |
15374
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; | |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
236 YahooData *yd; |
27773
0f3a131d23da
- import nosuke's hash 244 patch and others to yahoo plugin
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
27766
diff
changeset
|
237 gsize dummy; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 |
27384
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27263
diff
changeset
|
239 purple_debug_info("yahoo", "in yahoo_sendfile_connected\n"); |
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27263
diff
changeset
|
240 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 if (!(xfer = data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 if (!(xd = xfer->data)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 if (source < 0) { |
15823 | 247 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
|
248 xfer->who, _("Unable to connect.")); |
15823 | 249 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 return; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 /* Assemble the tx buffer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 gc = xd->gc; |
15823 | 257 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 YAHOO_STATUS_AVAILABLE, yd->session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
15823 | 263 size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); |
27754
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
264 |
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
265 /* yaz */ |
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
266 tmp = g_filename_display_basename(purple_xfer_get_local_filename(xfer)); |
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
267 filename = botch_utf(tmp, strlen(tmp), &dummy); |
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
268 g_free(tmp); |
754a82f1371b
half baked fixes for file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
21803
diff
changeset
|
269 encoded_filename = yahoo_string_encode(gc, filename, NULL); // this takes utf8 as input. --yaz |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
15823 | 271 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
|
272 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
|
273 g_free(size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 g_free(encoded_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 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
|
278 |
24326
af8b35c7730d
Patch from 'siddish' to fix Yahoo! file transfers with older (i.e. non-p15)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22794
diff
changeset
|
279 pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 yahoo_packet_free(pkt); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
15823 | 282 host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST); |
283 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
|
284 header = g_strdup_printf( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 "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
|
286 "Content-length: %" G_GSIZE_FORMAT "\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 "Host: %s:%d\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 "Cookie: Y=%s; T=%s\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 "\r\n", |
15823 | 290 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
|
291 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
|
292 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 header_len = strlen(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 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
|
296 xd->txbuf = g_malloc(xd->txbuflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 memcpy(xd->txbuf, header, header_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 g_free(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 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
|
301 g_free(pkt_buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 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
|
303 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 xd->txbuf_written = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 if (xd->tx_handler == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 { |
15823 | 308 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
|
309 yahoo_sendfile_send_cb, xfer); |
15823 | 310 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
|
311 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
15823 | 314 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
|
315 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 struct yahoo_xfer_data *xfer_data; |
15823 | 317 PurpleConnection *gc; |
318 PurpleAccount *account; | |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
319 YahooData *yd; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 gc = xfer_data->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 yd = gc->proto_data; |
15823 | 324 account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
15823 | 326 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
|
327 if (yd->jp) { |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
328 if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), |
15823 | 329 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
|
330 yahoo_sendfile_connected, xfer) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 { |
15823 | 332 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
|
333 _("Unable to establish file descriptor.")); |
15823 | 334 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 } else { |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
337 if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), |
15823 | 338 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
|
339 yahoo_sendfile_connected, xfer) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 { |
15823 | 341 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
|
342 _("Unable to establish file descriptor.")); |
15823 | 343 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 } else { |
20208
63b1ce39965c
applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
347 xfer->fd = -1; |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
348 if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, |
20208
63b1ce39965c
applied changes from 7f71045586c32cffc40f836f3fba92c693adda57
Richard Laager <rlaager@wiktel.com>
parents:
19680
diff
changeset
|
349 yahoo_receivefile_connected, xfer) == NULL) { |
15823 | 350 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
|
351 _("Unable to establish file descriptor.")); |
15823 | 352 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
357 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
|
358 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
359 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
|
360 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
361 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
362 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
363 struct yahoo_packet *pkt; |
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 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
366 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
367 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
368 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
|
369 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
370 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
|
371 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
372 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
|
373 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
|
374 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
375 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
376 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
|
377 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
|
378 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
379 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
|
380 222, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
381 266, 1, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
382 302, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
383 300, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
384 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
385 28, xfer->size, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
386 301, 268, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
387 303, 268); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
388 g_free(filename); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
389 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
390 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
|
391 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
|
392 YAHOO_STATUS_AVAILABLE, yd->session_id); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
393 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
394 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
|
395 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
|
396 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
397 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
|
398 222, 3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
399 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
400 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
|
401 YAHOO_STATUS_AVAILABLE, yd->session_id); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
402 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
403 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
|
404 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
|
405 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
406 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
|
407 271, 1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
408 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
409 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
410 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
|
411 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
412 |
15823 | 413 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
|
414 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 /* 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
|
416 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 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
|
419 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 int i; |
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 for (i = 0; i < len; i++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 if (!g_ascii_isdigit(l[i])) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 return strtol(l + i, NULL, 10); |
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 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 |
15823 | 430 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
|
431 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 gchar buf[4096]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 gchar *start = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 gchar *length; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 gchar *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 int filelen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 struct yahoo_xfer_data *xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 |
15823 | 440 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
|
441 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 len = read(xfer->fd, buf, sizeof(buf)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 if (len <= 0) { |
15823 | 447 if ((purple_xfer_get_size(xfer) > 0) && |
448 (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) { | |
449 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 } |
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 if (!xd->started) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 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
|
457 memcpy(xd->rxqueue + xd->rxlen, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 xd->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 |
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 /* 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
|
462 * 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
|
463 * [RFC 2616, section 4.2] */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 if (length == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 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
|
466 if (length) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 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
|
468 if (!end) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 if ((filelen = calculate_length(length, len - (length - xd->rxqueue)))) |
15823 | 471 purple_xfer_set_size(xfer, filelen); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 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
|
474 if (start) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 start += 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 if (!start || start > (xd->rxqueue + len)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 xd->started = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 len -= (start - xd->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 memcpy(*buffer, start, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 g_free(xd->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 xd->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 xd->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 *buffer = g_malloc(len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 memcpy(*buffer, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 } |
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 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 |
15823 | 495 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
|
496 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 gssize len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 struct yahoo_xfer_data *xd = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 if (!xd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 |
15823 | 503 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
|
504 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 len = write(xfer->fd, buffer, size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 if (len == -1) { |
15823 | 510 if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) |
511 purple_xfer_set_completed(xfer, TRUE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 if ((errno != EAGAIN) && (errno != EINTR)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 } |
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 return len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
15823 | 520 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
|
521 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
526 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
|
527 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
528 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
529 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
530 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
531 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
532 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
533 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
534 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
535 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
|
536 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
|
537 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
538 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
539 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
540 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
541 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
542 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
543 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
544 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
545 66, -1); |
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 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
548 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
549 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
|
550 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
551 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
552 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
|
553 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
|
554 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
555 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
|
556 222, 2); |
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 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
|
559 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
560 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
561 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 if (xfer_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 |
15823 | 567 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
|
568 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 xfer_data = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
573 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
|
574 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
575 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
576 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
577 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
578 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
579 struct yahoo_packet *pkt; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
580 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
581 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
582 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
583 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
|
584 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
|
585 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
586 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
587 YAHOO_STATUS_AVAILABLE, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
588 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
589 yahoo_packet_hash(pkt, "sssi", |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
590 1, purple_normalize(account, purple_account_get_username(account)), |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
591 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
592 265, xfer_data->xfer_peer_idstring, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
593 222, 4); |
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 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
596 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
597 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
|
598 YAHOO_STATUS_DISCONNECTED, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
599 yd->session_id); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
600 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
|
601 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
|
602 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
603 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
|
604 66, -1); |
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 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
|
607 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
608 |
22017
97d530d11cc0
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21803
diff
changeset
|
609 if (xfer_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 yahoo_xfer_data_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 xfer->data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 |
26250
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
614 /* Send HTTP OK after receiving file */ |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
615 static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
616 { |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
617 char *tx = NULL; |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
618 int written; |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
619 |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
620 tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"); |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
621 written = write(xfer->fd, tx, strlen(tx)); |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
622 |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
623 if (written < 0 && errno == EAGAIN) |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
624 written = 0; |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
625 else if (written <= 0) |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
626 purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK"); |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
627 |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
628 /* close connection */ |
26250
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
629 close(xfer->fd); |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
630 xfer->fd = -1; |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
631 g_free(tx); |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
632 } |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
633 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
634 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
|
635 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
636 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
|
637 PurpleXfer *xfer = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
638 PurpleConnection *gc; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
639 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
640 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
641 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
|
642 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
|
643 && 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
|
644 && xfer_data->filename_list) { |
26250
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
645 |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
646 /* Send HTTP OK in case of p2p transfer, when we act as server */ |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
647 if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) |
1520b67d792f
When acting as a p2p server, send HTTP OK after receiving file.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26237
diff
changeset
|
648 yahoo_p2p_ft_server_send_OK(xfer_old); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
649 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
650 /* 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
|
651 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
|
652 g_free( xfer_data->size_list->data ); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
653 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
654 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
|
655 xfer_data->size_list->data = NULL; |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
656 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
657 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
|
658 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
|
659 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
660 /* 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
|
661 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
|
662 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
663 gchar* filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
664 long filesize; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
665 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
666 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
|
667 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
|
668 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
669 gc = xfer_data->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
670 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
671 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
672 /* 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
|
673 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
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 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
|
680 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
681 xfer_data->host = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
682 xfer_data->port = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
683 xfer_data->expires = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
684 xfer_data->started = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
685 xfer_data->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
686 xfer_data->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
687 xfer_data->txbuf_written = 0; |
22022
eeba86c553be
Fix a couple compile warnings.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22020
diff
changeset
|
688 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
|
689 xfer_data->rxqueue = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
690 xfer_data->rxlen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
691 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
|
692 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
|
693 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
|
694 xfer_data->firstoflist = FALSE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
695 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
696 /* 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
|
697 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
698 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
699 /* 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
|
700 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
|
701 |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
702 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
703 if (xfer) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
704 /* 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
|
705 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
|
706 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
|
707 g_free(utf8_filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
708 purple_xfer_set_size(xfer, filesize); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
709 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
710 xfer->data = xfer_data; |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
711 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
712 /* 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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
722 /* update map to current xfer */ |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
723 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
|
724 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
|
725 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
726 /* Now perform the request */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
727 purple_xfer_request(xfer); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
728 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
729 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
730 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
731 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
732 if (xfer_data) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
733 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
|
734 xfer_old->data = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
735 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
736 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
737 |
15823 | 738 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
|
739 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 GSList *l = pkt->hash; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 char *me = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 char *message = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 char *command = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 char *unknown = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 /* 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
|
751 while(l != NULL) |
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 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
755 switch(pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
756 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
|
757 me = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
758 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
759 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
|
760 from = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
761 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
762 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
|
763 service = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
764 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
765 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
|
766 message = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
767 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
768 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
|
769 command = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
770 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
771 case 63: /* IMVironment name and version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
773 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
774 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
|
775 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
|
776 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
777 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 /* 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
|
783 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
|
784 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 /* 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
|
786 if(strstr(imv, "doodle;") != NULL) |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
787 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
|
788 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 /* 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
|
790 if(!strcmp(imv, ";0")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 /* 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
|
793 yahoo_doodle_command_got_shutdown(gc, from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 |
15823 | 798 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
|
799 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 char *from = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 char *to = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 char *msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 char *url = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 char *imv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 long expires = 0; |
15823 | 806 PurpleXfer *xfer; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
807 YahooData *yd; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 struct yahoo_xfer_data *xfer_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 char *service = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 char *filename = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 unsigned long filesize = 0L; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 GSList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 yd = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 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
|
817 struct yahoo_pair *pair = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
819 switch (pair->key) { |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
820 case 4: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 from = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
822 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
823 case 5: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 to = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
825 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
826 case 14: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 msg = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
828 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
829 case 20: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 url = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
831 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
832 case 38: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 expires = strtol(pair->value, NULL, 10); |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
834 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
835 case 27: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 filename = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
837 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
838 case 28: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 filesize = atol(pair->value); |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
840 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
841 case 49: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 service = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
843 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
844 case 63: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 imv = pair->value; |
20254
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
846 break; |
f379a2e9e939
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents:
20208
diff
changeset
|
847 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 } |
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 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 * 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
|
852 * record it for later use. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 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
|
855 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
|
856 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 if (service && (strcmp("FILEXFER", service) != 0)) { |
15823 | 861 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
|
862 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 if (msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 tmp = strchr(msg, '\006'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 if (tmp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 *tmp = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 if (!url || !from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 /* Setup the Yahoo-specific file transfer data */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 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
|
878 xfer_data->gc = gc; |
15823 | 879 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
|
880 g_free(xfer_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
883 |
15823 | 884 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
|
885 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
|
886 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 /* Build the file transfer handle. */ |
15823 | 888 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
889 if (xfer == NULL) { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
890 g_free(xfer_data); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
891 g_return_if_reached(); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
892 } |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
893 |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
894 xfer->data = xfer_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
896 /* Set the info about the incoming file. */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
897 if (filename) { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
898 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
899 purple_xfer_set_filename(xfer, utf8_filename); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
900 g_free(utf8_filename); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
901 } else { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
902 gchar *start, *end; |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
903 start = g_strrstr(xfer_data->path, "/"); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
904 if (start) |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
905 start++; |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
906 end = g_strrstr(xfer_data->path, "?"); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
907 if (start && *start && end) { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
908 char *utf8_filename; |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
909 filename = g_strndup(start, end - start); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
910 utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
911 g_free(filename); |
15823 | 912 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
|
913 g_free(utf8_filename); |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
914 filename = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 } |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
916 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
918 purple_xfer_set_size(xfer, filesize); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
920 /* Setup our I/O op functions */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
921 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
922 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
923 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
924 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
925 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
926 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
927 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
|
928 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
929 /* Now perform the request */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
930 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 |
15823 | 933 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
|
934 { |
15823 | 935 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 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
|
937 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 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
|
939 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 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
|
941 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
|
942 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 /* Build the file transfer handle. */ |
15823 | 944 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
945 if (xfer == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 { |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
947 g_free(xfer_data); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
948 g_return_val_if_reached(NULL); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
949 } |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
950 |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
951 xfer->data = xfer_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
953 /* Setup our I/O op functions */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
954 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
955 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
956 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
957 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
958 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
959 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
960 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
|
961 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 return xfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
965 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
|
966 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
967 gchar *ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
968 int i,j; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
969 ans = g_strnfill(24, ' '); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
970 ans[23] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
971 ans[22] = '$'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
972 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
|
973 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
974 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
|
975 if(j < 26) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
976 ans[i] = j + 'a'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
977 else if(j < 52) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
978 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
|
979 else |
22201
393c639dd021
Kill this warning when using -Wstrict-prototypes:
Stu Tomlinson <stu@nosnilmot.com>
parents:
22022
diff
changeset
|
980 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
|
981 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
982 return ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
983 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
984 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
985 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
|
986 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
987 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
988 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
|
989 struct sockaddr_in *addr; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
990 struct yahoo_packet *pkt; |
30644
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
991 unsigned long actaddr; |
27784
0966717651b0
fix yahoo jp file transfer.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
27781
diff
changeset
|
992 unsigned long a,b,c,d; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
993 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
994 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
995 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
996 gchar *url; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
997 gchar *filename; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
998 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
999 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1000 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1001 if (!(xd = xfer->data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1002 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1003 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1004 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
|
1005 yd = gc->proto_data; |
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 if(!hosts) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1008 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1009 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
|
1010 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
|
1011 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1012 } |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1013 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1014 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1015 hosts = g_slist_remove(hosts, hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1016 if(!hosts) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1017 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1018 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
|
1019 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
|
1020 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1021 } |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1022 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1023 /* 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
|
1024 addr = hosts->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1025 actaddr = addr->sin_addr.s_addr; |
30644
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1026 d = actaddr & 0xff; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1027 actaddr >>= 8; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1028 c = actaddr & 0xff; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1029 actaddr >>= 8; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1030 b = actaddr & 0xff; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1031 actaddr >>= 8; |
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1032 a = actaddr & 0xff; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1033 if(yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1034 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
|
1035 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1036 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
|
1037 |
30644
d0b0f0d17046
Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29623
diff
changeset
|
1038 url = g_strdup_printf("%u.%u.%u.%u", d, c, b, a); |
26634
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1039 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1040 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1041 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1042 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
|
1043 addr = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1044 while (hosts != NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1045 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1046 /* Discard the length... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1047 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
|
1048 /* Free the address... */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1049 g_free(hosts->data); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1050 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
|
1051 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1052 |
26634
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1053 if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1054 purple_xfer_cancel_remote(xfer); |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1055 g_free(url); |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1056 return; |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1057 } |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1058 g_free(url); |
4bac03b3c0fd
Free the DNS query data before purple_url_parse() to avoid leaking on failure.
Paul Aurich <paul@darkrain42.org>
parents:
26627
diff
changeset
|
1059 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1060 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
|
1061 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
|
1062 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1063 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
|
1064 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
|
1065 5, xfer->who, |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1066 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
|
1067 27, filename, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1068 249, 3, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1069 250, xd->host); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1070 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1071 g_free(filename); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1072 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
|
1073 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1074 |
28836
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1075 gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who) |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1076 { |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1077 if (!who || yahoo_get_federation_from_name(who) != YAHOO_FEDERATION_NONE) |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1078 return FALSE; |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1079 return TRUE; |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1080 } |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28664
diff
changeset
|
1081 |
15823 | 1082 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
|
1083 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1084 struct yahoo_xfer_data *xfer_data; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1085 YahooData *yd = gc->proto_data; |
15823 | 1086 PurpleXfer *xfer = yahoo_new_xfer(gc, who); |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1087 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 g_return_if_fail(xfer != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 |
26227
abf830f6cd43
When sending a file, if there isn't a p2p connection, try establishing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26220
diff
changeset
|
1090 /* if we don't have a p2p connection, try establishing it now */ |
abf830f6cd43
When sending a file, if there isn't a p2p connection, try establishing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26220
diff
changeset
|
1091 if( !g_hash_table_lookup(yd->peers, who) ) |
abf830f6cd43
When sending a file, if there isn't a p2p connection, try establishing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26220
diff
changeset
|
1092 yahoo_send_p2p_pkt(gc, who, 0); |
abf830f6cd43
When sending a file, if there isn't a p2p connection, try establishing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26220
diff
changeset
|
1093 |
26219
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1094 xfer_data = xfer->data; |
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1095 xfer_data->status_15 = STARTED; |
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1096 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); |
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1097 xfer_data->version = 15; |
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1098 xfer_data->xfer_peer_idstring = yahoo_xfer_new_xfer_id(); |
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1099 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
|
1100 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 /* Now perform the request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 if (file) |
15823 | 1103 purple_xfer_request_accepted(xfer, file); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 else |
15823 | 1105 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1107 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1108 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
|
1109 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
|
1110 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1111 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
|
1112 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1113 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1114 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
|
1115 int did; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1116 gchar* buf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1117 gchar* t; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1118 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1119 PurpleConnection *gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1120 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1121 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1122 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1123 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
|
1124 gc = xd->gc; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1125 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1126 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
|
1127 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
|
1128 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1129 xd->txbuflen += did; |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1130 buf[did] = '\0'; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1131 t = xd->txbuf; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1132 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
|
1133 g_free(t); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1134 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1135 g_free(buf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1136 |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
1137 if (did < 0 && errno == EAGAIN) |
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
1138 return; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1139 else if (did < 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1140 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
|
1141 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
|
1142 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1143 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1144 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1145 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
|
1146 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1147 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1148 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1149 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
|
1150 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
|
1151 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
|
1152 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1153 xd->txbuf = NULL; |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
1154 if (purple_proxy_connect(gc, account, xd->host, xd->port, yahoo_xfer_connected_15, xfer) == NULL) |
22018
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_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
|
1157 _("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
|
1158 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
|
1159 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1160 } else { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1161 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
|
1162 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
|
1163 xd->status_15); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1164 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1165 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1166 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1167 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1168 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
|
1169 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1170 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1171 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
|
1172 int remaining, written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1173 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1174 xfer = data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1175 xd = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1176 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
|
1177 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
|
1178 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1179 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
|
1180 written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1181 else if (written <= 0) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1182 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
|
1183 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
|
1184 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1185 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1186 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1187 if (written < remaining) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1188 xd->txbuf_written += written; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1189 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1190 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1191 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1192 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
|
1193 xd->tx_handler = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1194 g_free(xd->txbuf); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1195 xd->txbuf = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1196 xd->txbuflen = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1197 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1198 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1199 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
|
1200 { |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1201 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
|
1202 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
|
1203 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
|
1204 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1205 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
|
1206 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1207 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
|
1208 xfer->fd = source; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1209 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
|
1210 } |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1211 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
|
1212 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1213 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
|
1214 xfer->fd = source; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1215 /* Remove Read event */ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1216 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
|
1217 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
|
1218 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
|
1219 } |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1220 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
|
1221 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1222 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
|
1223 /* 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
|
1224 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
|
1225 xd->input_event = 0; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1226 close(source); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1227 xfer->fd = -1; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1228 /* 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
|
1229 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
|
1230 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1231 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1232 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1233 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
|
1234 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1235 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1236 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1237 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1238 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
|
1239 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1240 PurpleXfer *xfer; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1241 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
|
1242 PurpleAccount *account; |
30863
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30644
diff
changeset
|
1243 PurpleConnection *gc; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1244 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1245 if (!(xfer = data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1246 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1247 if (!(xd = xfer->data)) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1248 return; |
30863
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30644
diff
changeset
|
1249 gc = xd->gc; |
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30644
diff
changeset
|
1250 account = purple_connection_get_account(gc); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1256 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1257 /* 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
|
1258 if (xd->txbuflen == 0) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1259 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1260 gchar* cookies; |
30974
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1261 YahooData *yd = gc->proto_data; |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1262 |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1263 /* cookies = yahoo_get_cookies(gc); |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1264 * This doesn't seem to be working. The function is returning NULL, which yahoo servers don't like |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1265 * For now let us not use this function */ |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1266 |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1267 cookies = g_strdup_printf("Y=%s; T=%s", yd->cookie_y, yd->cookie_t); |
fc961dfd4122
Fix file transfers. yahoo_get_cookies() doesn't seem to be working. As a
sulabh@pidgin.im
parents:
30863
diff
changeset
|
1268 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1269 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
|
1270 { |
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
|
1271 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
|
1272 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1273 /* sending file via p2p, we are connected as client */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1274 xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1275 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1276 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1277 "Content-Length: %ld\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1278 "Cache-Control: no-cache\r\n\r\n", |
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
|
1279 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
|
1280 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
|
1281 (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
|
1282 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1283 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
|
1284 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1285 /* sending file via relaying */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1286 xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1287 "Cookie:%s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1288 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1289 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1290 "Content-Length: %ld\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1291 "Cache-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
|
1292 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
|
1293 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
|
1294 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1295 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1296 xd->host, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1297 (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
|
1298 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1299 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1300 else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1301 { |
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
|
1302 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
|
1303 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1304 /* receiving file via p2p, connected as client */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1305 xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1306 "Accept: */*\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1307 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1308 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1309 "Content-Length: 0\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1310 "Cache-Control: no-cache\r\n\r\n", |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1311 xd->path,xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1312 } |
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
|
1313 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1314 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1315 /* receiving file via relaying */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1316 xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1317 "Accept: */*\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1318 "Cookie: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1319 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1320 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1321 "Content-Length: 0\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1322 "Cache-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
|
1323 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
|
1324 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
|
1325 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1326 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1327 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1328 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1329 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1330 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
|
1331 { |
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
|
1332 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
|
1333 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1334 /* receiving file via p2p, connected as client */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1335 xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1336 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1337 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1338 "Connection: Keep-Alive\r\n\r\n", |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1339 xd->path, xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1340 } |
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
|
1341 else |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1342 { |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1343 /* receiving file via relaying */ |
26909
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1344 xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1345 "Cookie: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1346 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1347 "Host: %s\r\n" |
fac90dbe196d
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents:
26634
diff
changeset
|
1348 "Connection: 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
|
1349 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
|
1350 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
|
1351 xfer->who, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1352 cookies, |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1353 xd->host); |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1354 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1355 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1356 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1357 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1358 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
|
1359 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1360 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1361 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1362 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
|
1363 xd->txbuf_written = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1364 g_free(cookies); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1365 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1366 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1367 if (!xd->tx_handler) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1368 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1369 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
|
1370 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
|
1371 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
|
1372 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1373 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1374 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1375 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
|
1376 { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1377 PurpleXfer *xfer; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1378 struct yahoo_xfer_data *xd; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1379 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1380 xfer = data; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1381 if (!(xd = xfer->data)) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1382 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1383 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1384 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1385 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1386 purple_input_remove(xd->input_event); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1387 xd->status_15 = TRANSFER_PHASE; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1388 xfer->fd = source; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1389 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
|
1390 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1391 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1392 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
|
1393 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1394 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1395 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1396 guchar buf[1024]; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1397 int len; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1398 char *url_head; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1399 char *url_get; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1400 time_t unix_time; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1401 char *time_str; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1402 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1403 xfer = data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1404 if (!(xd = xfer->data)) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1405 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1406 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1407 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1408 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1409 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
|
1410 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
|
1411 return ; /* No Worries*/ |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1412 else if (len <= 0) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1413 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
|
1414 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
|
1415 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1416 return; |
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 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
|
1420 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
|
1421 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1422 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
|
1423 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
|
1424 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
|
1425 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
|
1426 else { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1427 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
|
1428 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
|
1429 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1430 g_free(url_head); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1431 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1432 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1433 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1434 unix_time = time(NULL); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1435 time_str = ctime(&unix_time); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1436 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
|
1437 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1438 if (xd->txbuflen == 0) { |
26626
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1439 xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" |
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1440 "Date: %s GMT\r\n" |
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1441 "Server: Y!/1.0\r\n" |
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1442 "MIME-version: 1.0\r\n" |
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1443 "Last-modified: %s GMT\r\n" |
26627
98d8c336234d
Fix two int/size_t format build warnings on 64-bit
Paul Aurich <paul@darkrain42.org>
parents:
26626
diff
changeset
|
1444 "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", |
26626
430298a61512
Reformat a printf so the HTTP headers are easier to read
Paul Aurich <paul@darkrain42.org>
parents:
26250
diff
changeset
|
1445 time_str, time_str, xfer->size); |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1446 xd->txbuflen = strlen(xd->txbuf); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1447 xd->txbuf_written = 0; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1448 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1449 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1450 if (!xd->tx_handler) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1451 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
|
1452 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
|
1453 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1454 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1455 g_free(url_head); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1456 g_free(url_get); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1457 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1458 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1459 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
|
1460 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1461 int acceptfd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1462 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1463 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1464 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1465 xfer = data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1466 if (!(xd = xfer->data)) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1467 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1468 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1469 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1470 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1471 acceptfd = accept(source, NULL, 0); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1472 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
|
1473 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1474 else if(acceptfd == -1) { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1475 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
|
1476 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
|
1477 /* 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
|
1478 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
|
1479 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
|
1480 return; |
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 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1483 /* 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
|
1484 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
|
1485 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
|
1486 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1487 /* 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
|
1488 xfer->fd = acceptfd; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1489 if(xfer->type == PURPLE_XFER_RECEIVE) |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1490 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
|
1491 else |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1492 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
|
1493 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1494 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1495 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
|
1496 { |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1497 PurpleXfer *xfer; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1498 struct yahoo_xfer_data *xd; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1499 struct yahoo_packet *pkt; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1500 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1501 YahooData *yd; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1502 gchar *filename; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1503 const char *local_ip; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1504 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
|
1505 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
|
1506 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1507 xfer = data; |
28664
208fbf27d987
Fix a couple of possible null-pointer dereferences.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28137
diff
changeset
|
1508 if (!(xd = xfer->data) || (listenfd == -1)) { |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1509 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
|
1510 purple_xfer_cancel_remote(xfer); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1511 return; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1512 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1513 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1514 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
|
1515 yd = xd->gc->proto_data; |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1516 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
|
1517 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
|
1518 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
|
1519 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1520 filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
26220
9a5da524fba9
Use purple_util_chrreplace instead of g_strsplit then g_strjoinv
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26219
diff
changeset
|
1521 filename_without_spaces = g_strdup(filename); |
9a5da524fba9
Use purple_util_chrreplace instead of g_strsplit then g_strjoinv
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
26219
diff
changeset
|
1522 purple_util_chrreplace(filename_without_spaces, ' ', '+'); |
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
|
1523 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
|
1524 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
|
1525 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1526 if(xfer->type == PURPLE_XFER_RECEIVE) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1527 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
|
1528 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
|
1529 YAHOO_STATUS_AVAILABLE, yd->session_id); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1530 yahoo_packet_hash(pkt, "ssssis", |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1531 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
|
1532 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1533 265, xd->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1534 27, xfer->filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1535 249, 2, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1536 250, url_to_send); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1537 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1538 else { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1539 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
|
1540 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
|
1541 yahoo_packet_hash(pkt, "ssssis", |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1542 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
|
1543 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1544 265, xd->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1545 27, filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1546 249, 1, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1547 250, url_to_send); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1548 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1549 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1550 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
|
1551 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1552 g_free(filename); |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1553 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
|
1554 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
|
1555 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1556 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1557 /* 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
|
1558 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
|
1559 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
|
1560 } |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1561 |
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1562 /* 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
|
1563 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
|
1564 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1565 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
|
1566 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
|
1567 PurpleAccount *account; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1568 YahooData *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
|
1569 gchar *filename; |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1570 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
|
1571 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1572 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
|
1573 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
|
1574 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1575 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
|
1576 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
|
1577 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1578 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
|
1579 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
|
1580 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
|
1581 return; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1582 |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1583 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
|
1584 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
|
1585 |
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
|
1586 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
|
1587 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
|
1588 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
|
1589 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
|
1590 27, filename, |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1591 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
|
1592 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
|
1593 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
|
1594 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1595 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
|
1596 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1597 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1598 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
|
1599 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1600 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1601 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1602 char *imv = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1603 long val_222 = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1604 PurpleXfer *xfer; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1605 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1606 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
|
1607 char *service = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1608 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1609 char *xfer_peer_idstring = NULL; |
28137
da33da2e1a1e
Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28135
diff
changeset
|
1610 char *utf8_filename; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1611 unsigned long filesize = 0L; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1612 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1613 GSList *filename_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1614 GSList *size_list = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1615 int nooffiles = 0; |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1616 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1617 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1618 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1619 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
|
1620 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
|
1621 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1622 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1623 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1624 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1625 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1626 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1627 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1628 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1629 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1630 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
|
1631 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1632 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1633 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
|
1634 nooffiles++; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1635 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1636 case 28: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1637 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
|
1638 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1639 case 222: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1640 val_222 = atol(pair->value); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1641 /* 1=send, 2=cancel, 3=accept, 4=reject */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1642 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1643 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1644 /* 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
|
1645 case 49: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1646 service = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1647 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1648 case 63: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1649 imv = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1650 break; |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1651 /* end check */ |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1652 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1653 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1654 } |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1655 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
|
1656 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1657 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1658 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
|
1659 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1660 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
|
1661 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1662 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1663 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
|
1664 return; |
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 if(val_222 == 3) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1667 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1668 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
|
1669 xfer_peer_idstring); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1670 if(!xfer) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1671 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1672 /* |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1673 * 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
|
1674 * 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
|
1675 * 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
|
1676 * 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
|
1677 * 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
|
1678 */ |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1679 |
25622
2fb8c39d0494
Send file by p2p when we are server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25616
diff
changeset
|
1680 /* 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
|
1681 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
|
1682 /* 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
|
1683 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
|
1684 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
|
1685 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1686 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1687 if (yd->jp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1688 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1689 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
|
1690 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
|
1691 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1692 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1693 { |
22271
cc5b2a145652
Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22201
diff
changeset
|
1694 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
|
1695 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
|
1696 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1697 return; |
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 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1700 /* 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
|
1701 /* |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1702 * 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
|
1703 * 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
|
1704 */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1705 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
|
1706 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
|
1707 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1708 } |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1709 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1710 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
|
1711 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
|
1712 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
|
1713 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1714 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1715 } |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1716 /* end processing */ |
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 if(!filename_list) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1719 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1720 /* 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
|
1721 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
|
1722 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
|
1723 filename = filename_list->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1724 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
|
1725 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1726 if(!from) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1727 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
|
1728 xfer_data->version = 15; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1729 xfer_data->firstoflist = TRUE; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1730 xfer_data->gc = gc; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1731 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
|
1732 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
|
1733 xfer_data->size_list = size_list; |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1734 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1735 /* 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
|
1736 xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1737 if (xfer == NULL) |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1738 { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1739 g_free(xfer_data); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1740 g_return_if_reached(); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1741 } |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1742 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1743 xfer->message = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1744 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1745 /* Set the info about the incoming file. */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1746 utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1747 purple_xfer_set_filename(xfer, utf8_filename); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1748 g_free(utf8_filename); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1749 purple_xfer_set_size(xfer, filesize); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1750 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1751 xfer->data = xfer_data; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1752 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1753 /* Setup our I/O op functions */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1754 purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1755 purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1756 purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1757 purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1758 purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1759 purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1760 purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1761 purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1762 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1763 g_hash_table_insert(yd->xfer_peer_idstring_map, |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1764 xfer_data->xfer_peer_idstring, |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1765 xfer); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1766 |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1767 if(nooffiles > 1) { |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1768 gchar* message; |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1769 message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1770 purple_xfer_conversation_write(xfer, message, FALSE); |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1771 g_free(message); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1772 } |
28135
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1773 /* Now perform the request */ |
0a056130718e
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
28025
diff
changeset
|
1774 purple_xfer_request(xfer); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1775 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1776 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1777 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
|
1778 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1779 char *from = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1780 char *to = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1781 char *url = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1782 long val_249 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1783 long val_66 = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1784 PurpleXfer *xfer; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1785 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1786 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
|
1787 char *filename = NULL; |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1788 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
|
1789 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
|
1790 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1791 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
|
1792 PurpleAccount *account; |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1793 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
|
1794 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1795 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1796 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1797 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
|
1798 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
|
1799 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1800 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1801 case 4: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1802 from = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1803 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1804 case 5: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1805 to = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1806 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1807 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1808 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
|
1809 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1810 case 27: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1811 filename = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1812 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1813 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1814 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
|
1815 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1816 case 249: |
25571
ef47df3e5dd4
Yahoo P2P File Transfer RECEIVE only support added.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
22794
diff
changeset
|
1817 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
|
1818 /* 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
|
1819 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1820 case 250: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1821 url = pair->value; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1822 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1823 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1824 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
|
1825 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1826 } |
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 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1829 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
|
1830 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1831 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1832 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
|
1833 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1834 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1835 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1836 if(val_66==-1) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1837 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1838 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
|
1839 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1840 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1841 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1842 xfer_data = xfer->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1843 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1844 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
|
1845 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
|
1846 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
|
1847 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
|
1848 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1849 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1850 } |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1851 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1852 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
|
1853 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1854 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
|
1855 YAHOO_STATUS_AVAILABLE, yd->session_id); |
27263
f8428553f11c
Fix File transfer issue with Pidgin 2.5.7, ticket #9478
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
27201
diff
changeset
|
1856 yahoo_packet_hash(pkt_to_send, "ssssis", |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1857 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
|
1858 5, xfer->who, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1859 265, xfer_data->xfer_peer_idstring, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1860 27, xfer->filename, |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1861 249, xfer_data->info_val_249, |
27263
f8428553f11c
Fix File transfer issue with Pidgin 2.5.7, ticket #9478
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
27201
diff
changeset
|
1862 251, xfer_data->xfer_idstring_for_relay); |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1863 |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1864 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
|
1865 |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
1866 if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, |
25624
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1867 yahoo_xfer_connected_15, xfer) == NULL) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1868 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
|
1869 _("Unable to establish file descriptor.")); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1870 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1871 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1872 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1873 else if(val_249 == 2) { |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1874 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
|
1875 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
|
1876 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1877 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1878 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1879 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
|
1880 purple_xfer_cancel_remote(xfer); |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1881 return; |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1882 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1883 } |
37b207e08c69
Receive files when we are p2p server
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25623
diff
changeset
|
1884 } |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1885 |
25630
63033139c590
minor changes in comments style and alphabetic ordering of header files.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25629
diff
changeset
|
1886 /* 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
|
1887 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
|
1888 { |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1889 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
|
1890 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
|
1891 PurpleXfer *xfer; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27395
diff
changeset
|
1892 YahooData *yd; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1893 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
|
1894 GSList *l; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1895 PurpleAccount *account; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1896 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
|
1897 gchar *url = NULL; |
26219
51bdaa82b95d
Remove check of version for file transfer, use only version 15 file transfer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25631
diff
changeset
|
1898 int val_249 = 0; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1899 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1900 yd = gc->proto_data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1901 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
|
1902 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
|
1903 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1904 switch (pair->key) { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1905 case 251: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1906 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
|
1907 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1908 case 265: |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1909 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
|
1910 break; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1911 case 66: |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1912 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
|
1913 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
|
1914 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
|
1915 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
|
1916 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
|
1917 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
|
1918 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
|
1919 break; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1920 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1921 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1922 |
22020
4163dcf643ae
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22018
diff
changeset
|
1923 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
|
1924 if(!xfer) return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1925 |
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
|
1926 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
|
1927 { |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1928 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
|
1929 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
|
1930 } |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1931 |
ccbded331513
Support for P2P file transfer (SEND), when we are client to the peer
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
25571
diff
changeset
|
1932 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
|
1933 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1934 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
|
1935 return; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1936 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1937 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1938 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
|
1939 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
|
1940 purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
26909
diff
changeset
|
1941 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1942 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
|
1943 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
|
1944 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
|
1945 |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
27193
diff
changeset
|
1946 if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1947 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
|
1948 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1949 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
|
1950 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
|
1951 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
22017
diff
changeset
|
1952 } |