annotate libpurple/protocols/bonjour/bonjour_ft.c @ 21440:d8106b63b0a4

I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 12 Nov 2007 04:17:10 +0000
parents
children da75dd6c41fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21440
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
1 /*
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
2 * purple - Bonjour Protocol Plugin
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
3 *
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
6 * source distribution.
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
7 *
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
12 *
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
17 *
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
21 */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
22 #include "internal.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
23 #include "util.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
24 #include "debug.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
25 #include "notify.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
26 #include "proxy.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
27 #include "ft.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
28 #include "buddy.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
29 #include "bonjour.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
30 #include "bonjour_ft.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
31 #include "cipher.h"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
32
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
33 static PurpleXfer*
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
34 bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
35 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
36 xep_ft_si_offer(PurpleXfer *xfer, const gchar *to);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
37 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
38 xep_ft_si_result(PurpleXfer *xfer, char *to);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
39 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
40 xep_ft_si_reject(PurpleXfer *xfer, char *to);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 xep_ft_si_reject2(BonjourData *bd, const char *to, const char *sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44 bonjour_bytestreams_init(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46 bonjour_bytestreams_listen(int sock, gpointer data);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48 bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50 bonjour_bytestreams_connect(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
52 bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
53 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
54 bonjour_xfer_init(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
55 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
56 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *from,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57 const int filesize, const char *filename, int option);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
58 static void bonjour_xfer_cancel_send(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
59 static void bonjour_xfer_request_denied(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60 static void bonjour_xfer_cancel_recv(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
61 static void bonjour_xfer_end(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
62 static void bonjour_free_xfer(PurpleXfer *xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
63
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
64 /* Look for specific xfer handle */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
65 static unsigned int next_id = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
66
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
67 static void bonjour_xfer_cancel_send(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
68 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
69 purple_debug_info("Bonjour", "Bonjour-xfer-cancel-send.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
70 bonjour_free_xfer(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
71 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
72
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
73 static void bonjour_xfer_request_denied(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
74 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
75 purple_debug_info("Bonjour", "Bonjour-xfer-request-denied.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
76 xep_ft_si_reject(xfer, xfer->who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
77 bonjour_free_xfer(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
78 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
79
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
80
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
81 static void bonjour_xfer_cancel_recv(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
82 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
83 purple_debug_info("Bonjour", "Bonjour-xfer-cancel-recv.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
84 bonjour_free_xfer(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
85 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
86
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
87
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
88 static void bonjour_xfer_end(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
89 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
90 purple_debug_info("Bonjour", "Bonjour-xfer-end.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
91 bonjour_free_xfer(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
92 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
93
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
94 static PurpleXfer*
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
95 bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
96 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
97 GList *xfers = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
98 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
99 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
100
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
101 if(!sid || !from || !bd)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
102 return NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
103
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
104 purple_debug_info("Bonjour", "Look for sid=%s from=%s xferlists.\n",
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
105 sid, from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
106
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
107 for(xfers = bd->xfer_lists; xfers; xfers = xfers->next) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
108 xfer = xfers->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
109 if(xfer == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
110 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
111 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
112 if(xf == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
113 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
114 if(xf->sid && xfer->who && !strcmp(xf->sid, sid) &&
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
115 !strcmp(xfer->who, from))
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
116 return xfer;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
117 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
118
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
119 purple_debug_info("Bonjour", "Look for xfer list fail\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
120
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
121 return NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
122 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
123
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
124 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
125 xep_ft_si_offer(PurpleXfer *xfer, const gchar *to)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
126 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
127 xmlnode *si_node = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
128 xmlnode *feature = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
129 xmlnode *field = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
130 xmlnode *option = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
131 xmlnode *value = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
132 xmlnode *file = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
133 xmlnode *x = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
134 XepIq *iq = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
135 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
136 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
137 char buf[32];
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
138
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
139 if(!xfer || !to)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
140 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
141 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
142 if(!xf)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
143 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
144 bd = xf->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
145 if(!bd)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
146 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
147
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
148 purple_debug_info("Bonjour", "xep file transfer stream initialization offer-id=%d.\n", next_id);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
149
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
150 /* Assign stream id. */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
151 memset(buf, 0, 32);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
152 g_snprintf(buf, sizeof(buf), "%u", next_id++);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
153 iq = xep_iq_new(xf->data, XEP_IQ_SET, to, buf);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
154 if(iq == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
155 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
156
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
157 g_free(xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
158 xf->sid = g_strdup(buf);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
159 /*Construct Stream initialization offer message.*/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
160 si_node = xmlnode_new_child(iq->node, "si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
161 xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
162
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
163 file = xmlnode_new_child(si_node, "file");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
164 xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
165 xmlnode_set_attrib(file, "name", xfer->filename);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
166 memset(buf, 0, 32);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
167 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
168 xmlnode_set_attrib(file, "size", buf);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
169
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
170 feature = xmlnode_new_child(si_node, "feature");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
171 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
172
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
173 x = xmlnode_new_child(feature, "x");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
174 xmlnode_set_namespace(x, "jabber:x:data");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
175 xmlnode_set_attrib(x, "type", "form");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
176
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
177 field = xmlnode_new_child(x, "field");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
178 xmlnode_set_attrib(field, "var", "stream-method");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
179 xmlnode_set_attrib(field, "type", "list-single");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
180
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
181 if (xf->mode & XEP_BYTESTREAMS) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
182 option = xmlnode_new_child(field, "option");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
183 value = xmlnode_new_child(option, "value");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
184 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
185 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
186 if (xf->mode & XEP_IBB) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
187 option = xmlnode_new_child(field, "option");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
188 value = xmlnode_new_child(option, "value");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
189 xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
190 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
191 xep_iq_send(iq);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
192 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
193
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
194 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
195 xep_ft_si_reject(PurpleXfer *xfer, char *to)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
196 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
197 xmlnode *error_node = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
198 xmlnode *forbidden = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
199 xmlnode *text = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
200 XepIq *iq = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
201 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
202
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
203 if(!to || !xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
204 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
205 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
206 if(!xf)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
207 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
208
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
209 purple_debug_info("Bonjour", "xep file transfer stream initialization error.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
210 iq = xep_iq_new(xf->data, XEP_IQ_ERROR, to, xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
211 if(iq == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
212 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
213
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
214 error_node = xmlnode_new_child(iq->node, "error");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
215 xmlnode_set_attrib(error_node, "code", "403");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
216 xmlnode_set_attrib(error_node, "type", "cancel");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
217
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
218 forbidden = xmlnode_new_child(error_node, "forbidden");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
219 xmlnode_set_namespace(forbidden, "urn:ietf:params:xml:ns:xmpp-stanzas");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
220
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
221 text = xmlnode_new_child(error_node, "text");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
222 xmlnode_set_namespace(text, "urn:ietf:params:xml:ns:xmpp-stanzas");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
223 xmlnode_insert_data(text, "Offer Declined", -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
224
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
225 xep_iq_send(iq);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
226 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
227 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
228 xep_ft_si_reject2(BonjourData *bd, const char *to, const char *sid)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
229 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
230 xmlnode *error_node = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
231 xmlnode *forbidden = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
232 xmlnode *text = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
233 XepIq *iq = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
234 if(bd == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
235 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
236 if(!to || !sid)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
237 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
238 purple_debug_info("Bonjour", "xep file transfer stream initialization error.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
239 iq = xep_iq_new(bd, XEP_IQ_ERROR, to, sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
240 if(iq == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
241 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
242 error_node = xmlnode_new_child(iq->node, "error");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
243 xmlnode_set_attrib(error_node, "code", "403");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
244 xmlnode_set_attrib(error_node, "type", "cancel");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
245
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
246 forbidden = xmlnode_new_child(error_node, "forbidden");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
247 xmlnode_set_namespace(forbidden, "urn:ietf:params:xml:ns:xmpp-stanzas");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
248
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
249 text = xmlnode_new_child(error_node, "text");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
250 xmlnode_set_namespace(text, "urn:ietf:params:xml:ns:xmpp-stanzas");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
251 xmlnode_insert_data(text, "Offer Declined", -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
252
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
253 xep_iq_send(iq);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
254 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
255
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
256 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
257 xep_ft_si_result(PurpleXfer *xfer, char *to)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
258 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
259 xmlnode *si_node = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
260 xmlnode *feature = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
261 xmlnode *field = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
262 xmlnode *value = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
263 xmlnode *x = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
264 XepIq *iq = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
265 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
266
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
267 if(!to || !xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
268 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
269 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
270 if(!xf)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
271 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
272
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
273 purple_debug_info("Bonjour", "xep file transfer stream initialization result.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
274 iq = xep_iq_new(xf->data, XEP_IQ_RESULT, to, xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
275 if(iq == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
276 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
277
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
278 si_node = xmlnode_new_child(iq->node, "si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
279 xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
280
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
281 feature = xmlnode_new_child(si_node, "feature");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
282 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
283
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
284 x = xmlnode_new_child(feature, "x");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
285 xmlnode_set_namespace(x, "jabber:x:data");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
286 xmlnode_set_attrib(x, "type", "submit");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
287
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
288 field = xmlnode_new_child(x, "field");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
289 xmlnode_set_attrib(field, "var", "stream-method");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
290
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
291 value = xmlnode_new_child(field, "value");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
292 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
293
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
294 xep_iq_send(iq);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
295 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
296
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
297 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
298 bonjour_free_xfer(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
299 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
300 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
301 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
302 if(xfer == NULL) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
303 purple_debug_info("Bonjour", "bonjour-free-xfer-null.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
304 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
305 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
306 purple_debug_info("Bonjour", "bonjour-free-xfer-%x.\n", (int)xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
307 xf = (XepXfer*)xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
308 if(xf != NULL){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
309 bd = (BonjourData*)xf->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
310 if(bd != NULL){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
311 bd->xfer_lists = g_list_remove(bd->xfer_lists, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
312 purple_debug_info("Bonjour", "B free xfer from lists(0x%x).\n", (int)bd->xfer_lists);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
313 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
314 if (xf->proxy_connection != NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
315 purple_proxy_connect_cancel(xf->proxy_connection);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
316 if (xf->listen_data != NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
317 purple_network_listen_cancel(xf->listen_data);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
318 g_free(xf->jid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
319 g_free(xf->proxy_host);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
320 g_free(xf->buddy_ip);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
321 g_free(xf);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
322 xfer->data = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
323 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
324 purple_debug_info("Bonjour", "Need close socket=0x%x.\n", xfer->fd);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
325 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
326
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
327 PurpleXfer *
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
328 bonjour_new_xfer(PurpleConnection *gc, const char *who)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
329 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
330 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
331 XepXfer *xep_xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
332 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
333 if(who == NULL || gc == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
334 return xfer;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
335
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
336 purple_debug_info("Bonjour", "Bonjour-new-xfer to %s.\n", who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
337 bd = (BonjourData*) gc->proto_data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
338 if(bd == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
339 return xfer;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
340 /* Build the file transfer handle */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
341 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
342
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
343 if (xfer) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
344 xep_xfer = g_new0(XepXfer, 1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
345 if(xep_xfer == NULL){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
346 bonjour_free_xfer(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
347 return NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
348 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
349 xep_xfer->data = bd;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
350 purple_debug_info("Bonjour", "Bonjour-new-xfer bd=0x%x data=0x%x.\n",(int)bd, (int)xep_xfer->data);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
351 xep_xfer->mode = XEP_BYTESTREAMS | XEP_IBB;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
352 xfer->data = xep_xfer;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
353 xep_xfer->sid = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
354 purple_xfer_set_init_fnc(xfer, bonjour_xfer_init);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
355 purple_xfer_set_cancel_send_fnc(xfer, bonjour_xfer_cancel_send);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
356 purple_xfer_set_end_fnc(xfer, bonjour_xfer_end);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
357 bd->xfer_lists = g_list_append(bd->xfer_lists, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
358 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
359 return xfer;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
360 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
361
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
362 void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
363 bonjour_send_file(PurpleConnection *gc, const char *who, const char *file)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
364 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
365
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
366 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
367 if(gc == NULL || who == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
368 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
369 purple_debug_info("Bonjour", "Bonjour-send-file to=%s.\n", who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
370 xfer = bonjour_new_xfer(gc, who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
371 if(xfer == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
372 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
373 if (file)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
374 purple_xfer_request_accepted(xfer, file);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
375 else
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
376 purple_xfer_request(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
377
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
378 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
379
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
380 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
381 bonjour_xfer_init(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
382 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
383 PurpleBuddy *buddy = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
384 BonjourBuddy *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
385 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
386 char buffer[100];
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
387 if(xfer == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
388 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
389 xf = (XepXfer*)xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
390 if(xf == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
391 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
392 purple_debug_info("Bonjour", "Bonjour-xfer-init.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
393
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
394 buddy = purple_find_buddy(xfer->account, xfer->who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
395 /* this buddy is offline. */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
396 if (buddy == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
397 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
398
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
399 bd = (BonjourBuddy *)buddy->proto_data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
400 memcpy(buffer, bd->ip, 20);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
401 xf->buddy_ip = g_strdup(bd->ip);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
402 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
403 /* initiate file transfer, send SI offer. */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
404 purple_debug_info("Bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
405 xep_ft_si_offer(xfer, xfer->who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
406
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
407 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
408 /* accept file transfer request, send SI result. */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
409 xep_ft_si_result(xfer, xfer->who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
410 purple_debug_info("Bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
411 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
412 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
413 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
414
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
415
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
416 void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
417 xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
418 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
419 const char *type = NULL, *from = NULL, *id = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
420 xmlnode *si = NULL, *file = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
421 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
422 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
423 const char *filename = NULL, *filesize_str = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
424 int filesize = 0, option = XEP_BYTESTREAMS;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
425
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
426 if(pc == NULL || packet == NULL || pb == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
427 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
428 bd = (BonjourData*) pc->proto_data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
429 if(bd == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
430 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
431 purple_debug_info("Bonjour", "xep-si-parse.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
432 type = xmlnode_get_attrib(packet, "type");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
433 from = pb->name;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
434 id = xmlnode_get_attrib(packet, "id");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
435 if(type) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
436 if(!strcmp(type, "set")){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
437 si = xmlnode_get_child(packet,"si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
438 purple_debug_info("Bonjour", "si offer Message type - SET.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
439 file = xmlnode_get_child(si, "file");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
440 /**/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
441 filename = xmlnode_get_attrib(file, "name");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
442 if( (filesize_str = xmlnode_get_attrib(file, "size")) != NULL )
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
443 filesize = atoi(filesize_str);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
444 bonjour_xfer_receive(pc, id, from, filesize, filename, option);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
445 } else if(!strcmp(type, "result")){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
446 si = xmlnode_get_child(packet,"si");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
447 purple_debug_info("Bonjour", "si offer Message type - RESULT.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
448 xfer = bonjour_si_xfer_find(bd, id, from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
449 if(xfer == NULL){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
450 purple_debug_info("Bonjour", "xfer find fail.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
451 xep_ft_si_reject2((BonjourData *)pc->proto_data, from, id);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
452 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
453 bonjour_bytestreams_init(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
454 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
455 } else if(!strcmp(type, "error")){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
456 purple_debug_info("Bonjour", "si offer Message type - ERROR.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
457 xfer = bonjour_si_xfer_find(bd, id, from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
458 if(xfer == NULL){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
459 purple_debug_info("Bonjour", "xfer find fail.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
460 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
461 purple_xfer_cancel_remote(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
462 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
463 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
464 purple_debug_info("Bonjour", "si offer Message type - Unknown-%d.\n",type);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
465 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
466 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
467 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
468
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
469 void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
470 xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
471 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
472 const char *type = NULL, *from = NULL, *id = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
473 xmlnode *query = NULL, *streamhost = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
474 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
475 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
476 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
477 const char *jid=NULL, *host=NULL, *port=NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
478 int portnum;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
479 if(pc == NULL || packet == NULL || pb == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
480 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
481 bd = (BonjourData*) pc->proto_data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
482 if(bd == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
483 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
484 purple_debug_info("Bonjour", "xep-bytestreams-parse.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
485 type = xmlnode_get_attrib(packet, "type");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
486 from = pb->name;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
487 query = xmlnode_get_child(packet,"query");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
488 if(type) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
489 if(!strcmp(type, "set")){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
490 purple_debug_info("Bonjour", "bytestream offer Message type - SET.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
491 id = xmlnode_get_attrib(query, "sid");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
492 xfer = bonjour_si_xfer_find(bd, id, from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
493 if(xfer){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
494 xf = (XepXfer*)xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
495 for(streamhost = xmlnode_get_child(query, "streamhost");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
496 streamhost;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
497 streamhost = xmlnode_get_next_twin(streamhost)) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
498 if((jid = xmlnode_get_attrib(streamhost, "jid")) &&
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
499 (host = xmlnode_get_attrib(streamhost, "host")) &&
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
500 (port = xmlnode_get_attrib(streamhost, "port")) &&
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
501 (portnum = atoi(port))) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
502 if(!strcmp(host, xf->buddy_ip)) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
503 xf->jid = g_strdup(jid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
504 xf->proxy_host = g_strdup(host);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
505 xf->proxy_port = portnum;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
506 purple_debug_info("Bonjour", "bytestream offer parse"
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
507 "jid=%s host=%s port=0x%x.\n",jid, host, portnum);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
508 bonjour_bytestreams_connect(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
509 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
510 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
511 purple_debug_info("Bonjour", "bytestream offer Message parse error.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
512 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
513 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
514 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
515
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
516 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
517
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
518 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
519 purple_debug_info("Bonjour", "bytestream offer Message type - Unknown-%d.\n",type);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
520 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
521 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
522 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
523
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
524 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
525 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *from,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
526 const int filesize, const char *filename, int option)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
527 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
528 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
529 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
530 BonjourData *bd = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
531 if(pc == NULL || id == NULL || from == NULL || filename == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
532 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
533 bd = (BonjourData*) pc->proto_data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
534 if(bd == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
535 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
536 purple_debug_info("Bonjour", "bonjour-xfer-receive.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
537 /* Build the file transfer handle */
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
538 xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
539 if (xfer) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
540 xf = g_new0(XepXfer, 1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
541 xf->data = bd;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
542 xfer->data = xf;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
543 purple_xfer_set_filename(xfer, filename);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
544 xf->sid = g_strdup(id);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
545 if(filesize > 0)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
546 purple_xfer_set_size(xfer, filesize);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
547 purple_xfer_set_init_fnc(xfer, bonjour_xfer_init);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
548 purple_xfer_set_request_denied_fnc(xfer, bonjour_xfer_request_denied);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
549 purple_xfer_set_cancel_recv_fnc(xfer, bonjour_xfer_cancel_recv);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
550 purple_xfer_set_end_fnc(xfer, bonjour_xfer_end);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
551 bd->xfer_lists = g_list_append(bd->xfer_lists, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
552 purple_xfer_request(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
553 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
554 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
555
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
556 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
557 bonjour_bytestreams_init(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
558 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
559 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
560 if(xfer == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
561 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
562 purple_debug_info("Bonjour", "Bonjour-bytestreams-init.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
563 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
564 xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
565 bonjour_bytestreams_listen, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
566 if (xf->listen_data == NULL) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
567 purple_xfer_cancel_local(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
568 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
569 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
570 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
571
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
572 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
573 bonjour_bytestreams_listen(int sock, gpointer data)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
574 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
575 PurpleXfer *xfer = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
576 XepXfer *xf;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
577 XepIq *iq;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
578 xmlnode *query, *streamhost;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
579 char *port;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
580 char *next_ip = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
581 char *local_ip = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
582 char token [] = ";";
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
583 purple_debug_info("Bonjour", "Bonjour-bytestreams-listen. sock=%d.\n", sock);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
584 if (sock < 0 || data == NULL) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
585 /*purple_xfer_cancel_local(xfer);*/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
586 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
587 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
588 xfer = data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
589 xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
590 bonjour_sock5_request_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
591 xf = (XepXfer*)xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
592 xf->listen_data = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
593 /*xf->listen_data = NULL;*/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
594 iq = xep_iq_new(xf->data, XEP_IQ_SET, xfer->who, xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
595 query = xmlnode_new_child(iq->node, "query");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
596 xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
597 xmlnode_set_attrib(query, "sid", xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
598 xmlnode_set_attrib(query, "mode", "tcp");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
599 local_ip = purple_network_get_my_ip_ext2(sock);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
600 next_ip = strtok(local_ip, token);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
601 xfer->local_port = purple_network_get_port_from_fd(sock);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
602 while(next_ip != NULL) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
603 streamhost = xmlnode_new_child(query, "streamhost");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
604 xmlnode_set_attrib(streamhost, "jid", xf->sid);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
605 xmlnode_set_attrib(streamhost, "host", next_ip);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
606 port = g_strdup_printf("%hu", xfer->local_port);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
607 xmlnode_set_attrib(streamhost, "port", port);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
608 g_free(port);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
609 next_ip = strtok(NULL, token);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
610 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
611 xep_iq_send(iq);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
612 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
613
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
614 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
615 bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
616 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
617 PurpleXfer *xfer = data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
618 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
619 int acceptfd;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
620 int len = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
621 if(xfer == NULL )
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
622 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
623 xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
624 if(xf == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
625 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
626 switch(xf->sock5_req_state){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
627 case 0x00:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
628 acceptfd = accept (source, NULL, 0);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
629 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK )) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
630
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
631 } else if(acceptfd == -1) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
632
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
633 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
634 purple_debug_info("Bonjour", "Conjour-sock5-request-cb. state= %d, accept=%d\n", xf->sock5_req_state,acceptfd);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
635 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
636 close(source);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
637 xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
638 bonjour_sock5_request_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
639 xf->sock5_req_state++;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
640 xf->rxlen = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
641 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
642 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
643 case 0x01:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
644 xfer->fd = source;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
645 len = read(source, xf->rx_buf + xf->rxlen, 3);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
646 if(len < 0 && errno == EAGAIN)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
647 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
648 else if(len <= 0){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
649 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
650 xfer->watcher = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
651 close(source);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
652 purple_xfer_cancel_remote(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
653 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
654 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
655 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
656 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
657 bonjour_sock5_request_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
658 xf->sock5_req_state++;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
659 xf->rxlen = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
660 bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
661 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
662 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
663 case 0x02:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
664 xf->tx_buf[0] = 0x05;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
665 xf->tx_buf[1] = 0x00;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
666 len = write(source, xf->tx_buf, 2);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
667 if (len < 0 && errno == EAGAIN)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
668 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
669 else if (len < 0) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
670 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
671 xfer->watcher = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
672 close(source);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
673 purple_xfer_cancel_remote(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
674 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
675 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
676 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
677 xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
678 bonjour_sock5_request_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
679 xf->sock5_req_state++;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
680 xf->rxlen = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
681 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
682 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
683 case 0x03:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
684 len = read(source, xf->rx_buf + xf->rxlen, 20);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
685 if(len<=0){
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
686 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
687 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
688 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
689 bonjour_sock5_request_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
690 xf->sock5_req_state++;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
691 xf->rxlen = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
692 bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
693 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
694 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
695 case 0x04:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
696 xf->tx_buf[0] = 0x05;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
697 xf->tx_buf[1] = 0x00;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
698 xf->tx_buf[2] = 0x00;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
699 xf->tx_buf[3] = 0x03;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
700 xf->tx_buf[4] = strlen(xf->buddy_ip);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
701 memcpy(xf->tx_buf + 5, xf->buddy_ip, strlen(xf->buddy_ip));
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
702 xf->tx_buf[5+strlen(xf->buddy_ip)] = 0x00;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
703 xf->tx_buf[6+strlen(xf->buddy_ip)] = 0x00;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
704 len = write(source, xf->tx_buf, 7 + strlen(xf->buddy_ip));
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
705 if (len < 0 && errno == EAGAIN) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
706 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
707 } else if (len < 0) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
708 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
709 xfer->watcher = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
710 close(source);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
711 purple_xfer_cancel_remote(xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
712 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
713 } else {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
714 purple_input_remove(xfer->watcher);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
715 xfer->watcher = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
716 xf->rxlen = 0;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
717 /*close(source);*/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
718 purple_xfer_start(xfer, source, NULL, -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
719 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
720 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
721 default:
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
722 break;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
723 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
724 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
725 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
726 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
727 bonjour_bytestreams_connect(PurpleXfer *xfer)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
728 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
729 XepXfer *xf = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
730 char dstaddr[41];
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
731 unsigned char hashval[20];
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
732 char *p = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
733 int i;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
734 if(xfer == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
735 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
736 purple_debug_info("Bonjour", "bonjour-bytestreams-connect.\n");
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
737 xf = (XepXfer*)xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
738 if(!xf)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
739 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
740 xf->proxy_info = purple_proxy_info_new();
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
741 if(xf->proxy_info == NULL)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
742 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
743 p = g_strdup_printf("%s@%s", xf->sid, xfer->who);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
744 purple_cipher_digest_region("sha1", (guchar *)dstaddr, strlen(dstaddr),
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
745 sizeof(hashval), hashval, NULL);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
746 g_free(p);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
747 memset(dstaddr, 0, 41);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
748 p = dstaddr;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
749 for(i=0; i<20; i++) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
750 snprintf(p, 3, "%02x", hashval[i]);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
751 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
752 purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
753 purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
754 purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
755 xf->proxy_connection = purple_proxy_connect_socks5(NULL, xf->proxy_info,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
756 dstaddr, 0,
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
757 bonjour_bytestreams_connect_cb, xfer);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
758 if(xf->proxy_connection == NULL) {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
759 purple_proxy_info_destroy(xf->proxy_info);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
760 xf->proxy_info = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
761 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
762 }
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
763
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
764 static void
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
765 bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
766 {
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
767 PurpleXfer *xfer = data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
768 XepXfer *xf = xfer->data;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
769 if(data == NULL || source < 0)
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
770 return;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
771 purple_proxy_info_destroy(xf->proxy_info);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
772 xf->proxy_connection = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
773 xf->proxy_info = NULL;
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
774 /* Here, start the file transfer.*/
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
775 purple_xfer_start(xfer, source, NULL, -1);
d8106b63b0a4 I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
776 }