changeset 16278:70a368273778

Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were trying to add something to our server-stored buddy list, but there was no "master container" to add the item to. For normal buddies the oscar code added the master container if needed, but that wasn't happening for things like the buddy icon item, or the permit/deny item. So if you had an empty buddylist and you attempted to set an icon for your icq account, or you changed your privacy setting, or you went invisible or not invisible then you'd see the error.
author Mark Doliner <mark@kingant.net>
date Fri, 20 Apr 2007 06:51:33 +0000
parents d7e385be0346
children 234b645ada99
files libpurple/protocols/oscar/family_feedbag.c
diffstat 1 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_feedbag.c	Fri Apr 20 06:34:10 2007 +0000
+++ b/libpurple/protocols/oscar/family_feedbag.c	Fri Apr 20 06:51:33 2007 +0000
@@ -119,9 +119,6 @@
 	int i;
 	struct aim_ssi_item *cur, *new;
 
-	if (!list)
-		return NULL;
-
 	new = (struct aim_ssi_item *)malloc(sizeof(struct aim_ssi_item));
 
 	/* Set the name */
@@ -767,8 +764,8 @@
 	if (!(parent = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) {
 		/* Find the parent's parent (the master group) */
 		if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
-			if (aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL) == NULL)
-				return -ENOMEM;
+			aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 		/* Add the parent */
 		if (!(parent = aim_ssi_itemlist_add(&od->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL)))
 			return -ENOMEM;
@@ -813,6 +810,10 @@
 	if (!od || !name)
 		return -EINVAL;
 
+	/* Make sure the master group exists */
+	if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
+		aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 	/* Add that bad boy */
 	aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_PERMIT, NULL);
 
@@ -835,6 +836,10 @@
 	if (!od || !name)
 		return -EINVAL;
 
+	/* Make sure the master group exists */
+	if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
+		aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 	/* Add that bad boy */
 	aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_DENY, NULL);
 
@@ -1081,6 +1086,10 @@
 	if (!od)
 		return -EINVAL;
 
+	/* Make sure the master group exists */
+	if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
+		aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 	/* Find the PDINFO item, or add it if it does not exist */
 	if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO)))
 		tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL);
@@ -1113,6 +1122,10 @@
 	if (!od || !iconsum || !iconsumlen)
 		return -EINVAL;
 
+	/* Make sure the master group exists */
+	if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
+		aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 	/* Find the ICONINFO item, or add it if it does not exist */
 	if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) {
 		tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL);
@@ -1166,6 +1179,10 @@
 	if (!od)
 		return -EINVAL;
 
+	/* Make sure the master group exists */
+	if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL)
+		aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL);
+
 	/* Find the PRESENCEPREFS item, or add it if it does not exist */
 	if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS)))
 		tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL);