Mercurial > pidgin.yaz
comparison src/protocols/msn/slpcall.c @ 10773:888d4c328be5
[gaim-migrate @ 12382]
Patch 1149564 from Felipe Contreras:
"[MSN] Cleanups and fixes
I know it fixes a multiple conversation close
notification but it probably fixes more stuff.
I don't know exactly what are the diferences with what
Stu did."
I munged it a bit, to make it compile and stuff.
Please test this, I might have broken it.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 02 Apr 2005 16:38:33 +0000 |
parents | f52ab405f1ab |
children | 93663df88ec4 |
comparison
equal
deleted
inserted
replaced
10772:12aa8ce77077 | 10773:888d4c328be5 |
---|---|
25 #include "slpcall.h" | 25 #include "slpcall.h" |
26 #include "slpsession.h" | 26 #include "slpsession.h" |
27 | 27 |
28 #include "slp.h" | 28 #include "slp.h" |
29 | 29 |
30 /* #define MSN_DEBUG_SLPCALL */ | |
31 | |
30 /************************************************************************** | 32 /************************************************************************** |
31 * Util | 33 * Util |
32 **************************************************************************/ | 34 **************************************************************************/ |
33 | 35 |
34 char * | 36 char * |
56 | 58 |
57 g_return_val_if_fail(slplink != NULL, NULL); | 59 g_return_val_if_fail(slplink != NULL, NULL); |
58 | 60 |
59 slpcall = g_new0(MsnSlpCall, 1); | 61 slpcall = g_new0(MsnSlpCall, 1); |
60 | 62 |
63 #ifdef MSN_DEBUG_SLPCALL | |
64 gaim_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); | |
65 #endif | |
66 | |
61 slpcall->slplink = slplink; | 67 slpcall->slplink = slplink; |
62 | 68 |
63 msn_slplink_add_slpcall(slplink, slpcall); | 69 msn_slplink_add_slpcall(slplink, slpcall); |
64 | 70 |
65 slpcall->timer = gaim_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); | 71 slpcall->timer = gaim_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); |
69 | 75 |
70 void | 76 void |
71 msn_slp_call_destroy(MsnSlpCall *slpcall) | 77 msn_slp_call_destroy(MsnSlpCall *slpcall) |
72 { | 78 { |
73 GList *e; | 79 GList *e; |
80 | |
81 #ifdef MSN_DEBUG_SLPCALL | |
82 gaim_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); | |
83 #endif | |
74 | 84 |
75 g_return_if_fail(slpcall != NULL); | 85 g_return_if_fail(slpcall != NULL); |
76 | 86 |
77 if (slpcall->timer) | 87 if (slpcall->timer) |
78 gaim_timeout_remove(slpcall->timer); | 88 gaim_timeout_remove(slpcall->timer); |
84 g_free(slpcall->branch); | 94 g_free(slpcall->branch); |
85 | 95 |
86 if (slpcall->data_info != NULL) | 96 if (slpcall->data_info != NULL) |
87 g_free(slpcall->data_info); | 97 g_free(slpcall->data_info); |
88 | 98 |
89 msn_slplink_remove_slpcall(slpcall->slplink, slpcall); | |
90 | |
91 for (e = slpcall->slplink->slp_msgs; e != NULL; ) | 99 for (e = slpcall->slplink->slp_msgs; e != NULL; ) |
92 { | 100 { |
93 MsnSlpMessage *slpmsg = e->data; | 101 MsnSlpMessage *slpmsg = e->data; |
94 e = e->next; | 102 e = e->next; |
95 | 103 |
96 g_return_if_fail(slpmsg != NULL); | 104 #ifdef MSN_DEBUG_SLPCALL_VERBOSE |
97 | 105 gaim_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", |
98 #if 0 | |
99 gaim_debug_info("msn", "slpcall destroy: trying slp_msg (%p)\n", | |
100 slpmsg); | 106 slpmsg); |
101 #endif | 107 #endif |
102 | 108 |
103 if (slpmsg->slpcall == slpcall) | 109 if (slpmsg->slpcall == slpcall) |
104 { | 110 { |
105 msn_slpmsg_destroy(slpmsg); | 111 msn_slpmsg_destroy(slpmsg); |
106 } | 112 } |
107 } | 113 } |
114 | |
115 msn_slplink_remove_slpcall(slpcall->slplink, slpcall); | |
108 | 116 |
109 if (slpcall->end_cb != NULL) | 117 if (slpcall->end_cb != NULL) |
110 slpcall->end_cb(slpcall); | 118 slpcall->end_cb(slpcall); |
111 | 119 |
112 g_free(slpcall); | 120 g_free(slpcall); |
162 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", | 170 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", |
163 slplink->remote_user); | 171 slplink->remote_user); |
164 | 172 |
165 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, | 173 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, |
166 "application/x-msnmsgr-sessionreqbody", content); | 174 "application/x-msnmsgr-sessionreqbody", content); |
175 | |
167 #ifdef MSN_DEBUG_SLP | 176 #ifdef MSN_DEBUG_SLP |
168 slpmsg->info = "SLP INVITE"; | 177 slpmsg->info = "SLP INVITE"; |
169 slpmsg->text_body = TRUE; | 178 slpmsg->text_body = TRUE; |
170 #endif | 179 #endif |
171 | 180 |
191 { | 200 { |
192 MsnSlpCall *slpcall; | 201 MsnSlpCall *slpcall; |
193 | 202 |
194 slpcall = data; | 203 slpcall = data; |
195 | 204 |
196 gaim_debug_info("msn", "slpcall timeout (%p)\n", slpcall); | 205 #ifdef MSN_DEBUG_SLPCALL |
206 gaim_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); | |
207 #endif | |
197 | 208 |
198 if (!slpcall->pending && !slpcall->progress) | 209 if (!slpcall->pending && !slpcall->progress) |
199 { | 210 { |
200 msn_slp_call_destroy(slpcall); | 211 msn_slp_call_destroy(slpcall); |
201 return FALSE; | 212 return FALSE; |
230 if (slpcall->timer) | 241 if (slpcall->timer) |
231 gaim_timeout_remove(slpcall->timer); | 242 gaim_timeout_remove(slpcall->timer); |
232 | 243 |
233 slpcall->cb(slpcall, body, body_len); | 244 slpcall->cb(slpcall, body, body_len); |
234 | 245 |
235 /* TODO: Shall we send a BYE? I don't think so*/ | |
236 #if 0 | |
237 send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); | |
238 msn_slplink_unleash(slpcall->slplink); | |
239 #endif | |
240 | |
241 slpcall->wasted = TRUE; | 246 slpcall->wasted = TRUE; |
242 } | 247 } |
243 } | 248 } |
244 #if 0 | 249 #if 0 |
245 else if (slpmsg->flags == 0x100) | 250 else if (slpmsg->flags == 0x100) |