pidgin/plugins/xmppconsole/xmppconsole.c

Sun, 13 Oct 2019 15:45:39 +0300

author
qarkai <qarkai@gmail.com>
date
Sun, 13 Oct 2019 15:45:39 +0300
changeset 40043
90446617d967
parent 39921
a9c92a82f4c8
child 40197
75ffd76260fc
permissions
-rw-r--r--

Use GList functions instead of manual iterations

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 *
39810
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
6 * source distribution.
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * 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
10 * the Free Software Foundation; either version 2 of the License, or
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
39810
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
20 * 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
21 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 */
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 #include "internal.h"
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 #include "gtkplugin.h"
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26 #include "version.h"
36543
a8c3fecee2d3 Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
27 #include "protocol.h"
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
28 #include "xmlnode.h"
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29
17242
6f222870576d #include "gtkutils.h"
Richard Laager <rlaager@pidgin.im>
parents: 17213
diff changeset
30 #include "gtkutils.h"
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
32 #include <gdk/gdkkeysyms.h>
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
33
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33160
diff changeset
34 #include "gtk3compat.h"
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33160
diff changeset
35
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
36 #define PLUGIN_ID "gtk-xmpp"
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
37 #define PLUGIN_DOMAIN (g_quark_from_static_string(PLUGIN_ID))
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
38
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
39 typedef struct {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
40 PurpleConnection *gc;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
41 GtkWidget *window;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
42 GtkWidget *hbox;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
43 GtkWidget *dropdown;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
44 GtkTextBuffer *buffer;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
45 struct {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
46 GtkTextTag *info;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
47 GtkTextTag *incoming;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
48 GtkTextTag *outgoing;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
49 GtkTextTag *bracket;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
50 GtkTextTag *tag;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
51 GtkTextTag *attr;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
52 GtkTextTag *value;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
53 GtkTextTag *xmlns;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
54 } tags;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
55 GtkWidget *entry;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
56 GtkTextBuffer *entry_buffer;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
57 GtkWidget *sw;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
58 int count;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
59 GList *accounts;
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
60
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
61 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
62 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
63 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
64 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
65 } iq;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
66
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
67 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
68 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
69 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
70 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
71 GtkComboBoxText *show;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
72 GtkEntry *status;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
73 GtkEntry *priority;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
74 } presence;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
75
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
76 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
77 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
78 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
79 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
80 GtkEntry *body;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
81 GtkEntry *subject;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
82 GtkEntry *thread;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
83 } message;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84 } XmppConsole;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
86 XmppConsole *console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
87 static void *xmpp_console_handle = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88
35310
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
89 static const gchar *xmpp_prpls[] = {
37248
ef82ac226e4b jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents: 37109
diff changeset
90 "prpl-jabber", "prpl-gtalk", NULL
35310
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
91 };
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
92
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
93 static gboolean
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
94 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
95 {
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
96 const gchar *prpl_name;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
97 int i;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
98
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
99 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
100
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
101 i = 0;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
102 while (xmpp_prpls[i] != NULL) {
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38007 38259
diff changeset
103 if (purple_strequal(xmpp_prpls[i], prpl_name))
35310
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
104 return TRUE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
105 i++;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
106 }
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
107
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
108 return FALSE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
109 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
111 static void
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
112 purple_xmlnode_append_to_buffer(PurpleXmlNode *node, gint indent_level, GtkTextIter *iter, GtkTextTag *tag)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
114 PurpleXmlNode *c;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115 gboolean need_end = FALSE, pretty = TRUE;
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
116 gint i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
118 g_return_if_fail(node != NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
119
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
120 for (i = 0; i < indent_level; i++) {
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
121 gtk_text_buffer_insert_with_tags(console->buffer, iter, "\t", 1, tag, NULL);
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
122 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
123
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
124 gtk_text_buffer_insert_with_tags(console->buffer, iter, "<", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
125 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
126 gtk_text_buffer_insert_with_tags(console->buffer, iter, node->name, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
127 tag, console->tags.tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
128
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129 if (node->xmlns) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
130 if ((!node->parent ||
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
131 !node->parent->xmlns ||
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
132 !purple_strequal(node->xmlns, node->parent->xmlns)) &&
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
133 !purple_strequal(node->xmlns, "jabber:client"))
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
135 gtk_text_buffer_insert_with_tags(console->buffer, iter, " ", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
136 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
137 gtk_text_buffer_insert_with_tags(console->buffer, iter, "xmlns", 5,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
138 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
139 gtk_text_buffer_insert_with_tags(console->buffer, iter, "='", 2,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
140 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
141 gtk_text_buffer_insert_with_tags(console->buffer, iter, node->xmlns, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
142 tag, console->tags.xmlns, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
143 gtk_text_buffer_insert_with_tags(console->buffer, iter, "'", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
144 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
147 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
149 if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
150 gtk_text_buffer_insert_with_tags(console->buffer, iter, " ", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
151 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
152 gtk_text_buffer_insert_with_tags(console->buffer, iter, c->name, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
153 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
154 gtk_text_buffer_insert_with_tags(console->buffer, iter, "='", 2,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
155 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
156 gtk_text_buffer_insert_with_tags(console->buffer, iter, c->data, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
157 tag, console->tags.value, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
158 gtk_text_buffer_insert_with_tags(console->buffer, iter, "'", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
159 tag, NULL);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
160 } 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
161 if (c->type == PURPLE_XMLNODE_TYPE_DATA)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162 pretty = FALSE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
163 need_end = TRUE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
164 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
165 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
166
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
167 if (need_end) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
168 gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
169 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
170 if (pretty) {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
171 gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
172 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
173 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
174
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
175 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
177 if (c->type == PURPLE_XMLNODE_TYPE_TAG) {
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
178 purple_xmlnode_append_to_buffer(c, indent_level + 1, iter, tag);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
179 } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
180 gtk_text_buffer_insert_with_tags(console->buffer, iter, c->data, c->data_sz,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
181 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
182 }
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
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
185 if (pretty) {
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
186 for (i = 0; i < indent_level; i++) {
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
187 gtk_text_buffer_insert_with_tags(console->buffer, iter, "\t", 1, tag, NULL);
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
188 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
189 }
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
190 gtk_text_buffer_insert_with_tags(console->buffer, iter, "<", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
191 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
192 gtk_text_buffer_insert_with_tags(console->buffer, iter, "/", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
193 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
194 gtk_text_buffer_insert_with_tags(console->buffer, iter, node->name, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
195 tag, console->tags.tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
196 gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
197 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
198 gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
199 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
200 } else {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
201 gtk_text_buffer_insert_with_tags(console->buffer, iter, "/", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
202 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
203 gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
204 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
205 gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
206 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
207 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
209
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
211 purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
212 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
213 GtkTextIter iter;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
215 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216 return;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
217
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
218 gtk_text_buffer_get_end_iter(console->buffer, &iter);
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
219 purple_xmlnode_append_to_buffer(*packet, 0, &iter, console->tags.incoming);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
221
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
222 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
223 purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
225 GtkTextIter iter;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
226 PurpleXmlNode *node;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
229 return;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
230 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
231
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
232 if (!node)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
234
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
235 gtk_text_buffer_get_end_iter(console->buffer, &iter);
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
236 purple_xmlnode_append_to_buffer(node, 0, &iter, console->tags.outgoing);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
237 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
238 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
239
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
240 static gboolean
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
241 message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
242 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
243 PurpleProtocol *protocol = NULL;
30626
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30010
diff changeset
244 PurpleConnection *gc;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
245 gchar *text;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
246 GtkTextIter start, end;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
247
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
248 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
249 return FALSE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
250
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
251 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
252
5fd44f61d007 Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16749
diff changeset
253 if (gc)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
254 protocol = purple_connection_get_protocol(gc);
17529
5fd44f61d007 Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16749
diff changeset
255
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
256 gtk_text_buffer_get_bounds(console->entry_buffer, &start, &end);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
257 text = gtk_text_buffer_get_text(console->entry_buffer, &start, &end, FALSE);
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
258
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
259 if (protocol)
36719
0d7682bdf828 Updated protocol iface calls
Ankit Vani <a@nevitus.org>
parents: 36692
diff changeset
260 purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
261
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 g_free(text);
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
263 gtk_text_buffer_set_text(console->entry_buffer, "", 0);
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
264
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
265 return TRUE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
266 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
268 static void
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
269 entry_changed_cb(GtkTextBuffer *buffer, void *data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
270 {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
271 GtkTextIter start, end;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
272 char *xmlstr, *str;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
273 GtkTextIter iter;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
274 int wrapped_lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
275 int lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
276 GdkRectangle oneline;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
277 int height;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
278 int pad_top, pad_inside, pad_bottom;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
279 PurpleXmlNode *node;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
280 GtkStyleContext *style;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
281
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
282 wrapped_lines = 1;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
283 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
284 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline);
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
285 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry),
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
286 &iter)) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
287 wrapped_lines++;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
288 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
289
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
290 lines = gtk_text_buffer_get_line_count(buffer);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
291
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
292 /* 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
293 lines = MIN(lines, 6);
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
294 wrapped_lines = MIN(wrapped_lines, 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
296 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
297 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
298 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
299
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
300 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
301 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
302
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
303 gtk_widget_set_size_request(console->sw, -1, height + 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
304
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
305 gtk_text_buffer_get_bounds(buffer, &start, &end);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
306 str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
307 if (!str) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
308 return;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
309 }
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
310
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
311 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
312 node = purple_xmlnode_from_str(xmlstr, -1);
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
313 style = gtk_widget_get_style_context(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
314 if (node) {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
315 gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
316 } else {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
317 gtk_style_context_add_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
318 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
319 g_free(str);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
320 g_free(xmlstr);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
321 if (node)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
322 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
323 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
324
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
325 static void
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
326 load_text_and_set_caret(const gchar *pre_text, const gchar *post_text)
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
327 {
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
328 GtkTextIter where;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
329 GtkTextMark *mark;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
330
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
331 gtk_text_buffer_begin_user_action(console->entry_buffer);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
332
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
333 gtk_text_buffer_set_text(console->entry_buffer, pre_text, -1);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
334
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
335 gtk_text_buffer_get_end_iter(console->entry_buffer, &where);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
336 mark = gtk_text_buffer_create_mark(console->entry_buffer, NULL, &where, TRUE);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
337
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
338 gtk_text_buffer_insert(console->entry_buffer, &where, post_text, -1);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
339
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
340 gtk_text_buffer_get_iter_at_mark(console->entry_buffer, &where, mark);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
341 gtk_text_buffer_place_cursor(console->entry_buffer, &where);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
342 gtk_text_buffer_delete_mark(console->entry_buffer, mark);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
343
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
344 gtk_text_buffer_end_user_action(console->entry_buffer);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
345 }
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
346
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
347 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
348 popover_closed_cb(GtkPopover *popover, gpointer data)
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
349 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
350 GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON(data);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
351
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
352 gtk_toggle_tool_button_set_active(button, FALSE);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
353 }
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
354
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
355 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
356 toggle_button_toggled_cb(GtkToolButton *button, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
357 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
358 GtkPopover *popover = GTK_POPOVER(data);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
359
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
360 gtk_popover_popup(popover);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
361 }
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
362
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
363 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
364 iq_clicked_cb(GtkWidget *w, gpointer data)
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
365 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
366 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
367 const gchar *to;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
368 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
369
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
370 to = gtk_entry_get_text(console->iq.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
371 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
372 "<iq %s%s%s id='console%x' type='%s'>", to && *to ? "to='" : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
373 to && *to ? to : "", to && *to ? "'" : "", g_random_int(),
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
374 gtk_combo_box_text_get_active_text(console->iq.type));
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
375 load_text_and_set_caret(stanza, "</iq>");
33053
6ba80150e4c3 Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33011
diff changeset
376 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
377 g_free(stanza);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
378
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
379 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
380 gtk_entry_set_text(console->iq.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
381 gtk_combo_box_set_active(GTK_COMBO_BOX(console->iq.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
382 gtk_popover_popdown(console->iq.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
383 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
384
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
385 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
386 presence_clicked_cb(GtkWidget *w, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
387 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
388 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
389 const gchar *to, *status, *priority;
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
390 gchar *type, *show;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
391 char *stanza;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
392
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
393 to = gtk_entry_get_text(console->presence.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
394 type = gtk_combo_box_text_get_active_text(console->presence.type);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
395 if (purple_strequal(type, "default")) {
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
396 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
397 type = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
398 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
399 show = gtk_combo_box_text_get_active_text(console->presence.show);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
400 if (purple_strequal(show, "default")) {
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
401 g_free(show);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
402 show = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
403 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
404 status = gtk_entry_get_text(console->presence.status);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
405 priority = gtk_entry_get_text(console->presence.priority);
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 31321
diff changeset
406 if (purple_strequal(priority, "0"))
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
407 priority = "";
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
408
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
409 stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>"
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
410 "%s%s%s%s%s%s%s%s%s",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
411 *to ? "to='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
412 *to ? to : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
413 *to ? "'" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
414 g_random_int(),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
415
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
416 *type ? "type='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
417 *type ? type : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
418 *type ? "'" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
419
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
420 *show ? "<show>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
421 *show ? show : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
422 *show ? "</show>" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
423
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
424 *status ? "<status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
425 *status ? status : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
426 *status ? "</status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
427
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
428 *priority ? "<priority>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
429 *priority ? priority : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
430 *priority ? "</priority>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
431
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
432 load_text_and_set_caret(stanza, "</presence>");
33053
6ba80150e4c3 Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33011
diff changeset
433 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
434 g_free(stanza);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
435 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
436 g_free(show);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
437
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
438 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
439 gtk_entry_set_text(console->presence.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
440 gtk_combo_box_set_active(GTK_COMBO_BOX(console->presence.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
441 gtk_combo_box_set_active(GTK_COMBO_BOX(console->presence.show), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
442 gtk_entry_set_text(console->presence.status, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
443 gtk_entry_set_text(console->presence.priority, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
444 gtk_popover_popdown(console->presence.popover);
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
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
447 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
448 message_clicked_cb(GtkWidget *w, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
449 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
450 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
451 const gchar *to, *body, *thread, *subject;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
452 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
453
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
454 to = gtk_entry_get_text(console->message.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
455 body = gtk_entry_get_text(console->message.body);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
456 thread = gtk_entry_get_text(console->message.thread);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
457 subject = gtk_entry_get_text(console->message.subject);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
458
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
459 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
460 "<message %s%s%s id='console%x' type='%s'>"
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
461 "%s%s%s%s%s%s%s%s%s",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
462
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
463 *to ? "to='" : "", *to ? to : "", *to ? "'" : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
464 g_random_int(),
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
465 gtk_combo_box_text_get_active_text(console->message.type),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
466
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
467 *body ? "<body>" : "", *body ? body : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
468 *body ? "</body>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
469
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
470 *subject ? "<subject>" : "", *subject ? subject : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
471 *subject ? "</subject>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
472
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
473 *thread ? "<thread>" : "", *thread ? thread : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
474 *thread ? "</thread>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
475
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
476 load_text_and_set_caret(stanza, "</message>");
33053
6ba80150e4c3 Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33011
diff changeset
477 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
478 g_free(stanza);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
479
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
480 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
481 gtk_entry_set_text(console->message.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
482 gtk_combo_box_set_active(GTK_COMBO_BOX(console->message.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
483 gtk_entry_set_text(console->message.body, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
484 gtk_entry_set_text(console->message.subject, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
485 gtk_entry_set_text(console->message.thread, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
486 gtk_popover_popdown(console->message.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
487 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
488
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
489 static void
29783
96ab389c9181 xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents: 29529
diff changeset
490 signing_on_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
491 {
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
492 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
493
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
494 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
495 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
496
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
497 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
498 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
499 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
500
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
501 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
502 purple_account_get_username(account));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
503 console->accounts = g_list_append(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
504 console->count++;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
505
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
506 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
507 console->gc = gc;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
508 gtk_text_buffer_set_text(console->buffer, "", 0);
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
509 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
510 } else
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
511 gtk_widget_show_all(console->hbox);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
512 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
513
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
514 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
515 signed_off_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
516 {
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
517 int i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
518
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
519 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
520 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
521
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
522 i = g_list_index(console->accounts, gc);
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
523 if (i == -1)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
524 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
525
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
526 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
527 console->accounts = g_list_remove(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
528 console->count--;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
529
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
530 if (gc == console->gc) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
531 GtkTextIter end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
532 gtk_text_buffer_get_end_iter(console->buffer, &end);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
533 gtk_text_buffer_insert_with_tags(console->buffer, &end, _("Logged out."), -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
534 console->tags.info, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
535 console->gc = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
536 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
537 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
538
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
539 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
540 console_destroy(GtkWidget *window, gpointer nul)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
541 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
542 g_list_free(console->accounts);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
543 g_free(console);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
544 console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
545 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
546
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
547 static void
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
548 dropdown_changed_cb(GtkComboBox *widget, gpointer nul)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
549 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
550 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
551 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
552
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
553 console->gc = g_list_nth_data(console->accounts, gtk_combo_box_get_active(GTK_COMBO_BOX(console->dropdown)));
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
554 gtk_text_buffer_set_text(console->buffer, "", 0);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
555 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
556
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
557 static void
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
558 create_console(PurplePluginAction *action)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
559 {
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
560 GtkBuilder *builder;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
561 GList *connections;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
562 GtkCssProvider *entry_css;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
563 GtkStyleContext *context;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
564
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
565 if (console) {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
566 gtk_window_present(GTK_WINDOW(console->window));
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
567 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
568 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
569
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
570 console = g_new0(XmppConsole, 1);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
571
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
572 builder = gtk_builder_new_from_resource(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
573 "/im/pidgin/Pidgin/Plugin/XMPPConsole/console.ui");
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
574 gtk_builder_set_translation_domain(builder, PACKAGE);
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
575 console->window = GTK_WIDGET(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
576 gtk_builder_get_object(builder, "PidginXmppConsole"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
577 gtk_builder_add_callback_symbol(builder, "console_destroy",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
578 G_CALLBACK(console_destroy));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
579
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
580 console->hbox = GTK_WIDGET(gtk_builder_get_object(builder, "hbox"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
581 console->dropdown =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
582 GTK_WIDGET(gtk_builder_get_object(builder, "dropdown"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
583 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
584 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
585 if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
586 console->count++;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
587 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
588 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
589 purple_account_get_username(purple_connection_get_account(gc)));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
590 if (!console->gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
591 console->gc = gc;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
592 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
593 }
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
594 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
595 gtk_builder_add_callback_symbol(builder, "dropdown_changed_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
596 G_CALLBACK(dropdown_changed_cb));
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
597
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
598 console->buffer =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
599 GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "buffer"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
600 console->tags.info =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
601 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.info"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
602 console->tags.incoming =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
603 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.incoming"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
604 console->tags.outgoing =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
605 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.outgoing"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
606 console->tags.bracket =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
607 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.bracket"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
608 console->tags.tag =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
609 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.tag"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
610 console->tags.attr =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
611 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.attr"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
612 console->tags.value =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
613 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.value"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
614 console->tags.xmlns =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
615 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.xmlns"));
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
616
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
617 if (console->count == 0) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
618 GtkTextIter start, end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
619 gtk_text_buffer_set_text(console->buffer, _("Not connected to XMPP"), -1);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
620 gtk_text_buffer_get_bounds(console->buffer, &start, &end);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
621 gtk_text_buffer_apply_tag(console->buffer, console->tags.info, &start, &end);
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
622 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
623
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
624 /* Popover for <iq/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
625 console->iq.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
626 GTK_POPOVER(gtk_builder_get_object(builder, "iq.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
627 console->iq.to = GTK_ENTRY(gtk_builder_get_object(builder, "iq.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
628 console->iq.type =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
629 GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "iq.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
630
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
631 /* Popover for <presence/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
632 console->presence.popover = GTK_POPOVER(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
633 gtk_builder_get_object(builder, "presence.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
634 console->presence.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
635 GTK_ENTRY(gtk_builder_get_object(builder, "presence.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
636 console->presence.type = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
637 gtk_builder_get_object(builder, "presence.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
638 console->presence.show = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
639 gtk_builder_get_object(builder, "presence.show"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
640 console->presence.status =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
641 GTK_ENTRY(gtk_builder_get_object(builder, "presence.status"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
642 console->presence.priority =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
643 GTK_ENTRY(gtk_builder_get_object(builder, "presence.priority"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
644
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
645 /* Popover for <message/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
646 console->message.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
647 GTK_POPOVER(gtk_builder_get_object(builder, "message.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
648 console->message.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
649 GTK_ENTRY(gtk_builder_get_object(builder, "message.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
650 console->message.type = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
651 gtk_builder_get_object(builder, "message.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
652 console->message.body =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
653 GTK_ENTRY(gtk_builder_get_object(builder, "message.body"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
654 console->message.subject =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
655 GTK_ENTRY(gtk_builder_get_object(builder, "message.subject"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
656 console->message.thread =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
657 GTK_ENTRY(gtk_builder_get_object(builder, "message.thread"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
658
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
659 gtk_builder_add_callback_symbols(
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
660 builder, "toggle_button_toggled_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
661 G_CALLBACK(toggle_button_toggled_cb), "popover_closed_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
662 G_CALLBACK(popover_closed_cb), "iq_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
663 G_CALLBACK(iq_clicked_cb), "presence_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
664 G_CALLBACK(presence_clicked_cb), "message_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
665 G_CALLBACK(message_clicked_cb), NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
666
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
667 console->entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry"));
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
668 entry_css = gtk_css_provider_new();
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
669 gtk_css_provider_load_from_data(entry_css,
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
670 "textview." GTK_STYLE_CLASS_ERROR " text {background-color:#ffcece;}",
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
671 -1, NULL);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
672 context = gtk_widget_get_style_context(console->entry);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
673 gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(entry_css),
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
674 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
675 console->entry_buffer = GTK_TEXT_BUFFER(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
676 gtk_builder_get_object(builder, "entry_buffer"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
677 gtk_builder_add_callback_symbol(builder, "message_send_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
678 G_CALLBACK(message_send_cb));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
679
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
680 console->sw = GTK_WIDGET(gtk_builder_get_object(builder, "sw"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
681 gtk_builder_add_callback_symbol(builder, "entry_changed_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
682 G_CALLBACK(entry_changed_cb));
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
683
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
684 entry_changed_cb(console->entry_buffer, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
685
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
686 gtk_widget_show_all(console->window);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
687 if (console->count < 2)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
688 gtk_widget_hide(console->hbox);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
689
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
690 gtk_builder_connect_signals(builder, console);
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
691 g_object_unref(builder);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
692 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
693
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
694 static GList *
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
695 actions(PurplePlugin *plugin)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
696 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
697 GList *l = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
698 PurplePluginAction *act = NULL;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
699
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
700 act = purple_plugin_action_new(_("XMPP Console"), create_console);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
701 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
702
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
703 return l;
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
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
706 static PidginPluginInfo *
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
707 plugin_query(GError **error)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
708 {
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
709 const gchar * const authors[] = {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
710 "Sean Egan <seanegan@gmail.com>",
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
711 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
712 };
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
713
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
714 return pidgin_plugin_info_new(
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
715 "id", PLUGIN_ID,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
716 "name", N_("XMPP Console"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
717 "version", DISPLAY_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
718 "category", N_("Protocol utility"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
719 "summary", N_("Send and receive raw XMPP stanzas."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
720 "description", N_("This plugin is useful for debugging XMPP servers "
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
721 "or clients."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
722 "authors", authors,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
723 "website", PURPLE_WEBSITE,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
724 "abi-version", PURPLE_ABI_VERSION,
36934
e7268aeb3b89 Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents: 36758
diff changeset
725 "actions-cb", actions,
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
726 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
727 );
15412
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
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
730 static gboolean
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
731 plugin_load(PurplePlugin *plugin, GError **error)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
732 {
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
733 int i;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
734 gboolean any_registered = FALSE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
735
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
736 xmpp_console_handle = plugin;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
737
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
738 i = 0;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
739 while (xmpp_prpls[i] != NULL) {
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
740 PurpleProtocol *xmpp;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
741
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
742 xmpp = purple_protocols_find(xmpp_prpls[i]);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
743 i++;
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
744
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
745 if (!xmpp)
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
746 continue;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
747 any_registered = TRUE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
748
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
749 purple_signal_connect(xmpp, "jabber-receiving-xmlnode",
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
750 xmpp_console_handle,
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
751 PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
752 purple_signal_connect(xmpp, "jabber-sending-text",
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
753 xmpp_console_handle,
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
754 PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
755 }
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
756
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
757 if (!any_registered) {
39921
a9c92a82f4c8 Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39810
diff changeset
758 g_set_error_literal(error, PLUGIN_DOMAIN, 0,
a9c92a82f4c8 Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39810
diff changeset
759 _("No XMPP protocol is loaded."));
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
760 return FALSE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
761 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
762
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
763 purple_signal_connect(purple_connections_get_handle(), "signing-on",
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
764 plugin, PURPLE_CALLBACK(signing_on_cb), NULL);
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
765 purple_signal_connect(purple_connections_get_handle(), "signed-off",
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
766 plugin, PURPLE_CALLBACK(signed_off_cb), NULL);
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
767
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
768 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
769 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
770
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
771 static gboolean
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
772 plugin_unload(PurplePlugin *plugin, GError **error)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
773 {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
774 if (console)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
775 gtk_widget_destroy(console->window);
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
776 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
777 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
778
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
779 PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload);

mercurial