annotate plugins/rawjab.c @ 2009:ac9dd6b00b34

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