Mercurial > pidgin
comparison libpurple/protocols/oscar/family_icq.c @ 30361:9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
to add an error handler for SNAC_FAMILY_ICQ right inside family_icq.c,
since all the necessary functions are there.
I made a pretty large refactoring along the way, moving the
authorization- and userinfo-related functions to separate files and
renaming some of them. Hopefully, this will make oscar.c less of mess.
author | ivan.komarov@soc.pidgin.im |
---|---|
date | Sun, 30 May 2010 13:53:45 +0000 |
parents | 2f25002c9464 |
children | 879baaf87aa2 |
comparison
equal
deleted
inserted
replaced
30360:2f25002c9464 | 30361:9881f18b95b1 |
---|---|
307 | 307 |
308 g_free(xml); | 308 g_free(xml); |
309 g_free(stripped); | 309 g_free(stripped); |
310 | 310 |
311 return 0; | 311 return 0; |
312 } | |
313 | |
314 static int | |
315 gotalias(OscarData *od, struct aim_icq_info *info) | |
316 { | |
317 PurpleConnection *gc = od->gc; | |
318 PurpleAccount *account = purple_connection_get_account(gc); | |
319 gchar who[16], *utf8; | |
320 PurpleBuddy *b; | |
321 | |
322 if (info->nick[0] && (utf8 = oscar_utf8_try_convert(account, od, info->nick))) { | |
323 if (info->for_auth_request) { | |
324 oscar_auth_recvrequest(gc, g_strdup_printf("%u", info->uin), utf8, info->auth_request_reason); | |
325 } else { | |
326 g_snprintf(who, sizeof(who), "%u", info->uin); | |
327 serv_got_alias(gc, who, utf8); | |
328 if ((b = purple_find_buddy(account, who))) { | |
329 purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8); | |
330 } | |
331 g_free(utf8); | |
332 } | |
333 } | |
334 | |
335 g_free(info->auth_request_reason); | |
336 return 1; | |
312 } | 337 } |
313 | 338 |
314 static void aim_icq_freeinfo(struct aim_icq_info *info) { | 339 static void aim_icq_freeinfo(struct aim_icq_info *info) { |
315 int i; | 340 int i; |
316 | 341 |
376 purple_debug_misc("oscar", "icq response: %d bytes, %u, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); | 401 purple_debug_misc("oscar", "icq response: %d bytes, %u, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); |
377 | 402 |
378 if (cmd == 0x07da) { /* information */ | 403 if (cmd == 0x07da) { /* information */ |
379 guint16 subtype; | 404 guint16 subtype; |
380 struct aim_icq_info *info; | 405 struct aim_icq_info *info; |
381 aim_rxcallback_t userfunc; | |
382 | 406 |
383 subtype = byte_stream_getle16(&qbs); | 407 subtype = byte_stream_getle16(&qbs); |
384 byte_stream_advance(&qbs, 1); /* 0x0a */ | 408 byte_stream_advance(&qbs, 1); /* 0x0a */ |
385 | 409 |
386 /* find other data from the same request */ | 410 /* find other data from the same request */ |
657 | 681 |
658 } /* End switch statement */ | 682 } /* End switch statement */ |
659 | 683 |
660 if (!(snac->flags & 0x0001)) { | 684 if (!(snac->flags & 0x0001)) { |
661 if (subtype != 0x0104) | 685 if (subtype != 0x0104) |
662 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO))) | 686 oscar_user_info_display_icq(od, info); |
663 ret = userfunc(od, conn, frame, info); | |
664 | 687 |
665 if (info->uin && info->nick) | 688 if (info->uin && info->nick) |
666 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS))) | 689 gotalias(od, info); |
667 ret = userfunc(od, conn, frame, info); | |
668 | 690 |
669 if (od->icq_info == info) { | 691 if (od->icq_info == info) { |
670 od->icq_info = info->next; | 692 od->icq_info = info->next; |
671 } else { | 693 } else { |
672 struct aim_icq_info *cur; | 694 struct aim_icq_info *cur; |