# HG changeset patch # User Eric Warmenhoven # Date 989009978 0 # Node ID 1407a816ac449b9221dae4a861116c1ba537f721 # Parent a94491b828ef059f07c5d10124972f0399009384 [gaim-migrate @ 1811] this is so evil. committer: Tailor Script diff -r a94491b828ef -r 1407a816ac44 plugins/rawjab.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/rawjab.c Fri May 04 20:59:38 2001 +0000 @@ -0,0 +1,72 @@ +#define GAIM_PLUGINS +#include "gaim.h" +#include "prpl.h" +#ifdef MAX +#undef MAX +#undef MIN +#endif +#include "jabber/jabber.h" + +static GtkWidget *window = NULL; +static GModule *me = NULL; + +/* this is an evil hack. gc->proto_data for Jabber connections can be cast to a jconn *. */ + +char *name() +{ + return "RawJab"; +} + +char *description() +{ + return "Lets you send raw XML to Jabber. Not very useful except for debugging. Hit 'enter'" + " in the entry to send. Watch the debug window."; +} + +static int goodbye() +{ + gaim_plugin_unload(me); + return FALSE; +} + +static void send_it(GtkEntry *entry) +{ + char *txt; + GSList *c = connections; + struct gaim_connection *gc; + while (c) { + gc = c->data; + if (gc->protocol == PROTO_JABBER) + break; + c = c->next; + } + if (!c) return; + txt = gtk_entry_get_text(entry); + jab_send_raw(*(jconn *)gc->proto_data, txt); + gtk_entry_set_text(entry, ""); +} + +char *gaim_plugin_init(GModule *h) +{ + GtkWidget *entry; + me = h; + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(goodbye), NULL); + + entry = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(window), entry); + gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_it), NULL); + + gtk_widget_show_all(window); + + return NULL; +} + +void gaim_plugin_remove() +{ + if (window) + gtk_widget_destroy(window); + window = NULL; + me = NULL; +}