changeset 2440:8306c042bac7

[gaim-migrate @ 2453] can load plugins. won't get any indication of it though. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 06 Oct 2001 02:25:46 +0000
parents 932adc1ac9ed
children 2c2c1f717616
files src/core.c src/core.h src/gaim.h src/module.c src/ui.h
diffstat 5 files changed, 58 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.c	Sat Oct 06 01:55:59 2001 +0000
+++ b/src/core.c	Sat Oct 06 02:25:46 2001 +0000
@@ -38,10 +38,6 @@
 #include "gaim.h"
 
 static gint UI_fd = -1;
-struct UI {
-	GIOChannel *channel;
-	guint inpa;
-};
 GSList *uis = NULL;
 
 gint UI_write(struct UI *ui, guchar *data, gint len)
@@ -70,27 +66,27 @@
 static void meta_handler(struct UI *ui, guchar subtype, guchar *data)
 {
 	switch (subtype) {
-		case CUI_META_LIST:
-			break;
-		case CUI_META_QUIT:
-			while (uis) {
-				ui = uis->data;
-				uis = g_slist_remove(uis, ui);
-				g_io_channel_close(ui->channel);
-				g_source_remove(ui->inpa);
-				g_free(ui);
-			}
-			do_quit();
-			break;
-		case CUI_META_DETACH:
+	case CUI_META_LIST:
+		break;
+	case CUI_META_QUIT:
+		while (uis) {
+			ui = uis->data;
 			uis = g_slist_remove(uis, ui);
 			g_io_channel_close(ui->channel);
 			g_source_remove(ui->inpa);
 			g_free(ui);
-			break;
-		default:
-			debug_printf("unhandled meta subtype %d\n", subtype);
-			break;
+		}
+		do_quit();
+		break;
+	case CUI_META_DETACH:
+		uis = g_slist_remove(uis, ui);
+		g_io_channel_close(ui->channel);
+		g_source_remove(ui->inpa);
+		g_free(ui);
+		break;
+	default:
+		debug_printf("unhandled meta subtype %d\n", subtype);
+		break;
 	}
 }
 
@@ -162,10 +158,10 @@
 		case CUI_TYPE_META:
 			meta_handler(ui, subtype, in);
 			break;
-			/*
 		case CUI_TYPE_PLUGIN:
 			plugin_handler(ui, subtype, in);
 			break;
+			/*
 		case CUI_TYPE_USER:
 			user_handler(ui, subtype, in);
 			break;
--- a/src/core.h	Sat Oct 06 01:55:59 2001 +0000
+++ b/src/core.h	Sat Oct 06 02:25:46 2001 +0000
@@ -74,6 +74,11 @@
 	/* any others? it's easy to add... */
 };
 
+struct UI {
+	GIOChannel *channel;
+	guint inpa;
+};
+
 #ifdef GAIM_PLUGINS
 
 struct gaim_plugin {
@@ -89,8 +94,6 @@
 	void *data;
 };
 
-extern GList *plugins;
-extern GList *callbacks;
 #endif
 
 struct buddy {
@@ -114,6 +117,13 @@
 	struct gaim_connection *gc; /* the connection it belongs to */
 };
 
+/* Globals in core.c */
+extern GSList *uis;
+
+/* Globals in plugins.c */
+extern GList *plugins;
+extern GList *callbacks;
+
 /* Functions in buddy.c */
 extern struct buddy *find_buddy(struct gaim_connection *, char *);
 extern struct group *find_group(struct gaim_connection *, char *);
@@ -129,6 +139,8 @@
 extern void parse_toc_buddy_list(struct gaim_connection *, char *, int);
 
 /* Functions in core.c */
+extern gint UI_write(struct UI *, guchar *, int);
+extern void UI_broadcast(guchar *data, int);
 /* Don't ever use these; when gaim-core is done these will be
  * merged into the core's main() and won't be called directly */
 extern int core_main();
@@ -156,9 +168,10 @@
 extern void gaim_signal_connect(GModule *, enum gaim_event, void *, void *);
 extern void gaim_signal_disconnect(GModule *, enum gaim_event, void *);
 extern void gaim_plugin_unload(GModule *);
+extern void remove_all_plugins();
 #endif
 extern int plugin_event(enum gaim_event, void *, void *, void *, void *);
-extern void remove_all_plugins();
+extern void plugin_handler(struct UI *, guchar, guchar *);
 
 /* Functions in server.c */
 extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, gushort);
--- a/src/gaim.h	Sat Oct 06 01:55:59 2001 +0000
+++ b/src/gaim.h	Sat Oct 06 02:25:46 2001 +0000
@@ -511,7 +511,6 @@
 extern char *stylize(gchar *, int);
 extern void show_usage (int, char *);
 extern int do_auto_login (char *);
-extern int file_is_dir (const char *, GtkWidget *);
 extern char *gaim_user_dir();
 extern void strncpy_nohtml(gchar *, const gchar *, size_t);
 extern void strncpy_withhtml(gchar *, const gchar *, size_t);
--- a/src/module.c	Sat Oct 06 01:55:59 2001 +0000
+++ b/src/module.c	Sat Oct 06 02:25:46 2001 +0000
@@ -524,3 +524,26 @@
 	}
 }
 #endif
+
+void plugin_handler(struct UI *ui, guchar subtype, guchar *data)
+{
+	switch (subtype) {
+		/*
+	case CUI_PLUGIN_LIST:
+		break;
+		*/
+	case CUI_PLUGIN_LOAD:
+		load_plugin(data);
+		/* XXX need to broadcast to UIs that plugin has been loaded */
+		break;
+		/*
+	case CUI_PLUGIN_UNLOAD:
+		break;
+	case CUI_PLUGIN_RELOAD:
+		break;
+		*/
+	default:
+		debug_printf("unhandled plugin subtype: %d\n", subtype);
+		break;
+	}
+}
--- a/src/ui.h	Sat Oct 06 01:55:59 2001 +0000
+++ b/src/ui.h	Sat Oct 06 02:25:46 2001 +0000
@@ -286,6 +286,7 @@
 extern void aol_icon(GdkWindow *);
 extern GtkWidget *picture_button(GtkWidget *, char *, char **);
 extern GtkWidget *picture_button2(GtkWidget *, char *, char **, short);
+extern int file_is_dir(const char *, GtkWidget *);
 
 /* Functions in multi.c */
 extern void account_editor(GtkWidget *, GtkWidget *);