Thu, 31 May 2012 05:45:28 +0000
No need to search for accounts when we already have a list of them.
| 15412 | 1 | /* |
| 15884 | 2 | * Purple - XMPP debugging tool |
| 15412 | 3 | * |
| 4 | * Copyright (C) 2002-2003, Sean Egan | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 15412 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "gtkplugin.h" | |
| 24 | #include "version.h" | |
| 25 | #include "prpl.h" | |
| 26 | #include "xmlnode.h" | |
| 27 | ||
| 28 | #include "gtkimhtml.h" | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
29 | #include "gtkwebview.h" |
| 17242 | 30 | #include "gtkutils.h" |
| 15412 | 31 | |
| 32 | typedef struct { | |
| 15884 | 33 | PurpleConnection *gc; |
| 15412 | 34 | GtkWidget *window; |
| 35 | GtkWidget *hbox; | |
| 36 | GtkWidget *dropdown; | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
37 | GtkWidget *webview; |
| 15412 | 38 | GtkWidget *entry; |
| 39 | GtkWidget *sw; | |
| 40 | int count; | |
| 41 | GList *accounts; | |
| 42 | } XmppConsole; | |
| 43 | ||
| 44 | XmppConsole *console = NULL; | |
| 45 | static void *xmpp_console_handle = NULL; | |
| 46 | ||
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
47 | #define EMPTY_HTML \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
48 | "<html><head><style type='text/css'>" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
49 | "body { white-space: pre-wrap; margin: 0; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
50 | "div.info { color: #777777; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
51 | "div.incoming { background-color: #ffcece; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
52 | "div.outgoing { background-color: #dcecc4; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
53 | "span.bracket { color: #940f8c; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
54 | "span.tag { color: #8b1dab; font-weight: bold; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
55 | "span.attr { color: #a02961; font-weight: bold; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
56 | "span.value { color: #324aa4; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
57 | "span.xmlns { color: #2cb12f; font-weight: bold;}" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
58 | "</style></head></html>" |
| 15412 | 59 | |
| 60 | static char * | |
| 61 | xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) | |
| 62 | { | |
| 63 | GString *text = g_string_new(""); | |
| 64 | xmlnode *c; | |
| 65 | char *node_name, *esc, *esc2, *tab = NULL; | |
| 66 | gboolean need_end = FALSE, pretty = TRUE; | |
| 67 | ||
| 68 | g_return_val_if_fail(node != NULL, NULL); | |
| 69 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
70 | if (pretty && depth) { |
| 15412 | 71 | tab = g_strnfill(depth, '\t'); |
| 72 | text = g_string_append(text, tab); | |
| 73 | } | |
| 74 | ||
| 75 | node_name = g_markup_escape_text(node->name, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
76 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
77 | "<span class=bracket><</span>" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
78 | "<span class=tag>%s</span>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
79 | node_name); |
| 15412 | 80 | |
| 81 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
82 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
83 | !node->parent->xmlns || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
84 | strcmp(node->xmlns, node->parent->xmlns)) && |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
85 | strcmp(node->xmlns, "jabber:client")) |
| 15412 | 86 | { |
| 87 | char *xmlns = g_markup_escape_text(node->xmlns, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
88 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
89 | " <span class=attr>xmlns</span>=" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
90 | "'<span class=xmlns>%s</span>'", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
91 | xmlns); |
| 15412 | 92 | g_free(xmlns); |
| 93 | } | |
| 94 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
95 | for (c = node->child; c; c = c->next) |
| 15412 | 96 | { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
97 | if (c->type == XMLNODE_TYPE_ATTRIB) { |
| 15412 | 98 | esc = g_markup_escape_text(c->name, -1); |
| 99 | esc2 = g_markup_escape_text(c->data, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
100 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
101 | " <span class=attr>%s</span>=" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
102 | "'<span class=value>%s</span>'", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
103 | esc, esc2); |
| 15412 | 104 | g_free(esc); |
| 105 | g_free(esc2); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
106 | } else if (c->type == XMLNODE_TYPE_TAG || c->type == XMLNODE_TYPE_DATA) { |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
107 | if (c->type == XMLNODE_TYPE_DATA) |
| 15412 | 108 | pretty = FALSE; |
| 109 | need_end = TRUE; | |
| 110 | } | |
| 111 | } | |
| 112 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
113 | if (need_end) { |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
114 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
115 | "<span class=bracket>></span>%s", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
116 | pretty ? "<br>" : ""); |
| 15412 | 117 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
118 | for (c = node->child; c; c = c->next) |
| 15412 | 119 | { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
120 | if (c->type == XMLNODE_TYPE_TAG) { |
| 15412 | 121 | int esc_len; |
| 122 | esc = xmlnode_to_pretty_str(c, &esc_len, depth+1); | |
| 123 | text = g_string_append_len(text, esc, esc_len); | |
| 124 | g_free(esc); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
125 | } else if (c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) { |
| 15412 | 126 | esc = g_markup_escape_text(c->data, c->data_sz); |
| 127 | text = g_string_append(text, esc); | |
| 128 | g_free(esc); | |
| 129 | } | |
| 130 | } | |
| 131 | ||
| 132 | if(tab && pretty) | |
| 133 | text = g_string_append(text, tab); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
134 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
135 | "<span class=bracket><</span>/" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
136 | "<span class=tag>%s</span>" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
137 | "<span class=bracket>></span><br>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
138 | node_name); |
| 15412 | 139 | } else { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
140 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
141 | "/<span class=bracket>></span><br>"); |
| 15412 | 142 | } |
| 143 | ||
| 144 | g_free(node_name); | |
| 145 | ||
| 146 | g_free(tab); | |
| 147 | ||
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
148 | if (len) |
| 15412 | 149 | *len = text->len; |
| 150 | ||
| 151 | return g_string_free(text, FALSE); | |
| 152 | } | |
| 153 | ||
| 154 | static void | |
| 15884 | 155 | xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer null) |
| 15412 | 156 | { |
| 157 | char *str, *formatted; | |
| 158 | ||
| 159 | if (!console || console->gc != gc) | |
| 160 | return; | |
| 161 | str = xmlnode_to_pretty_str(*packet, NULL, 0); | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
162 | formatted = g_strdup_printf("<div class=incoming>%s</div>", str); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
163 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 164 | g_free(formatted); |
| 165 | g_free(str); | |
| 166 | } | |
| 167 | ||
| 168 | static void | |
| 15884 | 169 | xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 170 | { |
| 171 | char *str; | |
| 172 | char *formatted; | |
| 173 | xmlnode *node; | |
| 174 | ||
| 175 | if (!console || console->gc != gc) | |
| 176 | return; | |
| 177 | node = xmlnode_from_str(*packet, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
178 | |
| 15412 | 179 | if (!node) |
| 180 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
181 | |
| 15412 | 182 | str = xmlnode_to_pretty_str(node, NULL, 0); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
183 | formatted = g_strdup_printf("<div class=outgoing>%s</div>", str); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
184 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 185 | g_free(formatted); |
| 186 | g_free(str); | |
| 187 | xmlnode_free(node); | |
| 188 | } | |
| 189 | ||
| 190 | static void message_send_cb(GtkWidget *widget, gpointer p) | |
| 191 | { | |
| 192 | GtkTextIter start, end; | |
| 15884 | 193 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30010
diff
changeset
|
194 | PurpleConnection *gc; |
| 15412 | 195 | GtkTextBuffer *buffer; |
| 196 | char *text; | |
| 197 | ||
| 198 | gc = console->gc; | |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
199 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
200 | if (gc) |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
201 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
202 | |
| 15412 | 203 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); |
| 204 | gtk_text_buffer_get_start_iter(buffer, &start); | |
| 205 | gtk_text_buffer_get_end_iter(buffer, &end); | |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
206 | |
| 15412 | 207 | text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end); |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
208 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
209 | if (prpl_info && prpl_info->send_raw != NULL) |
| 15412 | 210 | prpl_info->send_raw(gc, text, strlen(text)); |
| 211 | ||
| 212 | g_free(text); | |
| 213 | gtk_imhtml_clear(GTK_IMHTML(console->entry)); | |
| 214 | } | |
| 215 | ||
| 216 | static void entry_changed_cb(GtkTextBuffer *buffer, void *data) | |
| 217 | { | |
| 218 | char *xmlstr, *str; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
219 | GtkTextIter iter; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
220 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
221 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
222 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
223 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
224 | int pad_top, pad_inside, pad_bottom; |
| 15412 | 225 | GtkTextIter start, end; |
| 226 | xmlnode *node; | |
| 227 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
228 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
229 | gtk_text_buffer_get_start_iter(buffer, &iter); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
230 | gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
231 | while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry), &iter)) |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
232 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
233 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
234 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 235 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
236 | /* Show a maximum of 64 lines */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
237 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
238 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 239 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
240 | pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(console->entry)); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
241 | pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(console->entry)); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
242 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 243 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
244 | height = (oneline.height + pad_top + pad_bottom) * lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
245 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 246 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
247 | gtk_widget_set_size_request(console->sw, -1, height + 6); |
| 15412 | 248 | |
| 249 | gtk_text_buffer_get_start_iter(buffer, &start); | |
| 250 | gtk_text_buffer_get_end_iter(buffer, &end); | |
| 251 | str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); | |
| 252 | if (!str) | |
| 253 | return; | |
| 254 | xmlstr = g_strdup_printf("<xml>%s</xml>", str); | |
| 255 | node = xmlnode_from_str(xmlstr, -1); | |
| 256 | if (node) { | |
| 257 | gtk_imhtml_clear_formatting(GTK_IMHTML(console->entry)); | |
| 258 | } else { | |
| 259 | gtk_imhtml_toggle_background(GTK_IMHTML(console->entry), "#ffcece"); | |
| 260 | } | |
| 261 | g_free(str); | |
| 262 | g_free(xmlstr); | |
| 263 | if (node) | |
| 264 | xmlnode_free(node); | |
| 265 | } | |
| 266 | ||
| 267 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) | |
| 268 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
269 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 270 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 271 | GtkTextIter iter; | |
| 272 | GtkTextBuffer *buffer; | |
| 273 | const char *to; | |
| 274 | int result; | |
| 275 | char *stanza; | |
| 276 | ||
| 277 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 278 | GTK_WINDOW(console->window), | |
| 279 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 280 | GTK_STOCK_CANCEL, | |
| 281 | GTK_RESPONSE_REJECT, | |
| 282 | GTK_STOCK_OK, | |
| 283 | GTK_RESPONSE_ACCEPT, | |
| 284 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
285 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 286 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
287 | #endif |
| 15412 | 288 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 289 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
290 | #if GTK_CHECK_VERSION(2,14,0) |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
291 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
292 | #else |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
293 | vbox = GTK_DIALOG(dialog)->vbox; |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
294 | #endif |
| 15412 | 295 | |
| 296 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
297 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 298 | |
| 299 | label = gtk_label_new("To:"); | |
| 300 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 301 | gtk_size_group_add_widget(sg, label); | |
| 302 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 303 | ||
| 304 | to_entry = gtk_entry_new(); | |
| 305 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 306 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
307 | |
| 15412 | 308 | hbox = gtk_hbox_new(FALSE, 3); |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
309 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 310 | label = gtk_label_new("Type:"); |
| 311 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 312 | ||
| 313 | gtk_size_group_add_widget(sg, label); | |
| 314 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 315 | type_combo = gtk_combo_box_new_text(); | |
| 316 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "get"); | |
| 317 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "set"); | |
| 318 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "result"); | |
| 319 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 320 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 321 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
322 | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
323 | gtk_widget_show_all(vbox); |
| 15412 | 324 | |
| 325 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 326 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 327 | gtk_widget_destroy(dialog); | |
| 328 | return; | |
| 329 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
330 | |
| 15412 | 331 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
| 332 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
333 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'></iq>", |
| 15412 | 334 | to && *to ? "to='" : "", |
| 335 | to && *to ? to : "", | |
| 336 | to && *to ? "'" : "", | |
| 337 | g_random_int(), | |
| 338 | gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
339 | |
| 15412 | 340 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); |
| 341 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 342 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</iq>") - stanza); | |
| 343 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 344 | g_free(stanza); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
345 | |
| 15412 | 346 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
347 | g_object_unref(sg); |
| 15412 | 348 | } |
| 349 | ||
| 350 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 351 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
352 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
353 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
354 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
355 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
356 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
357 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
358 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
359 | GtkWidget *type_combo; |
| 15412 | 360 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 361 | GtkTextIter iter; | |
| 362 | GtkTextBuffer *buffer; | |
| 363 | const char *to, *type, *status, *show, *priority; | |
| 364 | int result; | |
| 365 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
366 | |
| 15412 | 367 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 368 | GTK_WINDOW(console->window), | |
| 369 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 370 | GTK_STOCK_CANCEL, | |
| 371 | GTK_RESPONSE_REJECT, | |
| 372 | GTK_STOCK_OK, | |
| 373 | GTK_RESPONSE_ACCEPT, | |
| 374 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
375 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 376 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
377 | #endif |
| 15412 | 378 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 379 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
380 | #if GTK_CHECK_VERSION(2,14,0) |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
381 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
382 | #else |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
383 | vbox = GTK_DIALOG(dialog)->vbox; |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
384 | #endif |
| 15412 | 385 | |
| 386 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
387 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 388 | |
| 389 | label = gtk_label_new("To:"); | |
| 390 | gtk_size_group_add_widget(sg, label); | |
| 391 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 392 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 393 | ||
| 394 | to_entry = gtk_entry_new(); | |
| 395 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 396 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
397 | |
| 15412 | 398 | hbox = gtk_hbox_new(FALSE, 3); |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
399 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 400 | label = gtk_label_new("Type:"); |
| 401 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 402 | gtk_size_group_add_widget(sg, label); | |
| 403 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 404 | type_combo = gtk_combo_box_new_text(); | |
| 405 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "default"); | |
| 406 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unavailable"); | |
| 407 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribe"); | |
| 408 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribe"); | |
| 409 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribed"); | |
| 410 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribed"); | |
| 411 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "probe"); | |
| 412 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 413 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 414 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 415 | ||
| 416 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
417 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 418 | label = gtk_label_new("Show:"); |
| 419 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 420 | gtk_size_group_add_widget(sg, label); | |
| 421 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 422 | show_combo = gtk_combo_box_new_text(); | |
| 423 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "default"); | |
| 424 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "away"); | |
| 425 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "dnd"); | |
| 426 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "xa"); | |
| 427 | gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "chat"); | |
| 428 | ||
| 429 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 430 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 431 | ||
| 432 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
433 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 434 | |
| 435 | label = gtk_label_new("Status:"); | |
| 436 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 437 | gtk_size_group_add_widget(sg, label); | |
| 438 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 439 | ||
| 440 | status_entry = gtk_entry_new(); | |
| 441 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 442 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 443 | ||
| 444 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
445 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 446 | |
| 447 | label = gtk_label_new("Priority:"); | |
| 448 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 449 | gtk_size_group_add_widget(sg, label); | |
| 450 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 451 | ||
| 452 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 453 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 454 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 455 | ||
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
456 | gtk_widget_show_all(vbox); |
| 15412 | 457 | |
| 458 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 459 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 460 | gtk_widget_destroy(dialog); | |
| 461 | return; | |
| 462 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
463 | |
| 15412 | 464 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
| 465 | type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)); | |
| 466 | if (!strcmp(type, "default")) | |
| 467 | type = ""; | |
| 468 | show = gtk_combo_box_get_active_text(GTK_COMBO_BOX(show_combo)); | |
| 469 | if (!strcmp(show, "default")) | |
| 470 | show = ""; | |
| 471 | status = gtk_entry_get_text(GTK_ENTRY(status_entry)); | |
| 472 | priority = gtk_entry_get_text(GTK_ENTRY(priority_entry)); | |
| 473 | if (!strcmp(priority, "0")) | |
| 474 | priority = ""; | |
| 475 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
476 | stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
477 | "%s%s%s%s%s%s%s%s%s" |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
478 | "</presence>", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
479 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
480 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
481 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
482 | g_random_int(), |
| 15412 | 483 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
484 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
485 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
486 | *type ? "'" : "", |
| 15412 | 487 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
488 | *show ? "<show>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
489 | *show ? show : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
490 | *show ? "</show>" : "", |
| 15412 | 491 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
492 | *status ? "<status>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
493 | *status ? status : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
494 | *status ? "</status>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
495 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
496 | *priority ? "<priority>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
497 | *priority ? priority : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
498 | *priority ? "</priority>" : ""); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
499 | |
| 15412 | 500 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); |
| 501 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 502 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</presence>") - stanza); | |
| 503 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 504 | g_free(stanza); | |
| 505 | ||
| 506 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
507 | g_object_unref(sg); |
| 15412 | 508 | } |
| 509 | ||
| 510 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 511 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
512 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
513 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
514 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
515 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
516 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
517 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
518 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
519 | GtkWidget *type_combo; |
| 15412 | 520 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 521 | GtkTextIter iter; | |
| 522 | GtkTextBuffer *buffer; | |
| 523 | const char *to, *body, *thread, *subject; | |
| 524 | char *stanza; | |
| 525 | int result; | |
| 526 | ||
| 527 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 528 | GTK_WINDOW(console->window), | |
| 529 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 530 | GTK_STOCK_CANCEL, | |
| 531 | GTK_RESPONSE_REJECT, | |
| 532 | GTK_STOCK_OK, | |
| 533 | GTK_RESPONSE_ACCEPT, | |
| 534 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
535 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 536 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
537 | #endif |
| 15412 | 538 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 539 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
540 | #if GTK_CHECK_VERSION(2,14,0) |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
541 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
542 | #else |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
543 | vbox = GTK_DIALOG(dialog)->vbox; |
|
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
544 | #endif |
| 15412 | 545 | |
| 546 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
547 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 548 | |
| 549 | label = gtk_label_new("To:"); | |
| 550 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 551 | gtk_size_group_add_widget(sg, label); | |
| 552 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 553 | ||
| 554 | to_entry = gtk_entry_new(); | |
| 555 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 556 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 557 | ||
| 558 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
559 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 560 | label = gtk_label_new("Type:"); |
| 561 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 562 | gtk_size_group_add_widget(sg, label); | |
| 563 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 564 | type_combo = gtk_combo_box_new_text(); | |
| 565 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "chat"); | |
| 566 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "headline"); | |
| 567 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "groupchat"); | |
| 568 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "normal"); | |
| 569 | gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); | |
| 570 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); | |
| 571 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 572 | ||
| 573 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
574 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 575 | |
| 576 | label = gtk_label_new("Body:"); | |
| 577 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 578 | gtk_size_group_add_widget(sg, label); | |
| 579 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 580 | ||
| 581 | body_entry = gtk_entry_new(); | |
| 582 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 583 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 584 | ||
| 585 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
586 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 587 | |
| 588 | label = gtk_label_new("Subject:"); | |
| 589 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 590 | gtk_size_group_add_widget(sg, label); | |
| 591 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 592 | ||
| 593 | subject_entry = gtk_entry_new(); | |
| 594 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 595 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 596 | ||
| 597 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
598 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 599 | |
| 600 | label = gtk_label_new("Thread:"); | |
| 601 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 602 | gtk_size_group_add_widget(sg, label); | |
| 603 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 604 | ||
| 605 | thread_entry = gtk_entry_new(); | |
| 606 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 607 | gtk_box_pack_start(GTK_BOX(hbox), thread_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
608 | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
609 | gtk_widget_show_all(vbox); |
| 15412 | 610 | |
| 611 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 612 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 613 | gtk_widget_destroy(dialog); | |
| 614 | return; | |
| 615 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
616 | |
| 15412 | 617 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
| 618 | body = gtk_entry_get_text(GTK_ENTRY(body_entry)); | |
| 619 | thread = gtk_entry_get_text(GTK_ENTRY(thread_entry)); | |
| 620 | subject = gtk_entry_get_text(GTK_ENTRY(subject_entry)); | |
| 621 | ||
| 622 | stanza = g_strdup_printf("<message %s%s%s id='console%x' type='%s'>" | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
623 | "%s%s%s%s%s%s%s%s%s" |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
624 | "</message>", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
625 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
626 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
627 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
628 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
629 | g_random_int(), |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
630 | gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)), |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
631 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
632 | *body ? "<body>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
633 | *body ? body : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
634 | *body ? "</body>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
635 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
636 | *subject ? "<subject>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
637 | *subject ? subject : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
638 | *subject ? "</subject>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
639 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
640 | *thread ? "<thread>" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
641 | *thread ? thread : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
642 | *thread ? "</thread>" : ""); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
643 | |
| 15412 | 644 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); |
| 645 | gtk_text_buffer_set_text(buffer, stanza, -1); | |
| 646 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "</message>") - stanza); | |
| 647 | gtk_text_buffer_place_cursor(buffer, &iter); | |
| 648 | g_free(stanza); | |
| 649 | ||
| 650 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
651 | g_object_unref(sg); |
| 15412 | 652 | } |
| 653 | ||
| 654 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
655 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 656 | { |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
657 | PurpleAccount *account; |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
658 | |
| 15412 | 659 | if (!console) |
| 660 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
661 | |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
662 | account = purple_connection_get_account(gc); |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
663 | if (strcmp(purple_account_get_protocol_id(account), "prpl-jabber")) |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
664 | return; |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
665 | |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
666 | gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(account)); |
| 15412 | 667 | console->accounts = g_list_append(console->accounts, gc); |
| 668 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
669 | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
670 | if (console->count == 1) { |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
671 | console->gc = gc; |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
672 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
673 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
674 | } else |
| 15412 | 675 | gtk_widget_show_all(console->hbox); |
| 676 | } | |
| 677 | ||
| 678 | static void | |
| 15884 | 679 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 680 | { |
| 681 | int i = 0; | |
| 682 | GList *l; | |
| 683 | ||
| 684 | if (!console) | |
| 685 | return; | |
| 686 | ||
| 687 | l = console->accounts; | |
| 688 | while (l) { | |
| 15884 | 689 | PurpleConnection *g = l->data; |
| 15412 | 690 | if (gc == g) |
| 691 | break; | |
| 692 | i++; | |
| 693 | l = l->next; | |
| 694 | } | |
| 695 | ||
| 696 | if (l == NULL) | |
| 697 | return; | |
| 698 | ||
| 699 | gtk_combo_box_remove_text(GTK_COMBO_BOX(console->dropdown), i); | |
| 700 | console->accounts = g_list_remove(console->accounts, gc); | |
| 701 | console->count--; | |
| 702 | ||
| 703 | if (gc == console->gc) { | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
704 | char *tmp = g_strdup_printf("<div class=info>%s</div>", |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
705 | _("Logged out.")); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
706 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
707 | g_free(tmp); |
| 15412 | 708 | console->gc = NULL; |
| 709 | } | |
| 710 | } | |
| 711 | ||
| 712 | static gboolean | |
| 15884 | 713 | plugin_load(PurplePlugin *plugin) |
| 15412 | 714 | { |
| 15884 | 715 | PurplePlugin *jabber; |
| 15412 | 716 | |
| 15884 | 717 | jabber = purple_find_prpl("prpl-jabber"); |
| 15412 | 718 | if (!jabber) |
| 719 | return FALSE; | |
| 720 | ||
| 721 | xmpp_console_handle = plugin; | |
| 15884 | 722 | purple_signal_connect(jabber, "jabber-receiving-xmlnode", xmpp_console_handle, |
| 723 | PURPLE_CALLBACK(xmlnode_received_cb), NULL); | |
| 724 | purple_signal_connect(jabber, "jabber-sending-text", xmpp_console_handle, | |
| 725 | PURPLE_CALLBACK(xmlnode_sent_cb), NULL); | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
726 | purple_signal_connect(purple_connections_get_handle(), "signing-on", |
|
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
727 | plugin, PURPLE_CALLBACK(signing_on_cb), NULL); |
| 15884 | 728 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 729 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
730 | |
| 15412 | 731 | return TRUE; |
| 732 | } | |
| 733 | ||
| 734 | static gboolean | |
| 15884 | 735 | plugin_unload(PurplePlugin *plugin) |
| 15412 | 736 | { |
| 15414 | 737 | if (console) |
| 738 | gtk_widget_destroy(console->window); | |
| 15412 | 739 | return TRUE; |
| 740 | } | |
| 741 | ||
| 742 | static void | |
| 743 | console_destroy(GtkObject *window, gpointer nul) | |
| 744 | { | |
| 745 | g_list_free(console->accounts); | |
| 746 | g_free(console); | |
| 747 | console = NULL; | |
| 748 | } | |
| 749 | ||
| 750 | static void | |
| 751 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 752 | { | |
| 15884 | 753 | PurpleAccount *account; |
| 15412 | 754 | |
| 755 | if (!console) | |
| 756 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
757 | |
|
32997
39bfe55ac9f4
No need to search for accounts when we already have a list of them.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32996
diff
changeset
|
758 | console->gc = g_list_nth_data(console->accounts, gtk_combo_box_get_active(GTK_COMBO_BOX(console->dropdown))); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
759 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
| 15412 | 760 | } |
| 761 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
762 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
763 | create_console(PurplePluginAction *action) |
| 15412 | 764 | { |
| 765 | GtkWidget *vbox = gtk_vbox_new(FALSE, 6); | |
| 766 | GtkWidget *label; | |
| 767 | GtkTextBuffer *buffer; | |
| 768 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
769 | GList *connections; |
| 15412 | 770 | GtkToolItem *button; |
| 771 | ||
| 772 | if (console) { | |
| 773 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 774 | return; | |
| 775 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
776 | |
| 15412 | 777 | console = g_new0(XmppConsole, 1); |
| 778 | ||
| 17213 | 779 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 780 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 781 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 782 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 783 | ||
| 784 | console->hbox = gtk_hbox_new(FALSE, 3); | |
| 785 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); | |
| 786 | label = gtk_label_new(_("Account: ")); | |
| 787 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | |
| 788 | gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); | |
| 789 | console->dropdown = gtk_combo_box_new_text(); | |
| 15884 | 790 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 791 | PurpleConnection *gc = connections->data; | |
| 792 | if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), "prpl-jabber")) { | |
| 15412 | 793 | console->count++; |
| 794 | console->accounts = g_list_append(console->accounts, gc); | |
| 795 | gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), | |
| 15884 | 796 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 797 | if (!console->gc) |
| 798 | console->gc = gc; | |
| 799 | } | |
| 800 | } | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
801 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 802 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 803 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 804 | ||
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
805 | console->webview = gtk_webview_new(); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
806 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
807 | if (console->count == 0) { |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
808 | char *tmp = g_strdup_printf("<div class=info>%s</div>", |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
809 | _("Not connected to XMPP")); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
810 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
811 | g_free(tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
812 | } |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
813 | gtk_box_pack_start(GTK_BOX(vbox), |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
814 | pidgin_make_scrollable(console->webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
815 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
816 | |
| 15412 | 817 | toolbar = gtk_toolbar_new(); |
| 818 | button = gtk_tool_button_new(NULL, "<iq/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
819 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 820 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 821 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 822 | ||
| 823 | button = gtk_tool_button_new(NULL, "<presence/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
824 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 825 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 826 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 827 | ||
| 828 | button = gtk_tool_button_new(NULL, "<message/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
829 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 830 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 831 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
832 | |
| 15412 | 833 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
834 | |
| 15412 | 835 | console->entry = gtk_imhtml_new(NULL, NULL); |
| 836 | gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(console->entry), TRUE); | |
| 837 | g_signal_connect(G_OBJECT(console->entry),"message_send", G_CALLBACK(message_send_cb), console); | |
| 838 | ||
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
839 | console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
840 | gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
| 15412 | 841 | gtk_imhtml_set_editable(GTK_IMHTML(console->entry), TRUE); |
| 842 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); | |
| 843 | g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(entry_changed_cb), NULL); | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
844 | |
| 15412 | 845 | entry_changed_cb(buffer, NULL); |
| 846 | ||
| 847 | gtk_widget_show_all(console->window); | |
| 848 | if (console->count < 2) | |
| 849 | gtk_widget_hide(console->hbox); | |
| 850 | } | |
| 851 | ||
| 852 | static GList * | |
| 15884 | 853 | actions(PurplePlugin *plugin, gpointer context) |
| 15412 | 854 | { |
| 855 | GList *l = NULL; | |
| 15884 | 856 | PurplePluginAction *act = NULL; |
| 15412 | 857 | |
| 15884 | 858 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 859 | l = g_list_append(l, act); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
860 | |
| 15412 | 861 | return l; |
| 862 | } | |
| 863 | ||
| 864 | ||
| 15884 | 865 | static PurplePluginInfo info = |
| 15412 | 866 | { |
| 15884 | 867 | PURPLE_PLUGIN_MAGIC, |
| 868 | PURPLE_MAJOR_VERSION, | |
| 869 | PURPLE_MINOR_VERSION, | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
870 | PURPLE_PLUGIN_STANDARD, /**< type */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
871 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
872 | 0, /**< flags */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
873 | NULL, /**< dependencies */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
874 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 15412 | 875 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
876 | "gtk-xmpp", /**< id */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
877 | N_("XMPP Console"), /**< name */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
878 | DISPLAY_VERSION, /**< version */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
879 | /** summary */ |
| 15412 | 880 | N_("Send and receive raw XMPP stanzas."), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
881 | /** description */ |
|
29876
f233c73823f2
I don't think 'debug' spouts an extra 'b' when adding the '-ing'.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29783
diff
changeset
|
882 | N_("This plugin is useful for debugging XMPP servers or clients."), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
883 | "Sean Egan <seanegan@gmail.com>", /**< author */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
884 | PURPLE_WEBSITE, /**< homepage */ |
| 15412 | 885 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
886 | plugin_load, /**< load */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
887 | plugin_unload, /**< unload */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
888 | NULL, /**< destroy */ |
| 15412 | 889 | |
| 890 | NULL, /**< ui_info */ | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
891 | NULL, /**< extra_info */ |
| 15412 | 892 | NULL, |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
893 | actions, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
894 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
895 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
896 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
897 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
898 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
899 | NULL |
| 15412 | 900 | }; |
| 901 | ||
| 902 | static void | |
| 15884 | 903 | init_plugin(PurplePlugin *plugin) |
| 15412 | 904 | { |
| 905 | } | |
| 906 | ||
|
25625
52d3e1e45ebf
albertz noticed the XMPP Console was identifying itself as interval. Hooray
Paul Aurich <darkrain42@pidgin.im>
parents:
22108
diff
changeset
|
907 | PURPLE_INIT_PLUGIN(xmppconsole, init_plugin, info) |