Mercurial > pidgin.yaz
changeset 2441:2c2c1f717616
[gaim-migrate @ 2454]
you can sign people on now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 06 Oct 2001 02:49:18 +0000 |
parents | 8306c042bac7 |
children | 895e2469cb3a |
files | src/core.c src/gaim.h src/module.c |
diffstat | 3 files changed, 64 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core.c Sat Oct 06 02:25:46 2001 +0000 +++ b/src/core.c Sat Oct 06 02:49:18 2001 +0000 @@ -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; }
--- a/src/gaim.h Sat Oct 06 02:25:46 2001 +0000 +++ b/src/gaim.h Sat Oct 06 02:49:18 2001 +0000 @@ -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
--- a/src/module.c Sat Oct 06 02:25:46 2001 +0000 +++ b/src/module.c Sat Oct 06 02:49:18 2001 +0000 @@ -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; } }