Update of /cvsroot/gaim/gaim/src
In directory usw-pr-cvs1:/tmp/cvs-serv13906
Modified Files:
core.c gaim.h module.c
Log Message:
you can sign people on now.
Index: core.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/core.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- core.c 2001/10/06 02:25:46 1.7
+++ core.c 2001/10/06 02:49:18 1.8
@@ -90,6 +90,37 @@
}
}
+static void user_handler(struct UI *ui, guchar subtype, guchar *data)
+{
+ guint id;
+ struct aim_user *u;
+
+ switch (subtype) {
+ /*
+ case CUI_USER_LIST:
+ break;
+ case CUI_USER_ADD:
+ break;
+ case CUI_USER_REMOVE:
+ break;
+ case CUI_USER_MODIFY:
+ break;
+ */
+ case CUI_USER_SIGNON:
+ if (!data)
+ return;
+ memcpy(&id, data, sizeof(id));
+ u = g_slist_nth_data(aim_users, id);
+ if (u)
+ serv_login(u);
+ /* don't need to do anything here because the UI will get updates from other handlers */
+ break;
+ default:
+ debug_printf("unhandled user subtype %d\n", subtype);
+ break;
+ }
+}
+
static gint gaim_recv(GIOChannel *source, void *buf, gint len)
{
gint total = 0;
@@ -144,15 +175,18 @@
return FALSE;
}
- in = g_new0(guchar, len);
- if (gaim_recv(source, in, len) != len) {
- debug_printf("UI has abandoned us!\n");
- uis = g_slist_remove(uis, ui);
- g_io_channel_close(ui->channel);
- g_source_remove(ui->inpa);
- g_free(ui);
- return FALSE;
- }
+ if (len) {
+ in = g_new0(guchar, len);
+ if (gaim_recv(source, in, len) != len) {
+ debug_printf("UI has abandoned us!\n");
+ uis = g_slist_remove(uis, ui);
+ g_io_channel_close(ui->channel);
+ g_source_remove(ui->inpa);
+ g_free(ui);
+ return FALSE;
+ }
+ } else
+ in = NULL;
switch (type) {
case CUI_TYPE_META:
@@ -161,10 +195,10 @@
case CUI_TYPE_PLUGIN:
plugin_handler(ui, subtype, in);
break;
- /*
case CUI_TYPE_USER:
user_handler(ui, subtype, in);
break;
+ /*
case CUI_TYPE_CONN:
conn_handler(ui, subtype, in);
break;
@@ -183,7 +217,8 @@
break;
}
- g_free(in);
+ if (in)
+ g_free(in);
return TRUE;
}
Index: gaim.h
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gaim.h,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- gaim.h 2001/10/06 02:25:46 1.279
+++ gaim.h 2001/10/06 02:49:18 1.280
@@ -56,6 +56,7 @@
#define CUI_USER_ADD 2
#define CUI_USER_REMOVE 3
#define CUI_USER_MODIFY 4 /* this handles moving them in the list too */
+#define CUI_USER_SIGNON 5
#define CUI_CONN_LIST 1
#define CUI_CONN_PROGRESS 2
Index: module.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/module.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- module.c 2001/10/06 02:25:46 1.5
+++ module.c 2001/10/06 02:49:18 1.6
@@ -527,23 +527,36 @@
void plugin_handler(struct UI *ui, guchar subtype, guchar *data)
{
+ guint id;
+ struct gaim_plugin *p;
+
switch (subtype) {
/*
case CUI_PLUGIN_LIST:
break;
*/
case CUI_PLUGIN_LOAD:
- load_plugin(data);
+ p = load_plugin(data);
/* XXX need to broadcast to UIs that plugin has been loaded */
break;
- /*
case CUI_PLUGIN_UNLOAD:
+ memcpy(&id, data, sizeof(id));
+ p = g_list_nth_data(plugins, id);
+ if (p) {
+ unload_plugin(p);
+ /* XXX need to broadcast to UIs that plugin has been unloaded */
+ }
break;
case CUI_PLUGIN_RELOAD:
+ memcpy(&id, data, sizeof(id));
+ p = g_list_nth_data(plugins, id);
+ if (p) {
+ p = reload_plugin(p);
+ /* XXX need to broadcast to UIs that plugin has been reloaded */
+ }
break;
- */
default:
- debug_printf("unhandled plugin subtype: %d\n", subtype);
+ debug_printf("unhandled plugin subtype %d\n", subtype);
break;
}
}
|