Mercurial > pidgin
annotate libpurple/protocols/msn/slp.c @ 31529:79ae7200a11a
Silence a swath of warnings regarding set-but-unused.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 03 May 2011 05:31:38 +0000 |
parents | 9ccbd0302bb2 |
children | 462c19eb31d8 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file msnslp.c MSNSLP support |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19591
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30735
diff
changeset
|
24 |
30758
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30742
diff
changeset
|
25 #include "internal.h" |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30735
diff
changeset
|
26 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30735
diff
changeset
|
27 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "slp.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "slpcall.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "slpmsg.h" |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
31 #include "msnutils.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "object.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "user.h" |
30811
fcfe022982e4
This header is needed to know the max size of a part.
masca@cpw.pidgin.im
parents:
30810
diff
changeset
|
35 #include "sbconn.h" |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
36 #include "directconn.h" |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
37 #include "p2p.h" |
30832
eabeba9c823f
Move msn_xfer code to it's own module aiming to simplify slp code.
masca@cpw.pidgin.im
parents:
30831
diff
changeset
|
38 #include "xfer.h" |
22512
b65997110933
The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20990
diff
changeset
|
39 |
30081
ee423c6c71b6
Minor comment fix.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30079
diff
changeset
|
40 /* seconds to delay between sending buddy icon requests to the server. */ |
24399
9bdaf273c0ff
Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
41 #define BUDDY_ICON_DELAY 20 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
30318
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
43 typedef struct { |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
44 MsnSession *session; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
45 const char *remote_user; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
46 const char *sha1; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
47 } MsnFetchUserDisplayData; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 * SLP Control |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
53 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
54 msn_slp_send_ok(MsnSlpCall *slpcall, const char *branch, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 const char *type, const char *content) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 slplink = slpcall->slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 /* 200 OK */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 slpmsg = msn_slpmsg_sip_new(slpcall, 1, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 "MSNSLP/1.0 200 OK", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 branch, type, content); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 slpmsg->info = "SLP 200 OK"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 slpmsg->text_body = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 msn_slplink_queue_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
73 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29495
diff
changeset
|
74 msn_slp_send_decline(MsnSlpCall *slpcall, const char *branch, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 const char *type, const char *content) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 slplink = slpcall->slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 /* 603 Decline */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 slpmsg = msn_slpmsg_sip_new(slpcall, 1, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 "MSNSLP/1.0 603 Decline", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 branch, type, content); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 slpmsg->info = "SLP 603 Decline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 slpmsg->text_body = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 msn_slplink_queue_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 * Msg Callbacks |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 * buddy icon request if there is one. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 msn_release_buddy_icon_request_timeout(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 MsnUserList *userlist = (MsnUserList *)data; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
23129
diff
changeset
|
105 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 /* Free one window slot */ |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
23129
diff
changeset
|
107 userlist->buddy_icon_window++; |
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
23129
diff
changeset
|
108 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 /* Clear the tag for our former request timer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 userlist->buddy_icon_request_timer = 0; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
23129
diff
changeset
|
111 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 msn_release_buddy_icon_request(userlist); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
23129
diff
changeset
|
113 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 got_user_display(MsnSlpCall *slpcall, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 const guchar *data, gsize size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 const char *info; |
15822 | 122 PurpleAccount *account; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 g_return_if_fail(slpcall != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 info = slpcall->data_info; |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26517
diff
changeset
|
127 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26517
diff
changeset
|
128 purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 account = slpcall->slplink->session->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 |
15822 | 132 purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30337
diff
changeset
|
133 g_memdup(data, size), size, info); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 end_user_display(MsnSlpCall *slpcall, MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 MsnUserList *userlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 g_return_if_fail(session != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26517
diff
changeset
|
143 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26517
diff
changeset
|
144 purple_debug_info("msn", "End User Display\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 userlist = session->userlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 /* If the session is being destroyed we better stop doing anything. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 if (session->destroying) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 * send us an error 800 like so: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 * C: NS 000: XFR 21 SB |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 * S: NS 000: 800 21 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 if (userlist->buddy_icon_request_timer) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 /* Free the window slot used by this previous request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 userlist->buddy_icon_window++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 /* Clear our pending timeout */ |
15822 | 164 purple_timeout_remove(userlist->buddy_icon_request_timer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
24399
9bdaf273c0ff
Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
167 /* Wait BUDDY_ICON_DELAY s before freeing our window slot and requesting the next icon. */ |
9bdaf273c0ff
Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
168 userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 msn_release_buddy_icon_request_timeout, userlist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
23497
01c3074b2299
A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23298
diff
changeset
|
172 static void |
30318
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
173 fetched_user_display(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
174 const gchar *url_text, gsize len, const gchar *error_message) |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
175 { |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
176 MsnFetchUserDisplayData *data = user_data; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
177 MsnSession *session = data->session; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
178 |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
179 session->url_datas = g_slist_remove(session->url_datas, url_data); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
180 |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
181 if (url_text) { |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
182 purple_buddy_icons_set_for_user(session->account, data->remote_user, |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
183 g_memdup(url_text, len), len, |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
184 data->sha1); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
185 } |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
186 |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
187 end_user_display(NULL, session); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
188 |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
189 g_free(user_data); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
190 } |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
191 |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
192 static void |
30835
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
193 request_own_user_display(MsnUser *user) |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
194 { |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
195 PurpleAccount *account; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
196 MsnSession *session; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
197 MsnObject *my_obj = NULL; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
198 gconstpointer data = NULL; |
30908
bc85e62fdb19
Fix possible uninitialized value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30906
diff
changeset
|
199 const char *info = NULL; |
30835
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
200 size_t len = 0; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
201 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
202 if (purple_debug_is_verbose()) |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
203 purple_debug_info("msn", "Requesting our own user display\n"); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
204 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
205 session = user->userlist->session; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
206 account = session->account; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
207 my_obj = msn_user_get_object(user); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
208 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
209 if (my_obj != NULL) { |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
210 PurpleStoredImage *img = msn_object_get_image(my_obj); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
211 data = purple_imgstore_get_data(img); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
212 len = purple_imgstore_get_size(img); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
213 info = msn_object_get_sha1(my_obj); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
214 } |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
215 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
216 purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
217 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
218 /* Free one window slot */ |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
219 session->userlist->buddy_icon_window++; |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
220 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
221 if (purple_debug_is_verbose()) |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
222 purple_debug_info("msn", "msn_request_user_display(): buddy_icon_window++ yields =%d\n", |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
223 session->userlist->buddy_icon_window); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
224 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
225 msn_release_buddy_icon_request(session->userlist); |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
226 } |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
227 |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
228 void |
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
229 msn_request_user_display(MsnUser *user) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 { |
15822 | 231 PurpleAccount *account; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 MsnSession *session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 MsnObject *obj; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 const char *info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 session = user->userlist->session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 account = session->account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 slplink = msn_session_get_slplink(session, user->passport); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 obj = msn_user_get_object(user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
16031
7873f314fadf
Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
244 info = msn_object_get_sha1(obj); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 if (g_ascii_strcasecmp(user->passport, |
15822 | 247 purple_account_get_username(account))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 { |
30318
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
249 const char *url = msn_object_get_url1(obj); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
250 if (url) { |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
251 MsnFetchUserDisplayData *data = g_new0(MsnFetchUserDisplayData, 1); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
252 PurpleUtilFetchUrlData *url_data; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
253 data->session = session; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
254 data->remote_user = user->passport; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
255 data->sha1 = info; |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
256 url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, 200*1024, |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
257 fetched_user_display, data); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
258 session->url_datas = g_slist_prepend(session->url_datas, url_data); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
259 } else { |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
260 msn_slplink_request_object(slplink, info, got_user_display, |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
261 end_user_display, obj); |
76049fde7ad2
Add support for Url/Url1 in MSN objects, which are used for buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30122
diff
changeset
|
262 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 else |
30835
56ef12440d52
Move queue logic in requesting user display out of slp code.
masca@cpw.pidgin.im
parents:
30833
diff
changeset
|
265 request_own_user_display(user); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 } |
30831 | 267 |
268 static void | |
269 send_file_cb(MsnSlpCall *slpcall) | |
270 { | |
271 MsnSlpMessage *slpmsg; | |
272 PurpleXfer *xfer; | |
273 | |
274 xfer = (PurpleXfer *)slpcall->xfer; | |
275 if (purple_xfer_get_status(xfer) >= PURPLE_XFER_STATUS_STARTED) | |
276 return; | |
277 | |
278 purple_xfer_ref(xfer); | |
279 purple_xfer_start(xfer, -1, NULL, 0); | |
280 if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_STARTED) { | |
281 purple_xfer_unref(xfer); | |
282 return; | |
283 } | |
284 purple_xfer_unref(xfer); | |
285 | |
286 slpmsg = msn_slpmsg_file_new(slpcall, purple_xfer_get_size(xfer)); | |
287 msn_slpmsg_set_slplink(slpmsg, slpcall->slplink); | |
288 | |
289 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); | |
290 } | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
30831 | 292 static gchar * |
293 gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) | |
294 { | |
295 gsize size = 0; | |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
296 MsnFileContext context; |
30831 | 297 gchar *u8 = NULL; |
298 gchar *ret; | |
299 gunichar2 *uni = NULL; | |
300 glong currentChar = 0; | |
301 glong len = 0; | |
302 const char *preview; | |
303 gsize preview_len; | |
304 | |
305 size = purple_xfer_get_size(xfer); | |
306 | |
307 purple_xfer_prepare_thumbnail(xfer, "png"); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
30831 | 309 if (!file_name) { |
310 gchar *basename = g_path_get_basename(file_path); | |
311 u8 = purple_utf8_try_convert(basename); | |
312 g_free(basename); | |
313 file_name = u8; | |
314 } | |
315 | |
316 uni = g_utf8_to_utf16(file_name, -1, NULL, &len, NULL); | |
317 | |
318 if (u8) { | |
319 g_free(u8); | |
320 file_name = NULL; | |
321 u8 = NULL; | |
322 } | |
323 | |
324 preview = purple_xfer_get_thumbnail(xfer, &preview_len); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
326 context.length = MSN_FILE_CONTEXT_SIZE; |
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
327 context.version = 2; /* V.3 contains additional unnecessary data */ |
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
328 context.file_size = size; |
30831 | 329 if (preview) |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
330 context.type = 0; |
30831 | 331 else |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
332 context.type = 1; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
30831 | 334 len = MIN(len, MAX_FILE_NAME_LEN); |
335 for (currentChar = 0; currentChar < len; currentChar++) { | |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
336 context.file_name[currentChar] = GUINT16_TO_LE(uni[currentChar]); |
30831 | 337 } |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
338 memset(&context.file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2); |
31046
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
339 |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
340 memset(&context.unknown1, 0, sizeof(context.unknown1)); |
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
341 context.unknown2 = 0xffffffff; |
30831 | 342 |
31046
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
343 /* Mind the cast, as in, don't free it after! */ |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
344 context.preview = (char *)preview; |
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
345 context.preview_len = preview_len; |
31046
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
346 |
31118
9ccbd0302bb2
Change MsnFileContext variables from "header" to "context". This it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31046
diff
changeset
|
347 u8 = msn_file_context_to_wire(&context); |
31046
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
348 ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE + preview_len); |
30831 | 349 |
350 g_free(uni); | |
31046
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
351 g_free(u8); |
b4064198e017
Add functions for reading and writing a MsnFileContext which negates
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30908
diff
changeset
|
352 |
30831 | 353 return ret; |
354 } | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 |
30831 | 356 void |
357 msn_request_ft(PurpleXfer *xfer) | |
358 { | |
359 MsnSlpCall *slpcall; | |
360 MsnSlpLink *slplink; | |
361 char *context; | |
362 const char *fn; | |
363 const char *fp; | |
364 | |
365 fn = purple_xfer_get_filename(xfer); | |
366 fp = purple_xfer_get_local_filename(xfer); | |
367 | |
368 slplink = xfer->data; | |
369 | |
370 g_return_if_fail(slplink != NULL); | |
371 g_return_if_fail(fp != NULL); | |
372 | |
373 slpcall = msn_slpcall_new(slplink); | |
374 msn_slpcall_init(slpcall, MSN_SLPCALL_DC); | |
23500
1061a9ad1ddb
disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23499
diff
changeset
|
375 |
30831 | 376 slpcall->session_init_cb = send_file_cb; |
377 slpcall->end_cb = msn_xfer_end_cb; | |
378 slpcall->cb = msn_xfer_completed_cb; | |
379 slpcall->xfer = xfer; | |
380 purple_xfer_ref(slpcall->xfer); | |
381 | |
382 slpcall->pending = TRUE; | |
23500
1061a9ad1ddb
disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23499
diff
changeset
|
383 |
30831 | 384 purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); |
385 purple_xfer_set_read_fnc(xfer, msn_xfer_read); | |
386 purple_xfer_set_write_fnc(xfer, msn_xfer_write); | |
387 | |
388 xfer->data = slpcall; | |
389 | |
390 context = gen_context(xfer, fn, fp); | |
391 | |
30844
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30835
diff
changeset
|
392 msn_slpcall_invite(slpcall, MSN_FT_GUID, P2P_APPID_FILE, context); |
30831 | 393 msn_slplink_unref(slplink); |
394 | |
395 g_free(context); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } |
30831 | 397 |