Fri, 31 Jan 2014 20:17:02 +0530
Merged gtkdoc-conversion
| 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" | |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
25 | #include "protocol.h" |
| 15412 | 26 | #include "xmlnode.h" |
| 27 | ||
|
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
|
28 | #include "gtkwebview.h" |
| 17242 | 29 | #include "gtkutils.h" |
| 15412 | 30 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
31 | #include <gdk/gdkkeysyms.h> |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
32 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
33 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
34 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
35 | #define PLUGIN_ID "gtk-xmpp" |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
36 | #define PLUGIN_DOMAIN (g_quark_from_static_string(PLUGIN_ID)) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
37 | |
| 15412 | 38 | typedef struct { |
| 15884 | 39 | PurpleConnection *gc; |
| 15412 | 40 | GtkWidget *window; |
| 41 | GtkWidget *hbox; | |
| 42 | 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
|
43 | GtkWidget *webview; |
| 15412 | 44 | GtkWidget *entry; |
| 45 | GtkWidget *sw; | |
| 46 | int count; | |
| 47 | GList *accounts; | |
| 48 | } XmppConsole; | |
| 49 | ||
| 50 | XmppConsole *console = NULL; | |
| 51 | static void *xmpp_console_handle = NULL; | |
| 52 | ||
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
53 | static const gchar *xmpp_prpls[] = { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
54 | "prpl-jabber", "prpl-gtalk", "prpl-facebook-xmpp", NULL |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
55 | }; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
56 | |
|
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
|
57 | #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
|
58 | "<html><head><style type='text/css'>" \ |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
59 | "body { word-wrap: break-word; margin: 0; }" \ |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
60 | "div.tab { padding-left: 1em; }" \ |
|
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
|
61 | "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
|
62 | "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
|
63 | "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
|
64 | "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
|
65 | "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
|
66 | "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
|
67 | "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
|
68 | "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
|
69 | "</style></head></html>" |
| 15412 | 70 | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
71 | static gboolean |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
72 | xmppconsole_is_xmpp_account(PurpleAccount *account) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
73 | { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
74 | const gchar *prpl_name; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
75 | int i; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
76 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
77 | prpl_name = purple_account_get_protocol_id(account); |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
78 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
79 | i = 0; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
80 | while (xmpp_prpls[i] != NULL) { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
81 | if (g_strcmp0(xmpp_prpls[i], prpl_name) == 0) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
82 | return TRUE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
83 | i++; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
84 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
85 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
86 | return FALSE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
87 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
88 | |
| 15412 | 89 | static char * |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
90 | purple_xmlnode_to_pretty_str(PurpleXmlNode *node, int *len) |
| 15412 | 91 | { |
| 92 | GString *text = g_string_new(""); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
93 | PurpleXmlNode *c; |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
94 | char *node_name, *esc, *esc2; |
| 15412 | 95 | gboolean need_end = FALSE, pretty = TRUE; |
| 96 | ||
| 97 | g_return_val_if_fail(node != NULL, NULL); | |
| 98 | ||
| 99 | 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
|
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=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
|
102 | "<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
|
103 | node_name); |
| 15412 | 104 | |
| 105 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
106 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
107 | !node->parent->xmlns || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
108 | 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
|
109 | strcmp(node->xmlns, "jabber:client")) |
| 15412 | 110 | { |
| 111 | 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
|
112 | 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
|
113 | " <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
|
114 | "'<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
|
115 | xmlns); |
| 15412 | 116 | g_free(xmlns); |
| 117 | } | |
| 118 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
119 | for (c = node->child; c; c = c->next) |
| 15412 | 120 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
121 | if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { |
| 15412 | 122 | esc = g_markup_escape_text(c->name, -1); |
| 123 | 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
|
124 | 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
|
125 | " <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
|
126 | "'<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
|
127 | esc, esc2); |
| 15412 | 128 | g_free(esc); |
| 129 | g_free(esc2); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
130 | } else if (c->type == PURPLE_XMLNODE_TYPE_TAG || c->type == PURPLE_XMLNODE_TYPE_DATA) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
131 | if (c->type == PURPLE_XMLNODE_TYPE_DATA) |
| 15412 | 132 | pretty = FALSE; |
| 133 | need_end = TRUE; | |
| 134 | } | |
| 135 | } | |
| 136 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
137 | if (need_end) { |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
138 | 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
|
139 | "<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
|
140 | pretty ? "<br>" : ""); |
| 15412 | 141 | |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
142 | need_end = FALSE; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
143 | for (c = node->child; c; c = c->next) |
| 15412 | 144 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
145 | if (c->type == PURPLE_XMLNODE_TYPE_TAG) { |
| 15412 | 146 | int esc_len; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
147 | esc = purple_xmlnode_to_pretty_str(c, &esc_len); |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
148 | if (!need_end) { |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
149 | g_string_append(text, "<div class=tab>"); |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
150 | need_end = TRUE; |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
151 | } |
| 15412 | 152 | text = g_string_append_len(text, esc, esc_len); |
| 153 | g_free(esc); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
154 | } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { |
| 15412 | 155 | esc = g_markup_escape_text(c->data, c->data_sz); |
| 156 | text = g_string_append(text, esc); | |
| 157 | g_free(esc); | |
| 158 | } | |
| 159 | } | |
| 160 | ||
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
161 | if (need_end) |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
162 | g_string_append(text, "</div>"); |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
163 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
164 | 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
|
165 | "<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
|
166 | "<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
|
167 | "<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
|
168 | node_name); |
| 15412 | 169 | } else { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
170 | 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
|
171 | "/<span class=bracket>></span><br>"); |
| 15412 | 172 | } |
| 173 | ||
| 174 | g_free(node_name); | |
| 175 | ||
|
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
|
176 | if (len) |
| 15412 | 177 | *len = text->len; |
| 178 | ||
| 179 | return g_string_free(text, FALSE); | |
| 180 | } | |
| 181 | ||
| 182 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
183 | purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) |
| 15412 | 184 | { |
| 185 | char *str, *formatted; | |
| 186 | ||
| 187 | if (!console || console->gc != gc) | |
| 188 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
189 | str = purple_xmlnode_to_pretty_str(*packet, NULL); |
|
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
|
190 | 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
|
191 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 192 | g_free(formatted); |
| 193 | g_free(str); | |
| 194 | } | |
| 195 | ||
| 196 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
197 | purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 198 | { |
| 199 | char *str; | |
| 200 | char *formatted; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
201 | PurpleXmlNode *node; |
| 15412 | 202 | |
| 203 | if (!console || console->gc != gc) | |
| 204 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
205 | node = purple_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
|
206 | |
| 15412 | 207 | if (!node) |
| 208 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
209 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
210 | str = purple_xmlnode_to_pretty_str(node, NULL); |
|
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
|
211 | 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
|
212 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 213 | g_free(formatted); |
| 214 | g_free(str); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
215 | purple_xmlnode_free(node); |
| 15412 | 216 | } |
| 217 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
218 | static gboolean |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
219 | message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 15412 | 220 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
221 | PurpleProtocol *protocol = 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
|
222 | PurpleConnection *gc; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
223 | gchar *text; |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
224 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
225 | if (event->keyval != GDK_KEY_KP_Enter && event->keyval != GDK_KEY_Return) |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
226 | return FALSE; |
| 15412 | 227 | |
| 228 | 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
|
229 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
230 | if (gc) |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
231 | protocol = purple_connection_get_protocol(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
|
232 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
233 | text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); |
|
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
|
234 | |
|
36633
2dcb81a189bd
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
235 | if (protocol) |
| 36719 | 236 | purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
| 15412 | 237 | |
| 238 | g_free(text); | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
239 | gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
240 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
241 | return TRUE; |
| 15412 | 242 | } |
| 243 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
244 | static void |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
245 | entry_changed_cb(GtkWidget *webview, void *data) |
| 15412 | 246 | { |
| 247 | char *xmlstr, *str; | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
248 | #if 0 |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
249 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
250 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
251 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
252 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
253 | int pad_top, pad_inside, pad_bottom; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
254 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
255 | PurpleXmlNode *node; |
| 15412 | 256 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
257 | #if 0 |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
258 | /* TODO WebKit: Do entry auto-sizing... */ |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
259 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
260 | 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
|
261 | 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
|
262 | 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
|
263 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
264 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
265 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 266 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
267 | /* 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
|
268 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
269 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 270 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
271 | 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
|
272 | 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
|
273 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 274 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
275 | 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
|
276 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 277 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
278 | gtk_widget_set_size_request(console->sw, -1, height + 6); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
279 | #endif |
| 15412 | 280 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
281 | str = gtk_webview_get_body_text(GTK_WEBVIEW(webview)); |
| 15412 | 282 | if (!str) |
| 283 | return; | |
| 284 | xmlstr = g_strdup_printf("<xml>%s</xml>", str); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
285 | node = purple_xmlnode_from_str(xmlstr, -1); |
| 15412 | 286 | if (node) { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
287 | gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); |
| 15412 | 288 | } else { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
289 | gtk_webview_toggle_backcolor(GTK_WEBVIEW(console->entry), "#ffcece"); |
| 15412 | 290 | } |
| 291 | g_free(str); | |
| 292 | g_free(xmlstr); | |
| 293 | if (node) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
294 | purple_xmlnode_free(node); |
| 15412 | 295 | } |
| 296 | ||
| 297 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) | |
| 298 | { | |
|
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
|
299 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 300 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
301 | char *to; |
| 15412 | 302 | int result; |
| 303 | char *stanza; | |
| 304 | ||
| 305 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 306 | GTK_WINDOW(console->window), | |
| 307 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 308 | GTK_STOCK_CANCEL, | |
| 309 | GTK_RESPONSE_REJECT, | |
| 310 | GTK_STOCK_OK, | |
| 311 | GTK_RESPONSE_ACCEPT, | |
| 312 | 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
|
313 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 314 | 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
|
315 | #endif |
| 15412 | 316 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 317 | 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
|
318 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 319 | |
| 320 | 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
|
321 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 322 | |
| 323 | label = gtk_label_new("To:"); | |
| 324 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 325 | gtk_size_group_add_widget(sg, label); | |
| 326 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 327 | ||
| 328 | to_entry = gtk_entry_new(); | |
| 329 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 330 | 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
|
331 | |
| 15412 | 332 | 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
|
333 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 334 | label = gtk_label_new("Type:"); |
| 335 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 336 | ||
| 337 | gtk_size_group_add_widget(sg, label); | |
| 338 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
339 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
340 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "get"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
341 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "set"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
342 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "result"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
343 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 344 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 345 | 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
|
346 | |
|
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
|
347 | gtk_widget_show_all(vbox); |
| 15412 | 348 | |
| 349 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 350 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 351 | gtk_widget_destroy(dialog); | |
| 352 | return; | |
| 353 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
354 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
355 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
| 15412 | 356 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
357 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
358 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
359 | "</iq>", |
| 15412 | 360 | to && *to ? "to='" : "", |
| 361 | to && *to ? to : "", | |
| 362 | to && *to ? "'" : "", | |
| 363 | g_random_int(), | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
364 | gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
365 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
366 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
367 | gtk_widget_grab_focus(console->entry); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
368 | g_free(to); |
| 15412 | 369 | g_free(stanza); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
370 | |
| 15412 | 371 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
372 | g_object_unref(sg); |
| 15412 | 373 | } |
| 374 | ||
| 375 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 376 | { | |
|
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
|
377 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
378 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
379 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
380 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
381 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
382 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
383 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
384 | GtkWidget *type_combo; |
| 15412 | 385 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
386 | char *to, *status, *priority; |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
387 | const char *type, *show; |
| 15412 | 388 | int result; |
| 389 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
390 | |
| 15412 | 391 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 392 | GTK_WINDOW(console->window), | |
| 393 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 394 | GTK_STOCK_CANCEL, | |
| 395 | GTK_RESPONSE_REJECT, | |
| 396 | GTK_STOCK_OK, | |
| 397 | GTK_RESPONSE_ACCEPT, | |
| 398 | 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
|
399 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 400 | 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
|
401 | #endif |
| 15412 | 402 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 403 | 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
|
404 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 405 | |
| 406 | 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
|
407 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 408 | |
| 409 | label = gtk_label_new("To:"); | |
| 410 | gtk_size_group_add_widget(sg, label); | |
| 411 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 412 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 413 | ||
| 414 | to_entry = gtk_entry_new(); | |
| 415 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 416 | 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
|
417 | |
| 15412 | 418 | 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
|
419 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 420 | label = gtk_label_new("Type:"); |
| 421 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 422 | gtk_size_group_add_widget(sg, label); | |
| 423 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
424 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
425 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "default"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
426 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unavailable"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
427 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
428 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
429 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribed"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
430 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribed"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
431 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "probe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
432 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 433 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 434 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 435 | ||
| 436 | 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
|
437 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 438 | label = gtk_label_new("Show:"); |
| 439 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 440 | gtk_size_group_add_widget(sg, label); | |
| 441 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
442 | show_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
443 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "default"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
444 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "away"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
445 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "dnd"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
446 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "xa"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
447 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); |
| 15412 | 448 | |
| 449 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 450 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 451 | ||
| 452 | 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
|
453 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 454 | |
| 455 | label = gtk_label_new("Status:"); | |
| 456 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 457 | gtk_size_group_add_widget(sg, label); | |
| 458 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 459 | ||
| 460 | status_entry = gtk_entry_new(); | |
| 461 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 462 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 463 | ||
| 464 | 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
|
465 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 466 | |
| 467 | label = gtk_label_new("Priority:"); | |
| 468 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 469 | gtk_size_group_add_widget(sg, label); | |
| 470 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 471 | ||
| 472 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 473 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 474 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 475 | ||
|
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
|
476 | gtk_widget_show_all(vbox); |
| 15412 | 477 | |
| 478 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 479 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 480 | gtk_widget_destroy(dialog); | |
| 481 | return; | |
| 482 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
483 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
484 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
485 | type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); |
| 15412 | 486 | if (!strcmp(type, "default")) |
| 487 | type = ""; | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
488 | show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); |
| 15412 | 489 | if (!strcmp(show, "default")) |
| 490 | show = ""; | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
491 | status = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(status_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
492 | priority = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(priority_entry)), -1); |
| 15412 | 493 | if (!strcmp(priority, "0")) |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
494 | *priority = '\0'; |
| 15412 | 495 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
496 | stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
497 | "%s%s%s%s%s%s%s%s%s" |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
498 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
499 | "</presence>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
500 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
501 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
502 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
503 | g_random_int(), |
| 15412 | 504 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
505 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
506 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
507 | *type ? "'" : "", |
| 15412 | 508 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
509 | *show ? "<show>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
510 | *show ? show : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
511 | *show ? "</show>" : "", |
| 15412 | 512 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
513 | *status ? "<status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
514 | *status ? status : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
515 | *status ? "</status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
516 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
517 | *priority ? "<priority>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
518 | *priority ? priority : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
519 | *priority ? "</priority>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
520 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
521 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
522 | gtk_widget_grab_focus(console->entry); |
| 15412 | 523 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
524 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
525 | g_free(status); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
526 | g_free(priority); |
| 15412 | 527 | |
| 528 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
529 | g_object_unref(sg); |
| 15412 | 530 | } |
| 531 | ||
| 532 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 533 | { | |
|
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
|
534 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
535 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
536 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
537 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
538 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
539 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
540 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
541 | GtkWidget *type_combo; |
| 15412 | 542 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
543 | char *to, *body, *thread, *subject; |
| 15412 | 544 | char *stanza; |
| 545 | int result; | |
| 546 | ||
| 547 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 548 | GTK_WINDOW(console->window), | |
| 549 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 550 | GTK_STOCK_CANCEL, | |
| 551 | GTK_RESPONSE_REJECT, | |
| 552 | GTK_STOCK_OK, | |
| 553 | GTK_RESPONSE_ACCEPT, | |
| 554 | 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
|
555 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 556 | 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
|
557 | #endif |
| 15412 | 558 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 559 | 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
|
560 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 561 | |
| 562 | 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
|
563 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 564 | |
| 565 | label = gtk_label_new("To:"); | |
| 566 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 567 | gtk_size_group_add_widget(sg, label); | |
| 568 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 569 | ||
| 570 | to_entry = gtk_entry_new(); | |
| 571 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 572 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 573 | ||
| 574 | 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
|
575 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 576 | label = gtk_label_new("Type:"); |
| 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); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
580 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
581 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "chat"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
582 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "headline"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
583 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "groupchat"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
584 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "normal"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
585 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 586 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 587 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 588 | ||
| 589 | 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
|
590 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 591 | |
| 592 | label = gtk_label_new("Body:"); | |
| 593 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 594 | gtk_size_group_add_widget(sg, label); | |
| 595 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 596 | ||
| 597 | body_entry = gtk_entry_new(); | |
| 598 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 599 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 600 | ||
| 601 | 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
|
602 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 603 | |
| 604 | label = gtk_label_new("Subject:"); | |
| 605 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 606 | gtk_size_group_add_widget(sg, label); | |
| 607 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 608 | ||
| 609 | subject_entry = gtk_entry_new(); | |
| 610 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 611 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 612 | ||
| 613 | 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
|
614 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 615 | |
| 616 | label = gtk_label_new("Thread:"); | |
| 617 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 618 | gtk_size_group_add_widget(sg, label); | |
| 619 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 620 | ||
| 621 | thread_entry = gtk_entry_new(); | |
| 622 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 623 | 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
|
624 | |
|
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
|
625 | gtk_widget_show_all(vbox); |
| 15412 | 626 | |
| 627 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 628 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 629 | gtk_widget_destroy(dialog); | |
| 630 | return; | |
| 631 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
632 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
633 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
634 | body = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(body_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
635 | thread = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(thread_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
636 | subject = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(subject_entry)), -1); |
| 15412 | 637 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
638 | 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
|
639 | "%s%s%s%s%s%s%s%s%s" |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
640 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
641 | "</message>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
642 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
643 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
644 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
645 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
646 | g_random_int(), |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
647 | gtk_combo_box_text_get_active_text( |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
648 | GTK_COMBO_BOX_TEXT(type_combo)), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
649 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
650 | *body ? "<body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
651 | *body ? body : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
652 | *body ? "</body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
653 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
654 | *subject ? "<subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
655 | *subject ? subject : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
656 | *subject ? "</subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
657 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
658 | *thread ? "<thread>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
659 | *thread ? thread : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
660 | *thread ? "</thread>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
661 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
662 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
663 | gtk_widget_grab_focus(console->entry); |
| 15412 | 664 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
665 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
666 | g_free(body); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
667 | g_free(thread); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
668 | g_free(subject); |
| 15412 | 669 | |
| 670 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
671 | g_object_unref(sg); |
| 15412 | 672 | } |
| 673 | ||
| 674 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
675 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 676 | { |
|
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
|
677 | 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
|
678 | |
| 15412 | 679 | if (!console) |
| 680 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
681 | |
|
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
|
682 | account = purple_connection_get_account(gc); |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
683 | if (!xmppconsole_is_xmpp_account(account)) |
|
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
|
684 | 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
|
685 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
686 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
|
33146
1f729ff8cab4
propagate from branch 'im.pidgin.pidgin' (head 83f9edc4c976eefa029bc8591603c404e7c6a53a)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
687 | purple_account_get_username(account)); |
| 15412 | 688 | console->accounts = g_list_append(console->accounts, gc); |
| 689 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
690 | |
|
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
|
691 | 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
|
692 | 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
|
693 | 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
|
694 | 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
|
695 | } else |
| 15412 | 696 | gtk_widget_show_all(console->hbox); |
| 697 | } | |
| 698 | ||
| 699 | static void | |
| 15884 | 700 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 701 | { |
| 702 | int i = 0; | |
| 703 | GList *l; | |
| 704 | ||
| 705 | if (!console) | |
| 706 | return; | |
| 707 | ||
| 708 | l = console->accounts; | |
| 709 | while (l) { | |
| 15884 | 710 | PurpleConnection *g = l->data; |
| 15412 | 711 | if (gc == g) |
| 712 | break; | |
| 713 | i++; | |
| 714 | l = l->next; | |
| 715 | } | |
| 716 | ||
| 717 | if (l == NULL) | |
| 718 | return; | |
| 719 | ||
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
720 | gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); |
| 15412 | 721 | console->accounts = g_list_remove(console->accounts, gc); |
| 722 | console->count--; | |
| 723 | ||
| 724 | 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
|
725 | 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
|
726 | _("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
|
727 | 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
|
728 | g_free(tmp); |
| 15412 | 729 | console->gc = NULL; |
| 730 | } | |
| 731 | } | |
| 732 | ||
| 733 | static void | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
734 | console_destroy(GtkWidget *window, gpointer nul) |
| 15412 | 735 | { |
| 736 | g_list_free(console->accounts); | |
| 737 | g_free(console); | |
| 738 | console = NULL; | |
| 739 | } | |
| 740 | ||
| 741 | static void | |
| 742 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 743 | { | |
| 744 | if (!console) | |
| 745 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
746 | |
|
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
|
747 | 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
|
748 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
| 15412 | 749 | } |
| 750 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
751 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
752 | create_console(PurplePluginAction *action) |
| 15412 | 753 | { |
| 754 | GtkWidget *vbox = gtk_vbox_new(FALSE, 6); | |
| 755 | GtkWidget *label; | |
| 756 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
757 | GList *connections; |
| 15412 | 758 | GtkToolItem *button; |
| 759 | ||
| 760 | if (console) { | |
| 761 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 762 | return; | |
| 763 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
764 | |
| 15412 | 765 | console = g_new0(XmppConsole, 1); |
| 766 | ||
| 17213 | 767 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 768 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 769 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 770 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 771 | ||
| 772 | console->hbox = gtk_hbox_new(FALSE, 3); | |
| 773 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); | |
| 774 | label = gtk_label_new(_("Account: ")); | |
| 775 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | |
| 776 | gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
777 | console->dropdown = gtk_combo_box_text_new(); |
| 15884 | 778 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 779 | PurpleConnection *gc = connections->data; | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
780 | if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) { |
| 15412 | 781 | console->count++; |
| 782 | console->accounts = g_list_append(console->accounts, gc); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
783 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
| 15884 | 784 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 785 | if (!console->gc) |
| 786 | console->gc = gc; | |
| 787 | } | |
| 788 | } | |
|
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
|
789 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 790 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 791 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 792 | ||
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
793 | console->webview = gtk_webview_new(FALSE); |
|
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
|
794 | 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
|
795 | 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
|
796 | 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
|
797 | _("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
|
798 | 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
|
799 | 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
|
800 | } |
|
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
|
801 | 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
|
802 | 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
|
803 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
804 | |
| 15412 | 805 | toolbar = gtk_toolbar_new(); |
| 806 | 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
|
807 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 808 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 809 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 810 | ||
| 811 | 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
|
812 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 813 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 814 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 815 | ||
| 816 | 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
|
817 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 818 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 819 | 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
|
820 | |
| 15412 | 821 | 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
|
822 | |
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
823 | console->entry = gtk_webview_new(TRUE); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
824 | gtk_webview_set_whole_buffer_formatting_only(GTK_WEBVIEW(console->entry), TRUE); |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
825 | g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 15412 | 826 | |
|
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
|
827 | 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
|
828 | gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
829 | g_signal_connect(G_OBJECT(console->entry), "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
|
830 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
831 | entry_changed_cb(console->entry, NULL); |
| 15412 | 832 | |
| 833 | gtk_widget_show_all(console->window); | |
| 834 | if (console->count < 2) | |
| 835 | gtk_widget_hide(console->hbox); | |
| 836 | } | |
| 837 | ||
| 838 | static GList * | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
839 | actions(PurplePlugin *plugin) |
| 15412 | 840 | { |
| 841 | GList *l = NULL; | |
| 15884 | 842 | PurplePluginAction *act = NULL; |
| 15412 | 843 | |
| 15884 | 844 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 845 | 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
|
846 | |
| 15412 | 847 | return l; |
| 848 | } | |
| 849 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
850 | static PidginPluginInfo * |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
851 | plugin_query(GError **error) |
| 15412 | 852 | { |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
853 | const gchar * const authors[] = { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
854 | "Sean Egan <seanegan@gmail.com>", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
855 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
856 | }; |
| 15412 | 857 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
858 | return pidgin_plugin_info_new( |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
859 | "id", PLUGIN_ID, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
860 | "name", N_("XMPP Console"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
861 | "version", DISPLAY_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
862 | "category", N_("Protocol utility"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
863 | "summary", N_("Send and receive raw XMPP stanzas."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
864 | "description", N_("This plugin is useful for debugging XMPP servers " |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
865 | "or clients."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
866 | "authors", authors, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
867 | "website", PURPLE_WEBSITE, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
868 | "abi-version", PURPLE_ABI_VERSION, |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36758
diff
changeset
|
869 | "actions-cb", actions, |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
870 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
871 | ); |
| 15412 | 872 | } |
| 873 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
874 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
875 | plugin_load(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
876 | { |
| 37041 | 877 | int i; |
| 878 | gboolean any_registered = FALSE; | |
| 879 | ||
| 880 | xmpp_console_handle = plugin; | |
| 881 | ||
| 882 | i = 0; | |
| 883 | while (xmpp_prpls[i] != NULL) { | |
| 884 | PurpleProtocol *xmpp; | |
| 885 | ||
| 886 | xmpp = purple_protocols_find(xmpp_prpls[i]); | |
| 887 | i++; | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
888 | |
| 37041 | 889 | if (!xmpp) |
| 890 | continue; | |
| 891 | any_registered = TRUE; | |
| 892 | ||
| 893 | purple_signal_connect(xmpp, "jabber-receiving-xmlnode", | |
| 894 | xmpp_console_handle, | |
| 895 | PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); | |
| 896 | purple_signal_connect(xmpp, "jabber-sending-text", | |
| 897 | xmpp_console_handle, | |
| 898 | PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); | |
| 899 | } | |
| 900 | ||
| 901 | if (!any_registered) { | |
| 902 | g_set_error(error, PLUGIN_DOMAIN, 0, _("No XMPP protocol is loaded.")); | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
903 | return FALSE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
904 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
905 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
906 | purple_signal_connect(purple_connections_get_handle(), "signing-on", |
| 37041 | 907 | plugin, PURPLE_CALLBACK(signing_on_cb), NULL); |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
908 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 37041 | 909 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
910 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
911 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
912 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
913 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
914 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
915 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
916 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
917 | if (console) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
918 | gtk_widget_destroy(console->window); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
919 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
920 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
921 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
922 | PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload); |