From: Eric W. <war...@us...> - 2001-10-06 04:37:37
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv19347 Modified Files: core.c core.h module.c Log Message: it can send ims. Index: core.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/core.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- core.c 2001/10/06 02:49:18 1.8 +++ core.c 2001/10/06 04:37:34 1.9 @@ -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; @@ -117,6 +153,53 @@ break; default: debug_printf("unhandled user subtype %d\n", subtype); + break; + } +} + +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; } } Index: core.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/core.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- core.h 2001/10/06 04:05:50 1.5 +++ core.h 2001/10/06 04:37:34 1.6 @@ -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); Index: module.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/module.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- module.c 2001/10/06 02:49:18 1.6 +++ module.c 2001/10/06 04:37:34 1.7 @@ -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; - } -} |