Tue, 28 Apr 2009 20:57:59 +0000
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
through fe4f5d91d1605cf93c53470e59d4bf8da6c5c840
ChangeLog for the above.
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2 | * @file msnslp.c MSNSLP support |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
4 | * purple |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
6 | * Purple is the legal property of its developers, whose names are too numerous |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
8 | * source distribution. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
9 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
13 | * (at your option) any later version. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
14 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
18 | * GNU General Public License for more details. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
19 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
23 | */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
24 | #include "msn.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
25 | #include "slp.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
26 | #include "slpcall.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
27 | #include "slpmsg.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
28 | #include "slpsession.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
29 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
30 | #include "object.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
31 | #include "user.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
32 | #include "switchboard.h" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
33 | |
|
22738
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
34 | #include "smiley.h" |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
35 | |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
22738
diff
changeset
|
36 | /* Seconds to delay between sending buddy icon requests to the server. */ |
|
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
22738
diff
changeset
|
37 | #define BUDDY_ICON_DELAY 20 |
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
38 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
39 | static void send_ok(MsnSlpCall *slpcall, const char *branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
40 | const char *type, const char *content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
41 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
42 | static void send_decline(MsnSlpCall *slpcall, const char *branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
43 | const char *type, const char *content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
44 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
45 | void msn_request_user_display(MsnUser *user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
46 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
47 | /************************************************************************** |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
48 | * Util |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
49 | **************************************************************************/ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
50 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
51 | static char * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
52 | get_token(const char *str, const char *start, const char *end) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
53 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
54 | const char *c, *c2; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
55 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
56 | if ((c = strstr(str, start)) == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
57 | return NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
58 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
59 | c += strlen(start); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
60 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
61 | if (end != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
62 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
63 | if ((c2 = strstr(c, end)) == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
64 | return NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
65 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
66 | return g_strndup(c, c2 - c); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
67 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
68 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
69 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
70 | /* This has to be changed */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
71 | return g_strdup(c); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
72 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
73 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
74 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
75 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
76 | /************************************************************************** |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
77 | * Xfer |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
78 | **************************************************************************/ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
79 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
80 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
81 | msn_xfer_init(PurpleXfer *xfer) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
82 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
83 | MsnSlpCall *slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
84 | /* MsnSlpLink *slplink; */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
85 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
86 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
87 | purple_debug_info("msn", "xfer_init\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
88 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
89 | slpcall = xfer->data; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
90 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
91 | /* Send Ok */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
92 | content = g_strdup_printf("SessionID: %lu\r\n\r\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
93 | slpcall->session_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
94 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
95 | send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
96 | content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
97 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
98 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
99 | msn_slplink_unleash(slpcall->slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
100 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
101 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
102 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
103 | msn_xfer_cancel(PurpleXfer *xfer) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
104 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
105 | MsnSlpCall *slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
106 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
107 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
108 | g_return_if_fail(xfer != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
109 | g_return_if_fail(xfer->data != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
110 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
111 | slpcall = xfer->data; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
112 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
113 | if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
114 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
115 | if (slpcall->started) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
116 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
117 | msn_slp_call_close(slpcall); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
118 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
119 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
120 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
121 | content = g_strdup_printf("SessionID: %lu\r\n\r\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
122 | slpcall->session_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
123 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
124 | send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
125 | content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
126 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
127 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
128 | msn_slplink_unleash(slpcall->slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
129 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
130 | msn_slp_call_destroy(slpcall); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
131 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
132 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
133 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
134 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
135 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
136 | msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
137 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
138 | PurpleXfer *xfer; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
139 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
140 | xfer = slpcall->xfer; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
141 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
142 | xfer->bytes_sent = (offset + len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
143 | xfer->bytes_remaining = total_length - (offset + len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
144 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
145 | purple_xfer_update_progress(xfer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
146 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
147 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
148 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
149 | msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
150 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
151 | if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
152 | (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
153 | (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
154 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
155 | purple_xfer_cancel_remote(slpcall->xfer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
156 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
157 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
158 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
159 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
160 | msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
161 | gsize size) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
162 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
163 | PurpleXfer *xfer = slpcall->xfer; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
164 | purple_xfer_set_completed(xfer, TRUE); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
165 | purple_xfer_end(xfer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
166 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
167 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
168 | /************************************************************************** |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
169 | * SLP Control |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
170 | **************************************************************************/ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
171 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
172 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
173 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
174 | got_transresp(MsnSlpCall *slpcall, const char *nonce, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
175 | const char *ips_str, int port) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
176 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
177 | MsnDirectConn *directconn; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
178 | char **ip_addrs, **c; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
179 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
180 | directconn = msn_directconn_new(slpcall->slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
181 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
182 | directconn->initial_call = slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
183 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
184 | /* msn_directconn_parse_nonce(directconn, nonce); */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
185 | directconn->nonce = g_strdup(nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
186 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
187 | ip_addrs = g_strsplit(ips_str, " ", -1); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
188 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
189 | for (c = ip_addrs; *c != NULL; c++) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
190 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
191 | purple_debug_info("msn", "ip_addr = %s\n", *c); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
192 | if (msn_directconn_connect(directconn, *c, port)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
193 | break; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
194 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
195 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
196 | g_strfreev(ip_addrs); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
197 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
198 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
199 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
200 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
201 | send_ok(MsnSlpCall *slpcall, const char *branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
202 | const char *type, const char *content) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
203 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
204 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
205 | MsnSlpMessage *slpmsg; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
206 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
207 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
208 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
209 | /* 200 OK */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
210 | slpmsg = msn_slpmsg_sip_new(slpcall, 1, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
211 | "MSNSLP/1.0 200 OK", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
212 | branch, type, content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
213 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
214 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
215 | slpmsg->info = "SLP 200 OK"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
216 | slpmsg->text_body = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
217 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
218 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
219 | msn_slplink_queue_slpmsg(slplink, slpmsg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
220 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
221 | msn_slp_call_session_init(slpcall); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
222 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
223 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
224 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
225 | send_decline(MsnSlpCall *slpcall, const char *branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
226 | const char *type, const char *content) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
227 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
228 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
229 | MsnSlpMessage *slpmsg; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
230 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
231 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
232 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
233 | /* 603 Decline */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
234 | slpmsg = msn_slpmsg_sip_new(slpcall, 1, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
235 | "MSNSLP/1.0 603 Decline", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
236 | branch, type, content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
237 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
238 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
239 | slpmsg->info = "SLP 603 Decline"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
240 | slpmsg->text_body = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
241 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
242 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
243 | msn_slplink_queue_slpmsg(slplink, slpmsg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
244 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
245 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
246 | #define MAX_FILE_NAME_LEN 0x226 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
247 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
248 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
249 | got_sessionreq(MsnSlpCall *slpcall, const char *branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
250 | const char *euf_guid, const char *context) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
251 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
252 | if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
253 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
254 | /* Emoticon or UserDisplay */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
255 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
256 | gsize len; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
257 | MsnSlpSession *slpsession; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
258 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
259 | MsnSlpMessage *slpmsg; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
260 | MsnObject *obj; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
261 | char *msnobj_data; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
262 | PurpleStoredImage *img; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
263 | int type; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
264 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
265 | /* Send Ok */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
266 | content = g_strdup_printf("SessionID: %lu\r\n\r\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
267 | slpcall->session_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
268 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
269 | send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
270 | content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
271 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
272 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
273 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
274 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
275 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
276 | msnobj_data = (char *)purple_base64_decode(context, &len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
277 | obj = msn_object_new_from_string(msnobj_data); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
278 | type = msn_object_get_type(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
279 | g_free(msnobj_data); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
280 | |
|
22738
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
281 | if ((type != MSN_OBJECT_USERTILE) && (type != MSN_OBJECT_EMOTICON)) |
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
282 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
283 | purple_debug_error("msn", "Wrong object?\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
284 | msn_object_destroy(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
285 | g_return_if_reached(); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
286 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
287 | |
|
22738
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
288 | if (type == MSN_OBJECT_EMOTICON) { |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
289 | char *path; |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
290 | path = g_build_filename(purple_smileys_get_storing_dir(), |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
291 | obj->location, NULL); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
292 | img = purple_imgstore_new_from_file(path); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
293 | g_free(path); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
294 | } else { |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
295 | img = msn_object_get_image(obj); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
296 | if (img) |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
297 | purple_imgstore_ref(img); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
298 | } |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
299 | msn_object_destroy(obj); |
|
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
300 | |
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
301 | if (img == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
302 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
303 | purple_debug_error("msn", "Wrong object.\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
304 | g_return_if_reached(); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
305 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
306 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
307 | slpsession = msn_slplink_find_slp_session(slplink, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
308 | slpcall->session_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
309 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
310 | /* DATA PREP */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
311 | slpmsg = msn_slpmsg_new(slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
312 | slpmsg->slpcall = slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
313 | slpmsg->slpsession = slpsession; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
314 | slpmsg->session_id = slpsession->id; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
315 | msn_slpmsg_set_body(slpmsg, NULL, 4); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
316 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
317 | slpmsg->info = "SLP DATA PREP"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
318 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
319 | msn_slplink_queue_slpmsg(slplink, slpmsg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
320 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
321 | /* DATA */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
322 | slpmsg = msn_slpmsg_new(slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
323 | slpmsg->slpcall = slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
324 | slpmsg->slpsession = slpsession; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
325 | slpmsg->flags = 0x20; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
326 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
327 | slpmsg->info = "SLP DATA"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
328 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
329 | msn_slpmsg_set_image(slpmsg, img); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
330 | msn_slplink_queue_slpmsg(slplink, slpmsg); |
|
22738
bc6dfe40f496
Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21481
diff
changeset
|
331 | purple_imgstore_unref(img); |
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
332 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
333 | else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
334 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
335 | /* File Transfer */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
336 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
337 | PurpleXfer *xfer; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
338 | char *bin; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
339 | gsize bin_len; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
340 | guint32 file_size; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
341 | char *file_name; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
342 | gunichar2 *uni_name; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
343 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
344 | account = slpcall->slplink->session->account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
345 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
346 | slpcall->cb = msn_xfer_completed_cb; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
347 | slpcall->end_cb = msn_xfer_end_cb; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
348 | slpcall->progress_cb = msn_xfer_progress_cb; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
349 | slpcall->branch = g_strdup(branch); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
350 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
351 | slpcall->pending = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
352 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
353 | xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
354 | slpcall->slplink->remote_user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
355 | if (xfer) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
356 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
357 | bin = (char *)purple_base64_decode(context, &bin_len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
358 | file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
359 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
360 | uni_name = (gunichar2 *)(bin + 20); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
361 | while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
362 | *uni_name = GUINT16_FROM_LE(*uni_name); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
363 | uni_name++; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
364 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
365 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
366 | file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
367 | NULL, NULL, NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
368 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
369 | g_free(bin); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
370 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
371 | purple_xfer_set_filename(xfer, file_name); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
372 | purple_xfer_set_size(xfer, file_size); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
373 | purple_xfer_set_init_fnc(xfer, msn_xfer_init); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
374 | purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
375 | purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
376 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
377 | slpcall->xfer = xfer; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
378 | purple_xfer_ref(slpcall->xfer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
379 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
380 | xfer->data = slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
381 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
382 | purple_xfer_request(xfer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
383 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
384 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
385 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
386 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
387 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
388 | send_bye(MsnSlpCall *slpcall, const char *type) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
389 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
390 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
391 | MsnSlpMessage *slpmsg; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
392 | char *header; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
393 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
394 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
395 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
396 | g_return_if_fail(slplink != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
397 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
398 | header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
399 | slplink->local_user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
400 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
401 | slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
402 | "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
403 | type, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
404 | "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
405 | g_free(header); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
406 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
407 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
408 | slpmsg->info = "SLP BYE"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
409 | slpmsg->text_body = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
410 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
411 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
412 | msn_slplink_queue_slpmsg(slplink, slpmsg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
413 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
414 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
415 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
416 | got_invite(MsnSlpCall *slpcall, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
417 | const char *branch, const char *type, const char *content) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
418 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
419 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
420 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
421 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
422 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
423 | if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
424 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
425 | char *euf_guid, *context; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
426 | char *temp; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
427 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
428 | euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
429 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
430 | temp = get_token(content, "SessionID: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
431 | if (temp != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
432 | slpcall->session_id = atoi(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
433 | g_free(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
434 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
435 | temp = get_token(content, "AppID: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
436 | if (temp != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
437 | slpcall->app_id = atoi(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
438 | g_free(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
439 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
440 | context = get_token(content, "Context: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
441 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
442 | if (context != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
443 | got_sessionreq(slpcall, branch, euf_guid, context); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
444 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
445 | g_free(context); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
446 | g_free(euf_guid); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
447 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
448 | else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
449 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
450 | /* A direct connection? */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
451 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
452 | char *listening, *nonce; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
453 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
454 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
455 | if (FALSE) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
456 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
457 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
458 | MsnDirectConn *directconn; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
459 | /* const char *ip_addr; */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
460 | char *ip_port; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
461 | int port; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
462 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
463 | /* ip_addr = purple_prefs_get_string("/purple/ft/public_ip"); */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
464 | ip_port = "5190"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
465 | listening = "true"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
466 | nonce = rand_guid(); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
467 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
468 | directconn = msn_directconn_new(slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
469 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
470 | /* msn_directconn_parse_nonce(directconn, nonce); */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
471 | directconn->nonce = g_strdup(nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
472 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
473 | msn_directconn_listen(directconn); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
474 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
475 | port = directconn->port; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
476 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
477 | content = g_strdup_printf( |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
478 | "Bridge: TCPv1\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
479 | "Listening: %s\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
480 | "Nonce: {%s}\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
481 | "Ipv4Internal-Addrs: 192.168.0.82\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
482 | "Ipv4Internal-Port: %d\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
483 | "\r\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
484 | listening, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
485 | nonce, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
486 | port); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
487 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
488 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
489 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
490 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
491 | listening = "false"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
492 | nonce = g_strdup("00000000-0000-0000-0000-000000000000"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
493 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
494 | content = g_strdup_printf( |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
495 | "Bridge: TCPv1\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
496 | "Listening: %s\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
497 | "Nonce: {%s}\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
498 | "\r\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
499 | listening, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
500 | nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
501 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
502 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
503 | send_ok(slpcall, branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
504 | "application/x-msnmsgr-transrespbody", content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
505 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
506 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
507 | g_free(nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
508 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
509 | else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
510 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
511 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
512 | char *ip_addrs; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
513 | char *temp; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
514 | char *nonce; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
515 | int port; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
516 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
517 | nonce = get_token(content, "Nonce: {", "}\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
518 | ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
519 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
520 | temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
521 | if (temp != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
522 | port = atoi(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
523 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
524 | port = -1; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
525 | g_free(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
526 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
527 | if (ip_addrs == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
528 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
529 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
530 | if (port > 0) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
531 | got_transresp(slpcall, nonce, ip_addrs, port); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
532 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
533 | g_free(nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
534 | g_free(ip_addrs); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
535 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
536 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
537 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
538 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
539 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
540 | got_ok(MsnSlpCall *slpcall, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
541 | const char *type, const char *content) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
542 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
543 | g_return_if_fail(slpcall != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
544 | g_return_if_fail(type != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
545 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
546 | if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
547 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
548 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
549 | if (slpcall->type == MSN_SLPCALL_DC) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
550 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
551 | /* First let's try a DirectConnection. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
552 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
553 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
554 | MsnSlpMessage *slpmsg; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
555 | char *header; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
556 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
557 | char *branch; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
558 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
559 | slplink = slpcall->slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
560 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
561 | branch = rand_guid(); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
562 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
563 | content = g_strdup_printf( |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
564 | "Bridges: TRUDPv1 TCPv1\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
565 | "NetID: 0\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
566 | "Conn-Type: Direct-Connect\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
567 | "UPnPNat: false\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
568 | "ICF: false\r\n" |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
569 | ); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
570 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
571 | header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
572 | slplink->remote_user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
573 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
574 | slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
575 | "application/x-msnmsgr-transreqbody", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
576 | content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
577 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
578 | #ifdef MSN_DEBUG_SLP |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
579 | slpmsg->info = "SLP INVITE"; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
580 | slpmsg->text_body = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
581 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
582 | msn_slplink_send_slpmsg(slplink, slpmsg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
583 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
584 | g_free(header); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
585 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
586 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
587 | g_free(branch); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
588 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
589 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
590 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
591 | msn_slp_call_session_init(slpcall); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
592 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
593 | #else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
594 | msn_slp_call_session_init(slpcall); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
595 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
596 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
597 | else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
598 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
599 | /* Do we get this? */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
600 | purple_debug_info("msn", "OK with transreqbody\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
601 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
602 | else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
603 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
604 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
605 | char *ip_addrs; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
606 | char *temp; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
607 | char *nonce; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
608 | int port; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
609 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
610 | nonce = get_token(content, "Nonce: {", "}\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
611 | ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
612 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
613 | temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
614 | if (temp != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
615 | port = atoi(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
616 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
617 | port = -1; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
618 | g_free(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
619 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
620 | if (ip_addrs == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
621 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
622 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
623 | if (port > 0) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
624 | got_transresp(slpcall, nonce, ip_addrs, port); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
625 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
626 | g_free(nonce); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
627 | g_free(ip_addrs); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
628 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
629 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
630 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
631 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
632 | MsnSlpCall * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
633 | msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
634 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
635 | MsnSlpCall *slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
636 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
637 | if (body == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
638 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
639 | purple_debug_warning("msn", "received bogus message\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
640 | return NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
641 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
642 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
643 | if (!strncmp(body, "INVITE", strlen("INVITE"))) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
644 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
645 | char *branch; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
646 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
647 | char *content_type; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
648 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
649 | slpcall = msn_slp_call_new(slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
650 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
651 | /* From: <msnmsgr:buddy@hotmail.com> */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
652 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
653 | slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
654 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
655 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
656 | branch = get_token(body, ";branch={", "}"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
657 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
658 | slpcall->id = get_token(body, "Call-ID: {", "}"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
659 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
660 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
661 | long content_len = -1; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
662 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
663 | temp = get_token(body, "Content-Length: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
664 | if (temp != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
665 | content_len = atoi(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
666 | g_free(temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
667 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
668 | content_type = get_token(body, "Content-Type: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
669 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
670 | content = get_token(body, "\r\n\r\n", NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
671 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
672 | got_invite(slpcall, branch, content_type, content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
673 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
674 | g_free(branch); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
675 | g_free(content_type); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
676 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
677 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
678 | else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
679 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
680 | char *content; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
681 | char *content_type; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
682 | /* Make sure this is "OK" */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
683 | const char *status = body + strlen("MSNSLP/1.0 "); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
684 | char *call_id; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
685 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
686 | call_id = get_token(body, "Call-ID: {", "}"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
687 | slpcall = msn_slplink_find_slp_call(slplink, call_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
688 | g_free(call_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
689 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
690 | g_return_val_if_fail(slpcall != NULL, NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
691 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
692 | if (strncmp(status, "200 OK", 6)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
693 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
694 | /* It's not valid. Kill this off. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
695 | char temp[32]; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
696 | const char *c; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
697 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
698 | /* Eww */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
699 | if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
700 | (c = strchr(status, '\0'))) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
701 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
702 | size_t offset = c - status; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
703 | if (offset >= sizeof(temp)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
704 | offset = sizeof(temp) - 1; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
705 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
706 | strncpy(temp, status, offset); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
707 | temp[offset] = '\0'; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
708 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
709 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
710 | purple_debug_error("msn", "Received non-OK result: %s\n", temp); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
711 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
712 | slpcall->wasted = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
713 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
714 | /* msn_slp_call_destroy(slpcall); */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
715 | return slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
716 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
717 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
718 | content_type = get_token(body, "Content-Type: ", "\r\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
719 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
720 | content = get_token(body, "\r\n\r\n", NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
721 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
722 | got_ok(slpcall, content_type, content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
723 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
724 | g_free(content_type); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
725 | g_free(content); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
726 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
727 | else if (!strncmp(body, "BYE", strlen("BYE"))) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
728 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
729 | char *call_id; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
730 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
731 | call_id = get_token(body, "Call-ID: {", "}"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
732 | slpcall = msn_slplink_find_slp_call(slplink, call_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
733 | g_free(call_id); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
734 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
735 | if (slpcall != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
736 | slpcall->wasted = TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
737 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
738 | /* msn_slp_call_destroy(slpcall); */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
739 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
740 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
741 | slpcall = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
742 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
743 | return slpcall; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
744 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
745 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
746 | /************************************************************************** |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
747 | * Msg Callbacks |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
748 | **************************************************************************/ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
749 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
750 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
751 | msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
752 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
753 | MsnSession *session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
754 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
755 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
756 | session = cmdproc->servconn->session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
757 | slplink = msn_session_get_slplink(session, msg->remote_user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
758 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
759 | if (slplink->swboard == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
760 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
761 | /* We will need this in order to change its flags. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
762 | slplink->swboard = (MsnSwitchBoard *)cmdproc->data; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
763 | /* If swboard is NULL, something has probably gone wrong earlier on |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
764 | * I didn't want to do this, but MSN 7 is somehow causing us to crash |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
765 | * here, I couldn't reproduce it to debug more, and people are |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
766 | * reporting bugs. Hopefully this doesn't cause more crashes. Stu. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
767 | */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
768 | if (slplink->swboard != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
769 | slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
770 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
771 | purple_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
772 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
773 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
774 | msn_slplink_process_msg(slplink, msg); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
775 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
776 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
777 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
778 | got_emoticon(MsnSlpCall *slpcall, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
779 | const guchar *data, gsize size) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
780 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
781 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
782 | PurpleConversation *conv; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
783 | PurpleConnection *gc; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
784 | const char *who; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
785 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
786 | gc = slpcall->slplink->session->account->gc; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
787 | who = slpcall->slplink->remote_user; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
788 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
789 | if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
790 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
791 | /* FIXME: it would be better if we wrote the data as we received it |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
792 | instead of all at once, calling write multiple times and |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
793 | close once at the very end |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
794 | */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
795 | purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
796 | purple_conv_custom_smiley_close(conv, slpcall->data_info); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
797 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
798 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
799 | purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
800 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
801 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
802 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
803 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
804 | msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
805 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
806 | MsnSession *session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
807 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
808 | MsnObject *obj; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
809 | char **tokens; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
810 | char *smile, *body_str; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
811 | const char *body, *who, *sha1; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
812 | guint tok; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
813 | size_t body_len; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
814 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
815 | PurpleConversation *conv; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
816 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
817 | session = cmdproc->servconn->session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
818 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
819 | if (!purple_account_get_bool(session->account, "custom_smileys", TRUE)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
820 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
821 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
822 | body = msn_message_get_bin_data(msg, &body_len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
823 | body_str = g_strndup(body, body_len); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
824 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
825 | /* MSN Messenger 7 may send more than one MSNObject in a single message... |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
826 | * Maybe 10 tokens is a reasonable max value. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
827 | tokens = g_strsplit(body_str, "\t", 10); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
828 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
829 | g_free(body_str); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
830 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
831 | for (tok = 0; tok < 9; tok += 2) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
832 | if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
833 | break; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
834 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
835 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
836 | smile = tokens[tok]; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
837 | obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1])); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
838 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
839 | if (obj == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
840 | break; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
841 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
842 | who = msn_object_get_creator(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
843 | sha1 = msn_object_get_sha1(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
844 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
845 | slplink = msn_session_get_slplink(session, who); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
846 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
847 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
848 | session->account); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
849 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
850 | /* If the conversation doesn't exist then this is a custom smiley |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
851 | * used in the first message in a MSN conversation: we need to create |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
852 | * the conversation now, otherwise the custom smiley won't be shown. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
853 | * This happens because every GtkIMHtml has its own smiley tree: if |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
854 | * the conversation doesn't exist then we cannot associate the new |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
855 | * smiley with its GtkIMHtml widget. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
856 | if (!conv) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
857 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
858 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
859 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
860 | if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
861 | msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
862 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
863 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
864 | msn_object_destroy(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
865 | obj = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
866 | who = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
867 | sha1 = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
868 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
869 | g_strfreev(tokens); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
870 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
871 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
872 | static gboolean |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
873 | buddy_icon_cached(PurpleConnection *gc, MsnObject *obj) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
874 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
875 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
876 | PurpleBuddy *buddy; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
877 | const char *old; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
878 | const char *new; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
879 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
880 | g_return_val_if_fail(obj != NULL, FALSE); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
881 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
882 | account = purple_connection_get_account(gc); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
883 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
884 | buddy = purple_find_buddy(account, msn_object_get_creator(obj)); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
885 | if (buddy == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
886 | return FALSE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
887 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
888 | old = purple_buddy_icons_get_checksum_for_user(buddy); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
889 | new = msn_object_get_sha1(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
890 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
891 | if (new == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
892 | return FALSE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
893 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
894 | /* If the old and new checksums are the same, and the file actually exists, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
895 | * then return TRUE */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
896 | if (old != NULL && !strcmp(old, new)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
897 | return TRUE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
898 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
899 | return FALSE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
900 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
901 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
902 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
903 | msn_release_buddy_icon_request(MsnUserList *userlist) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
904 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
905 | MsnUser *user; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
906 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
907 | g_return_if_fail(userlist != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
908 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
909 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
910 | purple_debug_info("msn", "Releasing buddy icon request\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
911 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
912 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
913 | if (userlist->buddy_icon_window > 0) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
914 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
915 | GQueue *queue; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
916 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
917 | const char *username; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
918 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
919 | queue = userlist->buddy_icon_requests; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
920 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
921 | if (g_queue_is_empty(userlist->buddy_icon_requests)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
922 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
923 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
924 | user = g_queue_pop_head(queue); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
925 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
926 | account = userlist->session->account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
927 | username = user->passport; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
928 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
929 | userlist->buddy_icon_window--; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
930 | msn_request_user_display(user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
931 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
932 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
933 | purple_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
934 | userlist->buddy_icon_window); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
935 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
936 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
937 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
938 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
939 | /* |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
940 | * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
941 | * buddy icon request if there is one. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
942 | */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
943 | static gboolean |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
944 | msn_release_buddy_icon_request_timeout(gpointer data) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
945 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
946 | MsnUserList *userlist = (MsnUserList *)data; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
947 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
948 | /* Free one window slot */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
949 | userlist->buddy_icon_window++; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
950 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
951 | /* Clear the tag for our former request timer */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
952 | userlist->buddy_icon_request_timer = 0; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
953 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
954 | msn_release_buddy_icon_request(userlist); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
955 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
956 | return FALSE; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
957 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
958 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
959 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
960 | msn_queue_buddy_icon_request(MsnUser *user) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
961 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
962 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
963 | MsnObject *obj; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
964 | GQueue *queue; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
965 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
966 | g_return_if_fail(user != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
967 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
968 | account = user->userlist->session->account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
969 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
970 | obj = msn_user_get_object(user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
971 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
972 | if (obj == NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
973 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
974 | purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
975 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
976 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
977 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
978 | if (!buddy_icon_cached(account->gc, obj)) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
979 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
980 | MsnUserList *userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
981 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
982 | userlist = user->userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
983 | queue = userlist->buddy_icon_requests; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
984 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
985 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
986 | purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
987 | user->passport, userlist->buddy_icon_window); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
988 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
989 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
990 | g_queue_push_tail(queue, user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
991 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
992 | if (userlist->buddy_icon_window > 0) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
993 | msn_release_buddy_icon_request(userlist); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
994 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
995 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
996 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
997 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
998 | got_user_display(MsnSlpCall *slpcall, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
999 | const guchar *data, gsize size) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1000 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1001 | MsnUserList *userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1002 | const char *info; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1003 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1004 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1005 | g_return_if_fail(slpcall != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1006 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1007 | info = slpcall->data_info; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1008 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1009 | purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1010 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1011 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1012 | userlist = slpcall->slplink->session->userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1013 | account = slpcall->slplink->session->account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1014 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1015 | purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1016 | g_memdup(data, size), size, info); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1017 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1018 | #if 0 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1019 | /* Free one window slot */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1020 | userlist->buddy_icon_window++; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1021 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1022 | purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1023 | userlist->buddy_icon_window); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1024 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1025 | msn_release_buddy_icon_request(userlist); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1026 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1027 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1028 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1029 | static void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1030 | end_user_display(MsnSlpCall *slpcall, MsnSession *session) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1031 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1032 | MsnUserList *userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1033 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1034 | g_return_if_fail(session != NULL); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1035 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1036 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1037 | purple_debug_info("msn", "End User Display\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1038 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1039 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1040 | userlist = session->userlist; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1041 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1042 | /* If the session is being destroyed we better stop doing anything. */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1043 | if (session->destroying) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1044 | return; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1045 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1046 | /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1047 | * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1048 | * send us an error 800 like so: |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1049 | * |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1050 | * C: NS 000: XFR 21 SB |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1051 | * S: NS 000: 800 21 |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1052 | */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1053 | if (userlist->buddy_icon_request_timer) { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1054 | /* Free the window slot used by this previous request */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1055 | userlist->buddy_icon_window++; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1056 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1057 | /* Clear our pending timeout */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1058 | purple_timeout_remove(userlist->buddy_icon_request_timer); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1059 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1060 | |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
22738
diff
changeset
|
1061 | /* Wait BUDDY_ICON_DELAY_S seconds before freeing our window slot and requesting the next icon. */ |
|
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
22738
diff
changeset
|
1062 | userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, |
|
21481
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1063 | msn_release_buddy_icon_request_timeout, userlist); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1064 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1065 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1066 | void |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1067 | msn_request_user_display(MsnUser *user) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1068 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1069 | PurpleAccount *account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1070 | MsnSession *session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1071 | MsnSlpLink *slplink; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1072 | MsnObject *obj; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1073 | const char *info; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1074 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1075 | session = user->userlist->session; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1076 | account = session->account; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1077 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1078 | slplink = msn_session_get_slplink(session, user->passport); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1079 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1080 | obj = msn_user_get_object(user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1081 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1082 | info = msn_object_get_sha1(obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1083 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1084 | if (g_ascii_strcasecmp(user->passport, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1085 | purple_account_get_username(account))) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1086 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1087 | msn_slplink_request_object(slplink, info, got_user_display, |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1088 | end_user_display, obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1089 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1090 | else |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1091 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1092 | MsnObject *my_obj = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1093 | gconstpointer data = NULL; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1094 | size_t len = 0; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1095 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1096 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1097 | purple_debug_info("msn", "Requesting our own user display\n"); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1098 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1099 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1100 | my_obj = msn_user_get_object(session->user); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1101 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1102 | if (my_obj != NULL) |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1103 | { |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1104 | PurpleStoredImage *img = msn_object_get_image(my_obj); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1105 | data = purple_imgstore_get_data(img); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1106 | len = purple_imgstore_get_size(img); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1107 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1108 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1109 | purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1110 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1111 | /* Free one window slot */ |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1112 | session->userlist->buddy_icon_window++; |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1113 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1114 | #ifdef MSN_DEBUG_UD |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1115 | purple_debug_info("msn", "msn_request_user_display(): buddy_icon_window++ yields =%d\n", |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1116 | session->userlist->buddy_icon_window); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1117 | #endif |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1118 | |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1119 | msn_release_buddy_icon_request(session->userlist); |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1120 | } |
|
d52b697eaae7
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1121 | } |