# HG changeset patch # User Mark Doliner # Date 1055669337 0 # Node ID da8939ad60b64b2d324554fbdc658200536c6750 # Parent 58ea0597a85633f27e31713a660095e201639113 [gaim-migrate @ 6324] Fixes a spelling mistake. Fixes a rare possible-crash in oscar. Shuffled some code around. I tend to do this a lot. Attemped to fix the buddy icon infi-loop thing. Sean, search for "81" in oscar.c I commented that out. I'm pretty sure it will stop the looping, but do you know why that's there? I don't really understand when the server would send 0x81 as "flags," or what it means. Good night, moon. committer: Tailor Script diff -r 58ea0597a856 -r da8939ad60b6 ChangeLog --- a/ChangeLog Sun Jun 15 09:00:48 2003 +0000 +++ b/ChangeLog Sun Jun 15 09:28:57 2003 +0000 @@ -11,16 +11,17 @@ * Chinses (Simplified) translation updated (Funda Wang) * Chinese (Traditional) translation updated (Ambrose C. Li) * Massive internal core/ui splitting - * New account dialog. + * New account dialog * Preferences moved to ~/.gaim/prefs.xml * Account information moved to ~/.gaim/accounts.xml * Pounces moved to ~/.gaim/pounces.xml - * Added support for the Trepia protocol. - * Added protocol icons to various drop-down boxes. + * Added support for the Trepia protocol + * Added protocol icons to various drop-down boxes * New Send IM buddy icon merged from Ximian Desktop 2 * Fixed "Sort by Status" crash * Fixed the MSN add buddy crash. - * Ability to view iChat "Available" messages + * Ability to view iChat "Available" messages for AIM + * Stores your buddy icon on the server for AIM version 0.64 (05/29/2003): * Buddy list sorting in buddy list preferences. diff -r 58ea0597a856 -r da8939ad60b6 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sun Jun 15 09:00:48 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sun Jun 15 09:28:57 2003 +0000 @@ -3521,9 +3521,11 @@ aim_conn_t *conn; conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); - if (!conn && !od->iconconnecting) { - aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); - od->iconconnecting = TRUE; + if (!conn) { + if (!od->iconconnecting) { + aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); + od->iconconnecting = TRUE; + } return FALSE; } @@ -4715,7 +4717,7 @@ gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); if (reason == 0x0005) { - gaim_notify_error(gc, NULL, _("Unable To Retrive Buddy List"), + gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); } @@ -5442,58 +5444,64 @@ static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; - - char *md5 = NULL; + va_list ap; fu16_t type; - fu8_t length = 0, cached = 0; - va_list ap; + fu8_t flags = 0, length = 0; + char *md5 = NULL; + va_start(ap, fr); type = va_arg(ap, int); - switch (type) { - case 0x0001: - case 0x0000: - cached = va_arg(ap, int); - length = va_arg(ap, int); - md5 = va_arg(ap, char*); - break; - } + +gaim_debug(GAIM_DEBUG_ERROR, "XXX", "got self icon info, type is 0x%04hx, flags is 0x%02hhx\n", type, flags); + switch(type) { + case 0x0000: + case 0x0001: { + flags = va_arg(ap, int); + length = va_arg(ap, int); + md5 = va_arg(ap, char *); + + if (flags == 0x41) { + if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { + od->iconconnecting = TRUE; + od->set_icon = TRUE; + aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); + } else { + const char *iconfile; + if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) { + FILE *file; + struct stat st; + + if (!stat(iconfile, &st)) { + char *buf = g_malloc(st.st_size); + file = fopen(iconfile, "rb"); + if (file) { + fread(buf, 1, st.st_size, file); + gaim_debug(GAIM_DEBUG_INFO, "oscar", + "Uploading icon to icon server\n"); + aim_icon_upload(od->sess, buf, st.st_size); + fclose(file); + } else + gaim_debug(GAIM_DEBUG_ERROR, "oscar", + "Can't open buddy icon file!\n"); + g_free(buf); + } else + gaim_debug(GAIM_DEBUG_ERROR, "oscar", + "Can't stat buddy icon file!\n"); + } + } + } /* else if (flags == 0x81) + aim_ssi_seticon(od->sess, md5, length); */ + } break; + + case 0x0002: { /* We just set an "available" message? */ + } break; + } + va_end(ap); - if (cached == 0x41) { - if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { - od->iconconnecting = TRUE; - od->set_icon = TRUE; - aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); - } else { - const char *iconfile; - if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) { - FILE *file; - struct stat st; - - if (!stat(iconfile, &st)) { - char *buf = g_malloc(st.st_size); - file = fopen(iconfile, "rb"); - if (file) { - fread(buf, 1, st.st_size, file); - gaim_debug(GAIM_DEBUG_INFO, "oscar", - "Uploading icon to icon server\n"); - aim_icon_upload(od->sess, buf, st.st_size); - fclose(file); - } else - gaim_debug(GAIM_DEBUG_ERROR, "oscar", - "Can't open buddy icon file!\n"); - g_free(buf); - } else - gaim_debug(GAIM_DEBUG_ERROR, "oscar", - "Can't stat buddy icon file!\n"); - } - } - } else if (cached == 0x81) - aim_ssi_seticon(od->sess, md5, length); return 0; } - - + /* * We have just established a socket with the other dude, so set up some handlers. */ diff -r 58ea0597a856 -r da8939ad60b6 src/protocols/oscar/service.c --- a/src/protocols/oscar/service.c Sun Jun 15 09:00:48 2003 +0000 +++ b/src/protocols/oscar/service.c Sun Jun 15 09:28:57 2003 +0000 @@ -945,35 +945,35 @@ /* * Subtype 0x0021 - Receive our extended status * - * This is used for MAC non-away "away" messages, and maybe ICQ extended status messages? - * It's also used to tell the client whether or not it needs to upload an SSI buddy icon... who engineers this stuff, anyway? + * This is used for iChat's "available" messages, and maybe ICQ extended + * status messages? It's also used to tell the client whether or not it + * needs to upload an SSI buddy icon... who engineers this stuff, anyway? */ static int aim_parse_extstatus(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { - int ret = 0, i; + int ret = 0; aim_rxcallback_t userfunc; - char *msg = NULL, *md5 = NULL; fu16_t type; - fu8_t number, length, cached; + fu8_t flags, length; type = aimbs_get16(bs); + flags = aimbs_get8(bs); + length = aimbs_get8(bs); + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { switch (type) { - case 0x0001: - case 0x0000: /* not sure what the difference between 1 and 0 is */ - cached = aimbs_get8(bs); - length = aimbs_get8(bs); - md5 = aimbs_getraw(bs, length); - ret = userfunc(sess, rx, type, cached, length, md5); + case 0x0000: + case 0x0001: { /* not sure what the difference between 1 and 0 is */ + fu8_t *md5 = aimbs_getraw(bs, length); + ret = userfunc(sess, rx, type, flags, length, md5); free(md5); - break; - case 0x0002: - number = aimbs_get8(bs); /* 0x04 */ - length = aimbs_get8(bs); /* the first length */ - msg = aimbs_getstr(bs, aimbs_get16(bs)); /* the second length is just for the message */ + } break; + case 0x0002: { + /* there is a second length that is just for the message */ + char *msg = aimbs_getstr(bs, aimbs_get16(bs)); ret = userfunc(sess, rx, msg); free(msg); - break; + } break; } } return ret; diff -r 58ea0597a856 -r da8939ad60b6 src/protocols/oscar/ssi.c --- a/src/protocols/oscar/ssi.c Sun Jun 15 09:00:48 2003 +0000 +++ b/src/protocols/oscar/ssi.c Sun Jun 15 09:28:57 2003 +0000 @@ -1040,15 +1040,13 @@ csumdata[0] = 0x00; csumdata[1] = 0x10; memcpy(&csumdata[2], iconsum, iconsumlen); - - + /* Need to add the x00d5 TLV to the TLV chain */ aim_addtlvtochain_raw(&data, 0x00d5, (iconsumlen+2) * sizeof(fu8_t), csumdata); /* This TLV is added to cache the icon. */ aim_addtlvtochain_noval(&data, 0x0131); - if ((tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "0", AIM_SSI_TYPE_ICONINFO))) { aim_freetlvchain(&tmp->data); tmp->data = data;