changeset 4243:eae97ca4bbea

[gaim-migrate @ 4493] Guess what? Another SSI patch! This one fixes the automatic deletion of empty groups upon signin. The problem was that apparently WinICQ handles empty groups slightly differently than WinAIM. It's all good now. Uh, I fixed some comments. Oh, and moving a buddy that you've requested authorization from to a different group. I don't know if that used to give you the dialog that prompted if you wanted to send another auth request, but it shouldn't anymore (as long as you have sent 1 auth request). I also changed the button title for ICQ's receive contacts. I changed it from "Deny" to "Decline." Thanks to Nathan for pointing that out. I am to Time Warner as spiders are to the bottom of my shoe. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 08 Jan 2003 04:06:20 +0000
parents cf19d8102b34
children 091e9db94ebc
files src/protocols/oscar/aim.h src/protocols/oscar/oscar.c src/protocols/oscar/ssi.c
diffstat 3 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Wed Jan 08 04:00:29 2003 +0000
+++ b/src/protocols/oscar/aim.h	Wed Jan 08 04:06:20 2003 +0000
@@ -1177,6 +1177,7 @@
 faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list);
 faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list);
 faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn);
+faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn);
 
 /* Client functions for changing SSI data */
 faim_export int aim_ssi_addbuddy(aim_session_t *sess, aim_conn_t *conn, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth);
--- a/src/protocols/oscar/oscar.c	Wed Jan 08 04:00:29 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Jan 08 04:06:20 2003 +0000
@@ -2223,7 +2223,7 @@
 					data->gc = gc;
 					data->name = g_strdup(text[i*2+2]);
 					data->nick = g_strdup(text[i*2+1]);
-					do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Deny"), gaim_free_name_data);
+					do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Decline"), gaim_free_name_data);
 					g_free(message);
 				}
 				g_strfreev(text);
--- a/src/protocols/oscar/ssi.c	Wed Jan 08 04:00:29 2003 +0000
+++ b/src/protocols/oscar/ssi.c	Wed Jan 08 04:06:20 2003 +0000
@@ -91,8 +91,6 @@
 /**
  * Locally add a new item to the given item list.
  *
- * XXX - This should copy data, not just use it.
- *
  * @param list A pointer to a pointer to the current list of items.
  * @param name A null terminated string of the name of the new item, or NULL if the 
  *        item should have no name.
@@ -431,6 +429,26 @@
 }
 
 /**
+ * Locally find if you are waiting for authorization for a buddy.
+ *
+ * @param list A pointer to the current list of items.
+ * @return A pointer to a NULL terminated string that is the buddies 
+ *         alias, or NULL if the buddy has no alias.  You should free
+ *         this returned value!
+ */
+faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn)
+{
+	struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, sn, AIM_SSI_TYPE_BUDDY);
+	if (cur) {
+		aim_tlvlist_t *tlvlist = cur->data;
+		if (tlvlist)
+			if (aim_gettlv(tlvlist, 0x0066, 1))
+				return 1;
+	}
+	return 0;
+}
+
+/**
  * If there are changes, then create temporary items and 
  * call addmoddel.
  *
@@ -634,8 +652,11 @@
 
 	/* Check if there are empty groups */
 	for (cur=sess->ssi.local; cur; cur=cur->next)
-		if ((cur->type == AIM_SSI_TYPE_GROUP) && (!cur->data))
-			aim_ssi_itemlist_del(&sess->ssi.local, cur);
+		if (cur->type == AIM_SSI_TYPE_GROUP) {
+			aim_tlv_t *tlv = aim_gettlv(cur->data, 0x00c8, 1);
+			if (!cur->data || !tlv || !tlv->length)
+				aim_ssi_itemlist_del(&sess->ssi.local, cur);
+		}
 
 	/* Check if the master group is empty */
 	if ((cur = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!cur->data))
@@ -862,7 +883,7 @@
  */
 faim_export int aim_ssi_movebuddy(aim_session_t *sess, aim_conn_t *conn, const char *oldgn, const char *newgn, const char *sn)
 {
-	aim_ssi_addbuddy(sess, conn, sn, newgn, aim_ssi_getalias(sess->ssi.local, oldgn, sn), NULL, NULL, 0);
+	aim_ssi_addbuddy(sess, conn, sn, newgn, aim_ssi_getalias(sess->ssi.local, oldgn, sn), NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn));
 	aim_ssi_delbuddy(sess, conn, sn, oldgn);
 	return 0;
 }
@@ -1022,7 +1043,7 @@
 
 /*
  * Subtype 0x0004 - Request SSI Data.
- * XXX - If you don't a timestamp and revision number?
+ * XXX - If you don't have a timestamp and revision number?
  *
  * Note that the client should never increment the revision, only the server.
  *