# HG changeset patch # User Eric Warmenhoven # Date 1002343054 0 # Node ID 7f2432a87376ae1eeb305d9438a3f91f6fbd9aac # Parent 895e2469cb3afbca2e74f199cb0a0c7f75423bb7 [gaim-migrate @ 2456] it can send ims. committer: Tailor Script diff -r 895e2469cb3a -r 7f2432a87376 src/core.c --- a/src/core.c Sat Oct 06 04:05:53 2001 +0000 +++ b/src/core.c Sat Oct 06 04:37:34 2001 +0000 @@ -90,6 +90,42 @@ } } +static 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: + 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); + break; + } +} + static void user_handler(struct UI *ui, guchar subtype, guchar *data) { guint id; @@ -121,6 +157,53 @@ } } +static void message_handler(struct UI *ui, guchar subtype, guchar *data) +{ + switch (subtype) { + case CUI_MESSAGE_LIST: + break; + case CUI_MESSAGE_SEND: + if (!data) + return; + { + guint id; + struct gaim_connection *gc; + guint len; + char *who, *msg; + gint flags; + int pos = 0; + + memcpy(&id, data + pos, sizeof(id)); + pos += sizeof(id); + gc = g_slist_nth_data(connections, id); + if (!gc) + return; + + memcpy(&len, data + pos, sizeof(len)); + pos += sizeof(len); + who = g_strndup(data + pos, len + 1); + pos += len; + + memcpy(&len, data + pos, sizeof(len)); + pos += sizeof(len); + msg = g_strndup(data + pos, len + 1); + pos += len; + + memcpy(&flags, data + pos, sizeof(flags)); + serv_send_im(gc, who, msg, flags); + + g_free(who); + g_free(msg); + } + break; + case CUI_MESSAGE_RECV: + break; + default: + debug_printf("unhandled message subtype %d\n", subtype); + break; + } +} + static gint gaim_recv(GIOChannel *source, void *buf, gint len) { gint total = 0; diff -r 895e2469cb3a -r 7f2432a87376 src/core.h --- a/src/core.h Sat Oct 06 04:05:53 2001 +0000 +++ b/src/core.h Sat Oct 06 04:37:34 2001 +0000 @@ -187,7 +187,6 @@ extern void remove_all_plugins(); #endif extern int plugin_event(enum gaim_event, void *, void *, void *, void *); -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); diff -r 895e2469cb3a -r 7f2432a87376 src/module.c --- a/src/module.c Sat Oct 06 04:05:53 2001 +0000 +++ b/src/module.c Sat Oct 06 04:37:34 2001 +0000 @@ -524,39 +524,3 @@ } } #endif - -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: - 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); - break; - } -}