changeset 9461:9e647eaaa349

[gaim-migrate @ 10286] i think i just removed the old blist import as per the last commit message committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 06 Jul 2004 18:15:03 +0000
parents eae7e049d639
children dfa5bc2c655b
files src/blist.c
diffstat 1 files changed, 0 insertions(+), 208 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Tue Jul 06 18:06:43 2004 +0000
+++ b/src/blist.c	Tue Jul 06 18:15:03 2004 +0000
@@ -1699,97 +1699,6 @@
 	}
 }
 
-void gaim_blist_parse_toc_buddy_list(GaimAccount *account, char *config)
-{
-	char *c;
-	char current[256];
-	GList *buddies = NULL;
-
-	if (config != NULL) {
-
-		/* skip "CONFIG:" (if it exists) */
-		c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */ , "CONFIG:", strlen("CONFIG:")) ?
-			strtok(config, "\n") :
-			strtok(config + 6 /* sizeof(struct sflap_hdr) */  + strlen("CONFIG:"), "\n");
-		do {
-			if (c == NULL)
-				break;
-			if (*c == 'g') {
-				char *utf8 = NULL;
-				utf8 = gaim_utf8_try_convert(c + 2);
-				if (utf8 == NULL) {
-					g_strlcpy(current, _("Invalid Groupname"), sizeof(current));
-				} else {
-					g_strlcpy(current, utf8, sizeof(current));
-					g_free(utf8);
-				}
-				if (!gaim_find_group(current)) {
-					GaimGroup *g = gaim_group_new(current);
-					gaim_blist_add_group(g,
-							gaim_blist_get_last_sibling(gaimbuddylist->root));
-				}
-			} else if (*c == 'b') { /*&& !gaim_find_buddy(user, c + 2)) {*/
-				char nm[80], sw[388], *a, *utf8 = NULL;
-
-				if ((a = strchr(c + 2, ':')) != NULL) {
-					*a++ = '\0';		/* nul the : */
-				}
-
-				g_strlcpy(nm, c + 2, sizeof(nm));
-				if (a) {
-					utf8 = gaim_utf8_try_convert(a);
-					if (utf8 == NULL) {
-						gaim_debug(GAIM_DEBUG_ERROR, "toc blist",
-								   "Failed to convert alias for "
-								   "'%s' to UTF-8\n", nm);
-					}
-				}
-				if (utf8 == NULL) {
-					sw[0] = '\0';
-				} else {
-					/* This can leave a partial sequence at the end,
-					 * but who cares? */
-					g_strlcpy(sw, utf8, sizeof(sw));
-					g_free(utf8);
-				}
-
-				if (!gaim_find_buddy(account, nm)) {
-					GaimBuddy *b = gaim_buddy_new(account, nm, sw);
-					GaimGroup *g = gaim_find_group(current);
-					gaim_blist_add_buddy(b, NULL, g,
-							gaim_blist_get_last_child((GaimBlistNode*)g));
-					buddies = g_list_append(buddies, b);
-				}
-			} else if (*c == 'p') {
-				gaim_privacy_permit_add(account, c + 2, TRUE);
-			} else if (*c == 'd') {
-				gaim_privacy_deny_add(account, c + 2, TRUE);
-			} else if (!strncmp("toc", c, 3)) {
-				sscanf(c + strlen(c) - 1, "%d", &account->perm_deny);
-				gaim_debug(GAIM_DEBUG_MISC, "toc blist",
-						   "permdeny: %d\n", account->perm_deny);
-				if (account->perm_deny == 0)
-					account->perm_deny = GAIM_PRIVACY_ALLOW_ALL;
-			} else if (*c == 'm') {
-				sscanf(c + 2, "%d", &account->perm_deny);
-				gaim_debug(GAIM_DEBUG_MISC, "toc blist",
-						   "permdeny: %d\n", account->perm_deny);
-				if (account->perm_deny == 0)
-					account->perm_deny = GAIM_PRIVACY_ALLOW_ALL;
-			}
-		} while ((c = strtok(NULL, "\n")));
-
-		if (account->gc) {
-			if (buddies != NULL) {
-				serv_add_buddies(account->gc, buddies);
-				g_list_free(buddies);
-			}
-			serv_set_permit_deny(account->gc);
-		}
-		g_list_free(buddies);
-	}
-}
-
 static gchar *get_screenname_filename(const char *name)
 {
 	gchar **split;
@@ -1807,117 +1716,6 @@
 	return ret;
 }
 
