# HG changeset patch # User Mark Doliner # Date 1082325496 0 # Node ID f71c0a3fcb3d18b247f37916d6af72445313402d # Parent 4c7bc4b0f1903e45cfa59f8ebed262e3502170b4 [gaim-migrate @ 9461] Make receiving an oscar message from ICQ Lite Beta 4.0 to a Gaim AIM account parse HTML rather than display it as-is. Also fiddled around with some comments. committer: Tailor Script diff -r 4c7bc4b0f190 -r f71c0a3fcb3d src/protocols/oscar/aim.h --- a/src/protocols/oscar/aim.h Sun Apr 18 20:59:47 2004 +0000 +++ b/src/protocols/oscar/aim.h Sun Apr 18 21:58:16 2004 +0000 @@ -830,6 +830,7 @@ struct aim_chat_roominfo roominfo; } chat; struct { + fu16_t msgtype; fu32_t fgcolor; fu32_t bgcolor; const char *rtfmsg; diff -r 4c7bc4b0f190 -r f71c0a3fcb3d src/protocols/oscar/im.c --- a/src/protocols/oscar/im.c Sun Apr 18 20:59:47 2004 +0000 +++ b/src/protocols/oscar/im.c Sun Apr 18 21:58:16 2004 +0000 @@ -1649,7 +1649,6 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { fu16_t hdrlen, anslen, msglen; - fu16_t msgtype; hdrlen = aimbs_getle16(servdata); aim_bstream_advance(servdata, hdrlen); @@ -1657,8 +1656,8 @@ hdrlen = aimbs_getle16(servdata); aim_bstream_advance(servdata, hdrlen); - msgtype = aimbs_getle16(servdata); - + args->info.rtfmsg.msgtype = aimbs_getle16(servdata); + anslen = aimbs_getle32(servdata); aim_bstream_advance(servdata, anslen); @@ -1671,9 +1670,6 @@ hdrlen = aimbs_getle32(servdata); aim_bstream_advance(servdata, hdrlen); - /* XXX - This is such a hack. */ - args->reqclass = AIM_CAPS_ICQRTF; - args->destructor = (void *)incomingim_ch2_icqserverrelay_free; return; @@ -1824,9 +1820,10 @@ args.port = aim_tlv_get16(list2, 0x0005, 1); /* - * Something to do with ft -- two bytes + * Something to do with ft? -- two bytes * 0x0001 - "I want to send you this file" * 0x0002 - "I will accept this file from you" + * 0x0002 - Also used in ICQ Lite Beta 4.0 URLs */ if (aim_tlv_gettlv(list2, 0x000a, 1)) ; @@ -1859,6 +1856,7 @@ * Unknown -- no value * * Maybe means we should connect directly to transfer the file? + * Also used in ICQ Lite Beta 4.0 URLs. Also empty. */ if (aim_tlv_gettlv(list2, 0x000f, 1)) ; @@ -1880,7 +1878,8 @@ /* * This must be present in PROPOSALs, but will probably not - * exist in CANCELs and ACCEPTs. + * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite + * Beta 4.0 URLs (AIM_CAPS_ICQSERVERRELAY). * * Service Data blocks are module-specific in format. */ diff -r 4c7bc4b0f190 -r f71c0a3fcb3d src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sun Apr 18 20:59:47 2004 +0000 +++ b/src/protocols/oscar/oscar.c Sun Apr 18 21:58:16 2004 +0000 @@ -2450,6 +2450,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { GaimConnection *gc = sess->aux_data; OscarData *od = gc->proto_data; + GaimAccount *account = gaim_connection_get_account(gc); gchar *tmp; GaimConvImFlags flags = 0; gsize convlen; @@ -2457,10 +2458,10 @@ struct buddyinfo *bi; const char *iconfile; - bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); + bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); if (!bi) { bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); + g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi); } if (args->icbmflags & AIM_IMFLAGS_AWAY) @@ -2482,7 +2483,7 @@ } } - if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && + if ((iconfile = gaim_account_get_buddy_icon(account)) && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { FILE *file; struct stat st; @@ -2557,13 +2558,13 @@ } /* - * If the message came from an ICQ user then escape any HTML, because - * HTML should not be sent over ICQ as a means to format a message. + * If the message is being sent to an ICQ user then escape any HTML, + * because HTML should not be sent over ICQ as a means to format a message. * SIM is the only client we know of that sends HTML, everything else * (ie. official clients) use RTF. Please let us know if this is * incorrect. */ - if (isdigit(userinfo->sn[0])) { + if (isdigit(gaim_account_get_username(account)[0])) { gchar *tmp2 = gaim_escape_html(tmp); g_free(tmp); tmp = tmp2; @@ -2722,6 +2723,8 @@ "risk."), 0, d, 2, _("Connect"), G_CALLBACK(accept_direct_im), _("Cancel"), G_CALLBACK(cancel_direct_im)); + } else if (args->reqclass & AIM_CAPS_ICQSERVERRELAY) { + gaim_debug_error("oscar", "Got an ICQ Server Relay message of type %d\n", args->info.rtfmsg.msgtype); } else { gaim_debug_error("oscar", "Unknown reqclass %hu\n", args->reqclass);