changeset 2526:413a81136e3a

[gaim-migrate @ 2539] hi committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 17 Oct 2001 20:24:11 +0000
parents 4fc6aac9da94
children c9e316b04048
files src/core.h src/list.c src/protocols/toc/toc.c
diffstat 3 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.h	Wed Oct 17 17:43:17 2001 +0000
+++ b/src/core.h	Wed Oct 17 20:24:11 2001 +0000
@@ -149,7 +149,7 @@
 extern void do_import(struct gaim_connection *, char *);
 extern int bud_list_cache_exists(struct gaim_connection *);
 extern void toc_build_config(struct gaim_connection *, char *, int len, gboolean);
-extern void parse_toc_buddy_list(struct gaim_connection *, char *, int);
+extern void parse_toc_buddy_list(struct gaim_connection *, char *);
 
 /* Functions in core.c */
 extern gint UI_write(struct UI *, guchar *, int);
--- a/src/list.c	Wed Oct 17 17:43:17 2001 +0000
+++ b/src/list.c	Wed Oct 17 20:24:11 2001 +0000
@@ -331,7 +331,7 @@
 	}
 }
 
-void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import)
+void parse_toc_buddy_list(struct gaim_connection *gc, char *config)
 {
 	char *c;
 	char current[256];
@@ -352,8 +352,10 @@
 				break;
 			if (*c == 'g') {
 				strncpy(current, c + 2, sizeof(current));
-				add_group(gc, current);
-				how_many++;
+				if (!find_group(gc, current)) {
+					add_group(gc, current);
+					how_many++;
+				}
 			} else if (*c == 'b' && !find_buddy(gc, c + 2)) {
 				char nm[80], sw[80], *tmp = c + 2;
 				int i = 0;
@@ -366,11 +368,11 @@
 				while (*tmp)
 					sw[i++] = *tmp++;
 				sw[i] = '\0';
-				if (!find_buddy(gc, nm))
+				if (!find_buddy(gc, nm)) {
 					add_buddy(gc, current, nm, sw);
-				how_many++;
-
-				bud = g_list_append(bud, c + 2);
+					how_many++;
+					bud = g_list_append(bud, c + 2);
+				}
 			} else if (*c == 'p') {
 				GSList *d = gc->permit;
 				char *n;
@@ -383,9 +385,10 @@
 					d = d->next;
 				}
 				g_free(n);
-				if (!d)
+				if (!d) {
 					gc->permit = g_slist_append(gc->permit, name);
-				else
+					how_many++;
+				} else
 					g_free(name);
 			} else if (*c == 'd') {
 				GSList *d = gc->deny;
@@ -399,9 +402,10 @@
 					d = d->next;
 				}
 				g_free(n);
-				if (!d)
+				if (!d) {
 					gc->deny = g_slist_append(gc->deny, name);
-				else
+					how_many++;
+				} else
 					g_free(name);
 			} else if (!strncmp("toc", c, 3)) {
 				sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
@@ -423,14 +427,8 @@
 		serv_set_permit_deny(gc);
 	}
 
-	/* perhaps the server dropped the buddy list, try importing from
-	   cache */
-
-	if (how_many == 0 && !from_do_import) {
-		do_import(gc, NULL);
-	} else if (gc && (bud_list_cache_exists(gc) == FALSE)) {
+	if (how_many != 0)
 		do_export(gc);
-	}
 }
 
 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show)
@@ -727,7 +725,7 @@
 		return;
 	}
 
-	parse_toc_buddy_list(gc, buf, 1);
+	parse_toc_buddy_list(gc, buf);
 
 	fclose(f);
 
--- a/src/protocols/toc/toc.c	Wed Oct 17 17:43:17 2001 +0000
+++ b/src/protocols/toc/toc.c	Wed Oct 17 20:24:11 2001 +0000
@@ -596,7 +596,7 @@
 		}
 	} else if (!strcasecmp(c, "CONFIG")) {
 		c = strtok(NULL, ":");
-		parse_toc_buddy_list(gc, c, 0);
+		parse_toc_buddy_list(gc, c);
 	} else if (!strcasecmp(c, "NICK")) {
 		/* ignore NICK so that things get imported/exported properly
 		c = strtok(NULL, ":");