Mercurial > pidgin
comparison libpurple/protocols/msn/slpcall.c @ 27292:a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Based on patch from notak and galt, but using imgstore instead of a custom
smiley (like AIM DirectIM), and with better error checking.
References #393.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 06 Jul 2009 04:37:06 +0000 |
parents | 14b927f45ec5 |
children | 35b6fd563056 |
comparison
equal
deleted
inserted
replaced
27291:3a0552df3379 | 27292:a6d84d9de605 |
---|---|
208 | 208 |
209 if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) | 209 if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) |
210 { | 210 { |
211 char *body_str; | 211 char *body_str; |
212 | 212 |
213 body_str = g_strndup((const char *)body, body_len); | 213 if (slpmsg->session_id == 64) |
214 slpcall = msn_slp_sip_recv(slplink, body_str); | 214 { |
215 /* This is for handwritten messages (Ink) */ | |
216 GError *error; | |
217 glong items_read, items_written; | |
218 | |
219 body_str = g_utf16_to_utf8((gunichar2 *)body, body_len / 2, | |
220 &items_read, &items_written, &error); | |
221 body_len -= items_read * 2 + 2; | |
222 body += items_read * 2 + 2; | |
223 if (body_str == NULL | |
224 || body_len <= 0 | |
225 || strstr(body_str, "image/gif") == NULL) | |
226 { | |
227 if (error != NULL) | |
228 purple_debug_error("msn", | |
229 "Unable to convert Ink header from UTF-16 to UTF-8: %s\n", | |
230 error->message); | |
231 else | |
232 purple_debug_error("msn", | |
233 "Received Ink in unknown format\n"); | |
234 g_free(body_str); | |
235 return NULL; | |
236 } | |
237 g_free(body_str); | |
238 | |
239 body_str = g_utf16_to_utf8((gunichar2 *)body, body_len / 2, | |
240 &items_read, &items_written, &error); | |
241 if (!body_str) | |
242 { | |
243 purple_debug_error("msn", | |
244 "Unable to convert Ink body from UTF-16 to UTF-8: %s\n", | |
245 error->message); | |
246 return NULL; | |
247 } | |
248 | |
249 msn_switchboard_show_ink(slpmsg->slplink->swboard, | |
250 slplink->remote_user, | |
251 body_str); | |
252 } | |
253 else | |
254 { | |
255 body_str = g_strndup((const char *)body, body_len); | |
256 slpcall = msn_slp_sip_recv(slplink, body_str); | |
257 } | |
215 g_free(body_str); | 258 g_free(body_str); |
216 } | 259 } |
217 else if (slpmsg->flags == 0x20 || | 260 else if (slpmsg->flags == 0x20 || |
218 slpmsg->flags == 0x1000020 || | 261 slpmsg->flags == 0x1000020 || |
219 slpmsg->flags == 0x1000030) | 262 slpmsg->flags == 0x1000030) |