comparison plugins/rawjab.c @ 1801:1407a816ac44

[gaim-migrate @ 1811] this is so evil. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 04 May 2001 20:59:38 +0000
parents
children
comparison
equal deleted inserted replaced
1800:a94491b828ef 1801:1407a816ac44
1 #define GAIM_PLUGINS
2 #include "gaim.h"
3 #include "prpl.h"
4 #ifdef MAX
5 #undef MAX
6 #undef MIN
7 #endif
8 #include "jabber/jabber.h"
9
10 static GtkWidget *window = NULL;
11 static GModule *me = NULL;
12
13 /* this is an evil hack. gc->proto_data for Jabber connections can be cast to a jconn *. */
14
15 char *name()
16 {
17 return "RawJab";
18 }
19
20 char *description()
21 {
22 return "Lets you send raw XML to Jabber. Not very useful except for debugging. Hit 'enter'"
23 " in the entry to send. Watch the debug window.";
24 }
25
26 static int goodbye()
27 {
28 gaim_plugin_unload(me);
29 return FALSE;
30 }
31
32 static void send_it(GtkEntry *entry)
33 {
34 char *txt;
35 GSList *c = connections;
36 struct gaim_connection *gc;
37 while (c) {
38 gc = c->data;
39 if (gc->protocol == PROTO_JABBER)
40 break;
41 c = c->next;
42 }
43 if (!c) return;
44 txt = gtk_entry_get_text(entry);
45 jab_send_raw(*(jconn *)gc->proto_data, txt);
46 gtk_entry_set_text(entry, "");
47 }
48
49 char *gaim_plugin_init(GModule *h)
50 {
51 GtkWidget *entry;
52 me = h;
53
54 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
55 gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(goodbye), NULL);
56
57 entry = gtk_entry_new();
58 gtk_container_add(GTK_CONTAINER(window), entry);
59 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_it), NULL);
60
61 gtk_widget_show_all(window);
62
63 return NULL;
64 }
65
66 void gaim_plugin_remove()
67 {
68 if (window)
69 gtk_widget_destroy(window);
70 window = NULL;
71 me = NULL;
72 }