comparison src/protocols/oscar/oscar.c @ 8708:f71c0a3fcb3d

[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 <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 18 Apr 2004 21:58:16 +0000
parents ddcafeb14e35
children 7024b595b6ae
comparison
equal deleted inserted replaced
8707:4c7bc4b0f190 8708:f71c0a3fcb3d
2448 } 2448 }
2449 2449
2450 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { 2450 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
2451 GaimConnection *gc = sess->aux_data; 2451 GaimConnection *gc = sess->aux_data;
2452 OscarData *od = gc->proto_data; 2452 OscarData *od = gc->proto_data;
2453 GaimAccount *account = gaim_connection_get_account(gc);
2453 gchar *tmp; 2454 gchar *tmp;
2454 GaimConvImFlags flags = 0; 2455 GaimConvImFlags flags = 0;
2455 gsize convlen; 2456 gsize convlen;
2456 GError *err = NULL; 2457 GError *err = NULL;
2457 struct buddyinfo *bi; 2458 struct buddyinfo *bi;
2458 const char *iconfile; 2459 const char *iconfile;
2459 2460
2460 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); 2461 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn));
2461 if (!bi) { 2462 if (!bi) {
2462 bi = g_new0(struct buddyinfo, 1); 2463 bi = g_new0(struct buddyinfo, 1);
2463 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); 2464 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi);
2464 } 2465 }
2465 2466
2466 if (args->icbmflags & AIM_IMFLAGS_AWAY) 2467 if (args->icbmflags & AIM_IMFLAGS_AWAY)
2467 flags |= GAIM_CONV_IM_AUTO_RESP; 2468 flags |= GAIM_CONV_IM_AUTO_RESP;
2468 2469
2480 bi->ico_csum = args->iconsum; 2481 bi->ico_csum = args->iconsum;
2481 bi->ico_time = args->iconstamp; 2482 bi->ico_time = args->iconstamp;
2482 } 2483 }
2483 } 2484 }
2484 2485
2485 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && 2486 if ((iconfile = gaim_account_get_buddy_icon(account)) &&
2486 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { 2487 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) {
2487 FILE *file; 2488 FILE *file;
2488 struct stat st; 2489 struct stat st;
2489 2490
2490 if (!stat(iconfile, &st)) { 2491 if (!stat(iconfile, &st)) {
2555 g_error_free(err); 2556 g_error_free(err);
2556 } 2557 }
2557 } 2558 }
2558 2559
2559 /* 2560 /*
2560 * If the message came from an ICQ user then escape any HTML, because 2561 * If the message is being sent to an ICQ user then escape any HTML,
2561 * HTML should not be sent over ICQ as a means to format a message. 2562 * because HTML should not be sent over ICQ as a means to format a message.
2562 * SIM is the only client we know of that sends HTML, everything else 2563 * SIM is the only client we know of that sends HTML, everything else
2563 * (ie. official clients) use RTF. Please let us know if this is 2564 * (ie. official clients) use RTF. Please let us know if this is
2564 * incorrect. 2565 * incorrect.
2565 */ 2566 */
2566 if (isdigit(userinfo->sn[0])) { 2567 if (isdigit(gaim_account_get_username(account)[0])) {
2567 gchar *tmp2 = gaim_escape_html(tmp); 2568 gchar *tmp2 = gaim_escape_html(tmp);
2568 g_free(tmp); 2569 g_free(tmp);
2569 tmp = tmp2; 2570 tmp = tmp2;
2570 } 2571 }
2571 2572
2720 "Images. Because your IP address will be " 2721 "Images. Because your IP address will be "
2721 "revealed, this may be considered a privacy " 2722 "revealed, this may be considered a privacy "
2722 "risk."), 0, d, 2, 2723 "risk."), 0, d, 2,
2723 _("Connect"), G_CALLBACK(accept_direct_im), 2724 _("Connect"), G_CALLBACK(accept_direct_im),
2724 _("Cancel"), G_CALLBACK(cancel_direct_im)); 2725 _("Cancel"), G_CALLBACK(cancel_direct_im));
2726 } else if (args->reqclass & AIM_CAPS_ICQSERVERRELAY) {
2727 gaim_debug_error("oscar", "Got an ICQ Server Relay message of type %d\n", args->info.rtfmsg.msgtype);
2725 } else { 2728 } else {
2726 gaim_debug_error("oscar", 2729 gaim_debug_error("oscar",
2727 "Unknown reqclass %hu\n", args->reqclass); 2730 "Unknown reqclass %hu\n", args->reqclass);
2728 } 2731 }
2729 2732