changeset 774:b61607d6c2af

[gaim-migrate @ 784] save buddy chats, and better display of them (though they flash now, but they don't cause errors) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 28 Aug 2000 18:49:17 +0000
parents 267ed2b889ee
children 9614e69f68ca
files ChangeLog HACKING TODO src/buddy.c src/gaimrc.c src/oscar.c src/toc.c
diffstat 7 files changed, 70 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 28 18:25:39 2000 +0000
+++ b/ChangeLog	Mon Aug 28 18:49:17 2000 +0000
@@ -15,6 +15,7 @@
 	* Removed the Lag-O-Meter
 	* Socks 4/5 Proxy works
 	* Buddy Pounces are now saved in .gaimrc
+	* Buddy Chats are now saved in .gaimrc
 	* Ability to merge gaim, aim2, aim4 buddylists. Thanks again bmiller!
 	* ICQ-style aliases. This lets you change the name you see your buddy
 	  as. For example, if your buddy's SN is 'CouldntGetMyName', you can
--- a/HACKING	Mon Aug 28 18:25:39 2000 +0000
+++ b/HACKING	Mon Aug 28 18:49:17 2000 +0000
@@ -14,7 +14,7 @@
 looked at the patch yet.) To get gaim from CVS (if you haven't already),
 run the following commands:
 
-$ export CVSROOT=anonymous@cvs.gaim.sourceforge.net:/cvsroot/gaim
+$ export CVSROOT=:pserver:anonymous@cvs.gaim.sourceforge.net:/cvsroot/gaim
 $ cvs login
 (hit enter as the password)
 $ cvs co gaim
--- a/TODO	Mon Aug 28 18:25:39 2000 +0000
+++ b/TODO	Mon Aug 28 18:49:17 2000 +0000
@@ -1,7 +1,6 @@
 --- STUFF FOR 0.10.1 RELEASE ---
 	Third sound option for people without soundcards who still want
 		sound events.  Make a PC Speaker Beep (^G / Char 7)
-	Save Buddy Chats
 	Execute Command on Buddy Pounce
 	Redesign the Foreground/Background color options under preferences.
 	Add ability to conersaton window to allow changing of foreground/
--- a/src/buddy.c	Mon Aug 28 18:25:39 2000 +0000
+++ b/src/buddy.c	Mon Aug 28 18:49:17 2000 +0000
@@ -2044,14 +2044,10 @@
 
 void refresh_buddy_window()
 {
-        setup_buddy_chats();
- 
         build_edit_tree();
 	build_permit_tree();
         
         update_button_pix();
         gtk_widget_show(blist);
-
-
 }
 
--- a/src/gaimrc.c	Mon Aug 28 18:25:39 2000 +0000
+++ b/src/gaimrc.c	Mon Aug 28 18:49:17 2000 +0000
@@ -148,6 +148,8 @@
 		return 3;
 	} else if (!strcmp(tag, "pounce")) {
 		return 4;
+	} else if (!strcmp(tag, "chat")) {
+		return 5;
 	}
 
 	return -1;
@@ -313,6 +315,64 @@
 	fprintf(f, "}\n");
 }
 
+static void gaimrc_read_chat(FILE *f)
+{
+	struct parse *p;
+	char buf[4096];
+	struct chat_room *b;
+
+	buf[0] = 0;
+	
+	while (buf[0] != '}')
+	{
+		if (!fgets(buf, sizeof(buf), f))
+			return;
+		
+		if (buf[0] == '}')
+			return;
+
+		p = parse_line(buf);
+		if (!strcmp(p->option, "entry"))
+		{
+			b = g_new0(struct chat_room, 1);
+
+			g_snprintf(b->name, sizeof(b->name),  "%s", p->value[0]);
+
+			b->exchange = atoi(p->value[1]);
+		
+			chat_rooms = g_list_append(chat_rooms, b);
+		}
+	}
+}
+
+static void gaimrc_write_chat(FILE *f)
+{
+	GList *pnc = chat_rooms;
+	struct chat_room *b;
+
+	fprintf(f, "chat {\n");
+
+	if (pnc)
+	{
+		while (pnc) {
+			char *str1;
+
+			b = (struct chat_room *)pnc->data;
+
+			str1 = escape_text2(b->name);
+
+			fprintf(f, "\tentry { %s } { %d }\n", str1, b->exchange);
+
+			/* escape_text2 uses malloc(), so we don't want to g_free these */
+			free(str1);
+	
+			pnc = pnc->next;
+		}
+	}
+
+	fprintf(f, "}\n");
+}
+
 #ifdef GAIM_PLUGINS
 static void gaimrc_write_plugins(FILE *f)
 {
@@ -687,6 +747,9 @@
 				case 4:
 					gaimrc_read_pounce(f);
 					break;
+				case 5:
+					gaimrc_read_chat(f);
+					break;
 				default:
 					/* NOOP */
 					break;
@@ -714,6 +777,7 @@
 			gaimrc_write_plugins(f);
 #endif
 			gaimrc_write_pounce(f);
+			gaimrc_write_chat(f);
 			fclose(f);
 			chmod(buf, S_IRUSR | S_IWUSR);
 		}
--- a/src/oscar.c	Mon Aug 28 18:25:39 2000 +0000
+++ b/src/oscar.c	Mon Aug 28 18:49:17 2000 +0000
@@ -397,10 +397,6 @@
 	switch(serviceid) {
 	case 0x0005: /* Ads */
 		debug_print("Received Ads, finishing login\n");
-		/* we'll take care of this in the parse_toc_buddy_config() below
-		sprintf(buddies, "%s&", current_user->username);
-		aim_bos_setbuddylist(sess, command->conn, buddies);
-		*/
 		aim_bos_setprofile(sess, command->conn, current_user->user_info,
 					NULL, gaim_caps);
 		aim_seticbmparam(sess, command->conn);
@@ -427,6 +423,8 @@
 		if (bud_list_cache_exists())
 			do_import(NULL, 0);
 
+		setup_buddy_chats();
+
 		aim_bos_clientready(sess, command->conn);
 		debug_print("Roger that, all systems go\n");
 
--- a/src/toc.c	Mon Aug 28 18:25:39 2000 +0000
+++ b/src/toc.c	Mon Aug 28 18:49:17 2000 +0000
@@ -163,9 +163,9 @@
 		parse_toc_buddy_list(config, 0);
 	else
 		do_import(0, 0);
-        refresh_buddy_window();
         
-        
+	setup_buddy_chats();
+
 	g_snprintf(buf2, sizeof(buf2), "toc_init_done");
 	sflap_send(buf2, -1, TYPE_DATA);