# HG changeset patch # User Mark Doliner # Date 1270980122 0 # Node ID 9f298b02e0d831a37b00466b0bb33dc05c106550 # Parent 708c35476cff56564896412f90e036dc608b846f There's no reason to call into oscar.c anymore, so move this icon stuff directly into family_oservice.c 2 files changed, 38 insertions(+), 71 deletions(-) But more importantly, this is simpler and oscar.c is smaller. diff -r 708c35476cff -r 9f298b02e0d8 libpurple/protocols/oscar/family_oservice.c --- a/libpurple/protocols/oscar/family_oservice.c Sun Apr 11 05:15:29 2010 +0000 +++ b/libpurple/protocols/oscar/family_oservice.c Sun Apr 11 10:02:02 2010 +0000 @@ -1094,8 +1094,6 @@ static int aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { - int ret = 0; - aim_rxcallback_t userfunc; guint16 type; guint8 flags, length; @@ -1108,25 +1106,54 @@ * A flag of 0x40 could mean "I don't have your icon, upload it" */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - switch (type) { + switch (type) { case 0x0000: case 0x0001: { /* buddy icon checksum */ /* not sure what the difference between 1 and 0 is */ guint8 *md5 = byte_stream_getraw(bs, length); - ret = userfunc(od, conn, frame, type, flags, length, md5); + + if ((flags == 0x00) || (flags == 0x41)) { + if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { + od->iconconnecting = TRUE; + od->set_icon = TRUE; + aim_srv_requestnew(od, SNAC_FAMILY_BART); + } else { + PurpleAccount *account = purple_connection_get_account(od->gc); + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); + if (img == NULL) { + aim_ssi_delicon(od); + } else { + + purple_debug_info("oscar", + "Uploading icon to icon server\n"); + aim_bart_upload(od, purple_imgstore_get_data(img), + purple_imgstore_get_size(img)); + purple_imgstore_unref(img); + } + } + } else if (flags == 0x81) { + PurpleAccount *account = purple_connection_get_account(od->gc); + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); + if (img == NULL) + aim_ssi_delicon(od); + else { + aim_ssi_seticon(od, md5, length); + purple_imgstore_unref(img); + } + } + g_free(md5); - } break; - case 0x0002: { /* available message */ + } break; + + case 0x0002: { + /* We just set an available message? */ /* there is a second length that is just for the message */ char *msg = byte_stream_getstr(bs, byte_stream_get16(bs)); - ret = userfunc(od, conn, frame, type, msg); g_free(msg); - } break; - } + } break; } - return ret; + return 0; } static int diff -r 708c35476cff -r 9f298b02e0d8 libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Sun Apr 11 05:15:29 2010 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Apr 11 10:02:02 2010 +0000 @@ -202,7 +202,6 @@ static int purple_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_icon_parseicon (OscarData *, FlapConnection *, FlapFrame *, ...); -static int oscar_icon_req (OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_parse_msgack (OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...); @@ -1562,7 +1561,6 @@ oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, purple_parse_genericerr, 0); oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, purple_selfinfo, 0); oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, purple_memrequest, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0); oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, purple_handle_redirect, 0); oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, purple_parse_motd, 0); oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, purple_parse_evilnotify, 0); @@ -6243,64 +6241,6 @@ return ret; } - -static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 type; - guint8 flags = 0, length = 0; - guchar *md5 = NULL; - - va_start(ap, fr); - type = va_arg(ap, int); - - switch(type) { - case 0x0000: - case 0x0001: { - flags = va_arg(ap, int); - length = va_arg(ap, int); - md5 = va_arg(ap, guchar *); - - if ((flags == 0x00) || (flags == 0x41)) { - if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { - od->iconconnecting = TRUE; - od->set_icon = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_BART); - } else { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) { - aim_ssi_delicon(od); - } else { - - purple_debug_info("oscar", - "Uploading icon to icon server\n"); - aim_bart_upload(od, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_imgstore_unref(img); - } - } - } else if (flags == 0x81) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) - aim_ssi_delicon(od); - else { - aim_ssi_seticon(od, md5, length); - purple_imgstore_unref(img); - } - } - } break; - - case 0x0002: { /* We just set an "available" message? */ - } break; - } - - va_end(ap); - - return 0; -} - void oscar_set_permit_deny(PurpleConnection *gc) { PurpleAccount *account = purple_connection_get_account(gc); OscarData *od = purple_connection_get_protocol_data(gc);