-static void do_import(GaimAccount *account, const char *filename)
-{
-	GString *buf = NULL;
-	char first[64];
-	char path[PATHSIZE];
-	int len;
-	FILE *f;
-	struct stat st;
-
-	if (filename) {
-		g_snprintf(path, sizeof(path), "%s", filename);
-	} else {
-		char *g_screenname = get_screenname_filename(account->username);
-		const char *username;
-		char *file = gaim_user_dir();
-		const char *prpl_id;
-		int protocol = -1;
-
-		prpl_id = gaim_account_get_protocol_id(account);
-
-		/* XXX - Somehow move this checking into the PRPLs
-		 * Load old GaimProtocol numbers that have been eliminated */
-		if (strcmp(prpl_id, "prpl-toc") == 0) {
-			protocol = 0;
-		} else if (strcmp(prpl_id, "prpl-oscar") == 0) {
-			protocol = 1;
-			if ((username = gaim_account_get_username(account)) != NULL) {
-				/*
-				 * Old values from when Protocols had to have an assigned ID:
-				 * 
-				 * GAIM_PROTO_TOC = 0
-				 * GAIM_PROTO_ICQ = 3
-				 */
-				protocol = (isalpha(*username) ? 0 : 3);
-			}
-		} else if (strcmp(prpl_id, "prpl-yahoo") == 0) {
-			protocol = 2;
-		} else if (strcmp(prpl_id, "prpl-icq") == 0) {
-			protocol = 3;
-		} else if (strcmp(prpl_id, "prpl-msn") == 0) {
-			protocol = 4;
-		} else if (strcmp(prpl_id, "prpl-irc") == 0) {
-			protocol = 5;
-		} else if (strcmp(prpl_id, "prpl-jabber") == 0) {
-			protocol = 8;
-		} else if (strcmp(prpl_id, "prpl-napster") == 0) {
-			protocol = 9;
-		} else if (strcmp(prpl_id, "prpl-zephyr") == 0) {
-			protocol = 10;
-		} else if (strcmp(prpl_id, "prpl-gg") == 0) {
-			protocol = 11;
-		} else if (strcmp(prpl_id, "prpl-moo") == 0) {
-			protocol = 16;
-		} else if (strcmp(prpl_id, "prpl-trepia") == 0) {
-			protocol = 18;
-		} else if (strcmp(prpl_id, "prpl-blogger") == 0) {
-			protocol = 21;
-		}
-
-		if (file != (char *)NULL) {
-			snprintf(path, PATHSIZE, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, protocol);
-			g_free(g_screenname);
-		} else {
-			g_free(g_screenname);
-			return;
-		}
-	}
-
-	if (stat(path, &st)) {
-		gaim_debug(GAIM_DEBUG_ERROR, "blist import", "Unable to stat %s.\n",
-				   path);
-		return;
-	}
-
-	if (!(f = fopen(path, "r"))) {
-		gaim_debug(GAIM_DEBUG_ERROR, "blist import", "Unable to open %s.\n",
-				   path);
-		return;
-	}
-
-	fgets(first, 64, f);
-
-	if ((first[0] == '\n') || (first[0] == '\r' && first[1] == '\n'))
-		fgets(first, 64, f);
-
-	/* We're going to parse an old-style Gaim buddy list */
-	if (first[0] == 'm') {
-		char buf2[BUF_LONG * 2];
-		buf = g_string_new("");
-		rewind(f);
-		while (1) {
-			len = fread(buf2, 1, BUF_LONG * 2 - 1, f);
-			if (len <= 0)
-				break;
-		buf2[len] = '\0';
-		buf = g_string_append(buf, buf2);
-		if (len != BUF_LONG * 2 - 1)
-			break;
-		}
-	}
-
-	fclose(f);
-
-	if (buf) {
-		buf = g_string_prepend(buf, "toc_set_config {");
-		buf = g_string_append(buf, "}\n");
-		gaim_blist_parse_toc_buddy_list(account, buf->str);
-		g_string_free(buf, TRUE);
-	}
-}
-
 gboolean gaim_group_on_account(GaimGroup *g, GaimAccount *account)
 {
 	GaimBlistNode *cnode, *bnode;
@@ -2224,12 +2022,6 @@
 			gaim_notify_error(NULL, NULL, _("Buddy List Error"), msg);
 			g_free(msg);
 		}
-	} else if (g_list_length(gaim_accounts_get_all())) {
-		/* read in the old lists, then save to the new format */
-		for (accts = gaim_accounts_get_all(); accts; accts = accts->next) {
-			do_import(accts->data, NULL);
-		}
-		schedule_blist_save();
 	}
 
 	g_free(filename);