# HG changeset patch # User Mark Doliner # Date 1047766740 0 # Node ID e737e3e08b4a901188fafd78a7b89f701b344f43 # Parent 4e617a0719ed20e78dfdc4a1530b5eb5369c9b5c [gaim-migrate @ 5111] Maybe this will do something good? committer: Tailor Script diff -r 4e617a0719ed -r e737e3e08b4a src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sat Mar 15 19:47:54 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sat Mar 15 22:19:00 2003 +0000 @@ -2899,18 +2899,18 @@ } static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { + struct gaim_connection *gc = sess->aux_data; + struct oscar_data *od = gc->proto_data; + char header[BUF_LONG]; + GSList *l = od->evilhack; + gboolean evilhack = FALSE; + gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; + fu32_t flags; + va_list ap; aim_userinfo_t *info; + fu16_t infotype; char *text_enc = NULL, *text = NULL, *utf8 = NULL; int text_len; - fu16_t infotype; - fu32_t flags; - char header[BUF_LONG]; - struct gaim_connection *gc = sess->aux_data; - struct oscar_data *od = gc->proto_data; - GSList *l = od->evilhack; - gboolean evilhack = FALSE; - va_list ap; - gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); @@ -2933,35 +2933,35 @@ utf8 = g_convert(text, text_len, "UTF-8", "UCS-2BE", NULL, NULL, NULL); break; default: - utf8 = g_strdup(_("Unable to display information because it was sent in an unknown encoding.")); + utf8 = g_strdup(_("Unable to display information because it was sent in an unknown encoding.")); debug_printf("Encountered an unknown encoding while parsing userinfo\n"); } } if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { - onlinesince = g_strdup_printf("Online Since : %s
\n", + onlinesince = g_strdup_printf("Online Since : %s
\n", asctime(localtime(&info->onlinesince))); } if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { - membersince = g_strdup_printf("Member Since : %s
\n", + membersince = g_strdup_printf("Member Since : %s
\n", asctime(localtime(&info->membersince))); } if (info->present & AIM_USERINFO_PRESENT_IDLE) { gchar *itime = sec_to_text(info->idletime*60); - idle = g_strdup_printf("Idle : %s", itime); + idle = g_strdup_printf("Idle : %s", itime); g_free(itime); } else - idle = g_strdup("Idle: Active"); + idle = g_strdup("Idle: Active"); g_snprintf(header, sizeof header, - _("Username : %s %s
\n" - "Warning Level : %d %%
\n" + _("Username : %s %s
\n" + "Warning Level : %d %%
\n" "%s" "%s" "%s\n" - "
\n"), + "
\n"), info->sn, images(info->flags), info->warnlevel/10, onlinesince ? onlinesince : "", @@ -2993,7 +2993,7 @@ g_show_info_text(gc, info->sn, 0, header, (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL, - (utf8 && *utf8) ? "
" : NULL, + (utf8 && *utf8) ? "
" : NULL, NULL); } } else if (infotype == AIM_GETINFO_CAPABILITIES) { diff -r 4e617a0719ed -r e737e3e08b4a src/protocols/oscar/ssi.c --- a/src/protocols/oscar/ssi.c Sat Mar 15 19:47:54 2003 +0000 +++ b/src/protocols/oscar/ssi.c Sat Mar 15 22:19:00 2003 +0000 @@ -1427,10 +1427,10 @@ if (cur->item) { if (cur->ack) { /* Our action was unsuccessful, so change the local list back to how it was */ - /* Make sure cur->item is still valid memory */ if (cur->action == AIM_CB_SSI_ADD) { + /* Remove the item from the local list */ + /* Make sure cur->item is still valid memory */ if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { - /* Remove the item from the local list */ if (cur->item->name) { cur->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); strcpy(cur->name, cur->item->name); @@ -1458,7 +1458,7 @@ } else if (cur->action == AIM_CB_SSI_DEL) { /* Add the item back into the local list */ - if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { + if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) { aim_ssi_itemlist_add(&sess->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); } else cur->item = NULL; @@ -1467,26 +1467,33 @@ } else { /* Do the exact opposite */ if (cur->action == AIM_CB_SSI_ADD) { - /* Add the local item to the official list */ - aim_ssi_itemlist_add(&sess->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); + /* Add the local item to the official list */ + if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { + aim_ssi_itemlist_add(&sess->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); + } else + cur->item = NULL; } else if (cur->action == AIM_CB_SSI_MOD) { /* Replace the official item with the item from the local list */ - struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(sess->ssi.official, cur->item->gid, cur->item->bid))) { - free(cur1->name); - if (cur->item->name) { - cur1->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); - strcpy(cur1->name, cur->item->name); - } else - cur1->name = NULL; - aim_freetlvchain(&cur1->data); - cur1->data = aim_tlvlist_copy(cur->item->data); - } + if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { + struct aim_ssi_item *cur1; + if ((cur1 = aim_ssi_itemlist_find(sess->ssi.official, cur->item->gid, cur->item->bid))) { + free(cur1->name); + if (cur->item->name) { + cur1->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); + strcpy(cur1->name, cur->item->name); + } else + cur1->name = NULL; + aim_freetlvchain(&cur1->data); + cur1->data = aim_tlvlist_copy(cur->item->data); + } + } else + cur->item = NULL; } else if (cur->action == AIM_CB_SSI_DEL) { /* Remove the item from the official list */ - aim_ssi_itemlist_del(&sess->ssi.official, cur->item); + if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) + aim_ssi_itemlist_del(&sess->ssi.official, cur->item); cur->item = NULL; }