diff src/gaimrc.c @ 5205:fefad67de2c7

[gaim-migrate @ 5573] I had a damn good commit message, but it was eaten. Let's try it again. Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short. There are lots'a cool thingies here. Okay now, this isn't as cool as the previous message, but: 1) There's now a single entry function for all plugin types. It returns a detailed information structure on the plugin. This removes a lot of the ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so if you use it, well, you shouldn't have used it anyway, but now you can't! bwahahaha. Use AIM/ICQ. 2) There are now 3 types of plugins: Standard, Loader, and Protocol plugins. Standard plugins are, well, standard, compiled plugins. Loader plugins load other plugins. For example, the perl support is now a loader plugin. It loads perl scripts. In the future, we'll have Ruby and Python loader plugins. Protocol plugins are, well, protocol plugins... yeah... 3) Plugins have unique IDs, so they can be referred to or automatically updated from a plugin database in the future. Neat, huh? 4) Plugins will have dependency support in the future, and can be hidden, so if you have, say, a logging core plugin, it won't have to show up, but then you load the GTK+ logging plugin and it'll auto-load the core plugin. Core/UI split plugins! 5) There will eventually be custom plugin signals and RPC of some sort, for the core/ui split plugins. So, okay, back up .gaimrc. I'd like to thank my parents for their support, javabsp for helping convert a bunch of protocol plugins, and Etan for helping convert a bunch of standard plugins. Have fun. If you have any problems, please let me know, but you probably won't have anything major happen. You will have to convert your plugins, though, and I'm not guaranteeing that all perl scripts will still work. I'll end up changing the perl script API eventually, so I know they won't down the road. Don't worry, though. It'll be mass cool. faceprint wants me to just commit the damn code already. So, here we go!!! .. .. I need a massage. From a young, cute girl. Are there any young, cute girls in the audience? IM me plz k thx. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 25 Apr 2003 06:47:33 +0000
parents 145587c11207
children 0241d6b6702d
line wrap: on
line diff
--- a/src/gaimrc.c	Thu Apr 24 03:52:25 2003 +0000
+++ b/src/gaimrc.c	Fri Apr 25 06:47:33 2003 +0000
@@ -66,6 +66,7 @@
 static guint request_save_prefs = 0;
 static guint is_saving_prefs = 0;
 static guint request_load_prefs = 0;
+static guint prefs_initial_load = 0;
 guint proxy_info_is_from_gaimrc = 1; /* Only save proxy info if it
 				      * was loaded from the file
 				      * or otherwise explicitly requested */
@@ -534,24 +535,23 @@
 	fprintf(f, "}\n");
 }
 
-#ifdef GAIM_PLUGINS
 static void gaimrc_write_plugins(FILE *f)
 {
-	GList *pl = plugins;
-	struct gaim_plugin *p;
+	GList *pl;
+	GaimPlugin *p;
 
 	fprintf(f, "plugins {\n");
 
-	while (pl) {
+	for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
 		char *path;
 
-		p = (struct gaim_plugin *)pl->data;
+		p = (GaimPlugin *)pl->data;
 
-		path = escape_text2(p->path);
-		fprintf(f, "\tplugin { %s }\n", path);
-		free(path);
-
-		pl = pl->next;
+		if (p->info->type != GAIM_PLUGIN_PROTOCOL) {
+			path = escape_text2(p->path);
+			fprintf(f, "\tplugin { %s }\n", path);
+			free(path);
+		}
 	}
 
 	fprintf(f, "}\n");
@@ -562,7 +562,6 @@
 	struct parse parse_buffer;
 	struct parse *p;
 	char buf[4096];
-	GSList *load = NULL;
 
 	buf[0] = 0;
 
@@ -575,20 +574,10 @@
 
 		p = parse_line(buf, &parse_buffer);
 		if (!strcmp(p->option, "plugin")) {
-			load = g_slist_append(load, g_strdup(p->value[0]));
+			gaim_plugin_load(gaim_plugin_probe(p->value[0]));
 		}
 	}
-	/* this is such a fucked up hack. the reason we do this is because after
-	 * we load a plugin the gaimrc file gets rewrit. so we have to remember
-	 * which ones to load before loading them. */
-	while (load) {
-		if (load->data)
-			load_plugin(load->data);
-		g_free(load->data);
-		load = g_slist_remove(load, load->data);
-	}
 }
-#endif /* GAIM_PLUGINS */
 
 static struct gaim_account *gaimrc_read_user(FILE *f)
 {
@@ -613,7 +602,7 @@
 
 	account->user_info[0] = 0;
 	account->options = OPT_ACCT_REM_PASS;
-	account->protocol = DEFAULT_PROTO;
+	account->protocol = GAIM_PROTO_DEFAULT;
 	account->permit = account->deny = NULL;
 
 	if (!fgets(buf, sizeof(buf), f))
@@ -1027,19 +1016,21 @@
 		away_resend = 120;
 
 	if (misc_options & OPT_MISC_BUDDY_TICKER) {
-#ifdef GAIM_PLUGINS
-		gchar* buf;
+		if (gaim_plugins_enabled()) {
+			gchar* buf;
 
-		buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, 
+			buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, 
 #ifndef _WIN32
-				  "ticker.so",
+					  "ticker.so",
 #else
-				  "ticker.dll",
+					  "ticker.dll",
 #endif
-				  NULL);
-		load_plugin(buf);
-		g_free(buf);
-#endif
+					  NULL);
+
+			gaim_plugin_load(gaim_plugin_probe(buf));
+			g_free(buf);
+		}
+
 		misc_options &= ~OPT_MISC_BUDDY_TICKER;
 	} 
 }
@@ -1469,6 +1460,7 @@
 	char buf[1024];
 	int ver = 0;
 	debug_printf("load_prefs\n");
+
 	if (is_saving_prefs) {
 		request_load_prefs = 1;
 		debug_printf("currently saving, will request load\n");
@@ -1508,11 +1500,10 @@
 			case 2:
 				gaimrc_read_away(f);
 				break;
-#ifdef GAIM_PLUGINS
 			case 3:
-				gaimrc_read_plugins(f);
+				if (gaim_plugins_enabled())
+					gaimrc_read_plugins(f);
 				break;
-#endif
 			case 4:
 				gaimrc_read_pounce(f);
 				break;
@@ -1544,6 +1535,8 @@
 		set_defaults();
 		save_prefs();
 	}
+
+	prefs_initial_load = 1;
 }
 
 void save_prefs()
@@ -1553,6 +1546,9 @@
 	gchar *filename_temp;
 
 	debug_printf("enter save_prefs\n");  
+	if (!prefs_initial_load)
+		return;
+
 	if (is_loading_prefs) {
 		request_save_prefs = 1;
 		debug_printf("currently loading, will request save\n");
@@ -1576,9 +1572,10 @@
 		gaimrc_write_sounds(f);
 		gaimrc_write_away(f);
 		gaimrc_write_pounce(f);
-#ifdef GAIM_PLUGINS
-		gaimrc_write_plugins(f);
-#endif
+
+		if (gaim_plugins_enabled())
+			gaimrc_write_plugins(f);
+
 		gaimrc_write_proxy(f);
 		fclose(f);
 		if (rename(filename_temp, filename) < 0)