changeset 4791:e737e3e08b4a

[gaim-migrate @ 5111] Maybe this will do something good? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 15 Mar 2003 22:19:00 +0000
parents 4e617a0719ed
children 9212d1c5b7dc
files src/protocols/oscar/oscar.c src/protocols/oscar/ssi.c
diffstat 2 files changed, 42 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- 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(_("<I>Unable to display information because it was sent in an unknown encoding.</I>"));
+			utf8 = g_strdup(_("<i>Unable to display information because it was sent in an unknown encoding.</i>"));
 			debug_printf("Encountered an unknown encoding while parsing userinfo\n");
 		}
 	}
 
 	if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
-		onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n",
+		onlinesince = g_strdup_printf("Online Since : <b>%s</b><br>\n",
 					asctime(localtime(&info->onlinesince)));
 	}
 
 	if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
-		membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
+		membersince = g_strdup_printf("Member Since : <b>%s</b><br>\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 : <B>%s</B>", itime);
+		idle = g_strdup_printf("Idle : <b>%s</b>", itime);
 		g_free(itime);
 	} else
-		idle = g_strdup("Idle: <B>Active</B>");
+		idle = g_strdup("Idle: <b>Active</b>");
 
 	g_snprintf(header, sizeof header,
-			_("Username : <B>%s</B>  %s <BR>\n"
-			"Warning Level : <B>%d %%</B><BR>\n"
+			_("Username : <b>%s</b>  %s <br>\n"
+			"Warning Level : <b>%d %%</b><br>\n"
 			"%s"
 			"%s"
 			"%s\n"
-			"<HR>\n"),
+			"<hr>\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) ? "<HR>" : NULL,
+					 (utf8 && *utf8) ? "<hr>" : NULL,
 					 NULL);
 		}
 	} else if (infotype == AIM_GETINFO_CAPABILITIES) {
--- 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;
 			}