changeset 3068:1b64206cfbdc

[gaim-migrate @ 3082] Added SSI to ICQ again. Not positive if it works, though. Let me know if it doesn't. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 17 Mar 2002 04:24:52 +0000
parents b695cbbeee2d
children cbb8b9b4ca4a
files ChangeLog src/protocols/oscar/auth.c src/protocols/oscar/oscar.c
diffstat 3 files changed, 46 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 17 01:22:35 2002 +0000
+++ b/ChangeLog	Sun Mar 17 04:24:52 2002 +0000
@@ -6,6 +6,7 @@
 	* Various sound cleanups (Thanks Robert McQueen)
 	* Login process shown in single window (Thanks Michael 
 	  Golden)
+	* Server side buddy lists for ICQ again  
 	
 version 0.54 (03/14/2002):
 	* Compiles without GdkPixbuf again
--- a/src/protocols/oscar/auth.c	Sun Mar 17 01:22:35 2002 +0000
+++ b/src/protocols/oscar/auth.c	Sun Mar 17 04:24:52 2002 +0000
@@ -304,8 +304,8 @@
 	 * If set, old-fashioned buddy lists will not work. You will need
 	 * to use SSI.
 	 */
-	if (0)
-		aim_addtlvtochain8(&tl, 0x004a, 0x01);
+	
+	aim_addtlvtochain8(&tl, 0x004a, 0x01);
 
 	aim_writetlvchain(&fr->data, &tl);
 
--- a/src/protocols/oscar/oscar.c	Sun Mar 17 01:22:35 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Mar 17 04:24:52 2002 +0000
@@ -2239,8 +2239,7 @@
 
 	aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
 
-	if (!odata->icq)
-		aim_ssi_reqrights(sess, fr->conn);
+       	aim_ssi_reqrights(sess, fr->conn);
 
 	return 1;
 }
@@ -2662,96 +2661,74 @@
 
 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (odata->icq) {
-		aim_add_buddy(odata->sess, odata->conn, name);
-	} else {
-		if ((odata->sess->ssi.received_data) && !(aim_ssi_inlist(odata->sess, odata->conn, name, 0x0000))) {
+	if ((odata->sess->ssi.received_data) && !(aim_ssi_inlist(odata->sess, odata->conn, name, 0x0000))) {
 			debug_printf("ssi: adding buddy %s to group %s\n", name, find_group_by_buddy(g, name)->name);
 			aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1);
-		}
 	}
+	
 }
 
 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (odata->icq) {
-		char buf[MSG_LEN];
-		int n=0;
-		while (buddies) {
-			if (n > MSG_LEN - 18) {
-				aim_bos_setbuddylist(odata->sess, odata->conn, buf);
-				n = 0;
-			}
-			n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data);
-			buddies = buddies->next;
-		}
-		aim_bos_setbuddylist(odata->sess, odata->conn, buf);
-	} else {
-		if (odata->sess->ssi.received_data) {
-			int tmp;
-			GSList *curgrp, *curbud;
-			for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) {
+	if (odata->sess->ssi.received_data) {
+		int tmp;
+		GSList *curgrp, *curbud;
+		for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) {
+			tmp = 0;
+			for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
+				if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)curbud->data)->name, 0x0000))
+					tmp++;
+			if (tmp) {
+				char **sns = (char **)malloc(tmp*sizeof(char*));
 				tmp = 0;
 				for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
-					if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)curbud->data)->name, 0x0000))
+					if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)curbud->data)->name, 0x0000)) {
+						debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name);
+						sns[tmp] = (char *)((struct buddy*)curbud->data)->name;
 						tmp++;
-				if (tmp) {
-					char **sns = (char **)malloc(tmp*sizeof(char*));
-					tmp = 0;
-					for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next)
-						if (!aim_ssi_inlist(odata->sess, odata->conn, ((struct buddy*)curbud->data)->name, 0x0000)) {
-							debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name);
-							sns[tmp] = (char *)((struct buddy*)curbud->data)->name;
-							tmp++;
-						}
-					aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, sns, tmp);
-					free(sns);
+					}
+				aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, sns, tmp);
+				free(sns);
 				}
-			}
 		}
+		
 	}
 }
 
 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (odata->icq) {
-		aim_remove_buddy(odata->sess, odata->conn, name);
-	} else {
-		if (odata->sess->ssi.received_data) {
-			char *ssigroup;
-			while (aim_ssi_inlist(odata->sess, odata->conn, name, 0x0000) && (ssigroup = aim_ssi_getparentgroup(odata->sess, odata->conn, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup, &name, 1))
-				debug_printf("ssi: deleted buddy %s from group %s\n", name, group);
-		}
+
+	if (odata->sess->ssi.received_data) {
+		char *ssigroup;
+		while (aim_ssi_inlist(odata->sess, odata->conn, name, 0x0000) && (ssigroup = aim_ssi_getparentgroup(odata->sess, odata->conn, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup, &name, 1))
+			debug_printf("ssi: deleted buddy %s from group %s\n", name, group);
 	}
 }
 
+
 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, char *group) {
 	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (odata->icq) {
+	
+	if (odata->sess->ssi.received_data) {
 		GList *cur;
+		int tmp = 0;
 		for (cur=buddies; cur; cur=cur->next)
-			aim_remove_buddy(odata->sess, odata->conn, cur->data);
-	} else {
-		if (odata->sess->ssi.received_data) {
-			GList *cur;
-			int tmp = 0;
+			if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000))
+				tmp++;
+		if (tmp) {
+			char **sns;
+			sns = (char **)malloc(tmp*sizeof(char*));
+			tmp = 0;
 			for (cur=buddies; cur; cur=cur->next)
-				if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000))
+				if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000)) {
+					debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group);
+					sns[tmp] = cur->data;
 					tmp++;
-			if (tmp) {
-				char **sns;
-				sns = (char **)malloc(tmp*sizeof(char*));
-				tmp = 0;
-				for (cur=buddies; cur; cur=cur->next)
-					if (aim_ssi_inlist(odata->sess, odata->conn, cur->data, 0x0000)) {
-						debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group);
-						sns[tmp] = cur->data;
-						tmp++;
-					}
-				aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp);
-				free(sns);
-			}
+				}
+			aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp);
+			free(sns);
 		}
+		
 	}
 }
 
@@ -2785,13 +2762,6 @@
 
 	debug_printf("ssi: syncing local list and server list\n");
 
-	if (odata->icq) {
-		/* Delete the buddy list */
-		debug_printf("ssi: using ICQ, removing ssi data\n");
-		aim_ssi_deletelist(sess, fr->conn);
-		return 1;
-	}
-
 	/* Activate SSI */
 	debug_printf("ssi: activating server-stored buddy list\n");
 	aim_ssi_enable(sess, fr->conn);
@@ -2929,7 +2899,7 @@
 			}
 		}
 	}
-
+	
 	return 1;
 }