pidgin/plugins/xmppconsole.c

Wed, 02 Apr 2014 18:50:03 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Wed, 02 Apr 2014 18:50:03 +0200
changeset 35726
ac781ed58d2d
parent 35526
ed1be305c985
child 37109
94d1a2589d5a
permissions
-rw-r--r--

Smiley manager: more cleanup

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

mercurial