pidgin/plugins/xmppconsole/xmppconsole.c

Wed, 25 May 2022 23:52:44 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Wed, 25 May 2022 23:52:44 -0500
changeset 41406
3631bc23f0b5
parent 41314
0dc72eacd8bf
child 41407
94f55a462e8e
permissions
-rw-r--r--

Remove unused global in XMPP console

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
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
24 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
25
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
26 #include <gdk/gdkkeysyms.h>
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
27
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
28 #include <purple.h>
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
30 #include <pidgin.h>
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
31
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
32 #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
33 #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
34
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
35 typedef struct {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
36 PurpleConnection *gc;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
37 GtkWidget *window;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
38 GtkWidget *hbox;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
39 GtkWidget *dropdown;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
40 GtkTextBuffer *buffer;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
41 struct {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
42 GtkTextTag *info;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
43 GtkTextTag *incoming;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
44 GtkTextTag *outgoing;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
45 GtkTextTag *bracket;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
46 GtkTextTag *tag;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
47 GtkTextTag *attr;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
48 GtkTextTag *value;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
49 GtkTextTag *xmlns;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
50 } tags;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
51 GtkWidget *entry;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
52 GtkTextBuffer *entry_buffer;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
53 GtkWidget *sw;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 int count;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
55 GList *accounts;
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
56
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
57 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
58 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
59 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
60 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
61 } iq;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
62
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
63 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
64 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
65 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
66 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
67 GtkComboBoxText *show;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
68 GtkEntry *status;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
69 GtkEntry *priority;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
70 } presence;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
71
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
72 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
73 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
74 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
75 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
76 GtkEntry *body;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
77 GtkEntry *subject;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
78 GtkEntry *thread;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
79 } message;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
80 } XmppConsole;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
81
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
82 XmppConsole *console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
83
35310
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
84 static const gchar *xmpp_prpls[] = {
37248
ef82ac226e4b jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents: 37109
diff changeset
85 "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
86 };
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
87
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
88 static gboolean
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
89 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
90 {
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
91 const gchar *prpl_name;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
92 int i;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
93
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
94 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
95
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
96 i = 0;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
97 while (xmpp_prpls[i] != NULL) {
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38007 38259
diff changeset
98 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
99 return TRUE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
100 i++;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
101 }
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
102
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
103 return FALSE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
104 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
106 static void
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
107 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
108 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
109 PurpleXmlNode *c;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110 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
111 gint i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
113 g_return_if_fail(node != NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
114
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
115 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
116 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
117 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
118
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
119 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
120 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
121 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
122 tag, console->tags.tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
123
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
124 if (node->xmlns) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
125 if ((!node->parent ||
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
126 !node->parent->xmlns ||
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
127 !purple_strequal(node->xmlns, node->parent->xmlns)) &&
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
128 !purple_strequal(node->xmlns, "jabber:client"))
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
130 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
131 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
132 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
133 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
134 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
135 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
136 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
137 tag, console->tags.xmlns, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
138 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
139 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
140 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
142 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
143 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
144 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
145 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
146 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
147 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
148 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
149 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
150 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
151 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
152 tag, console->tags.value, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
153 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
154 tag, NULL);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
155 } 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
156 if (c->type == PURPLE_XMLNODE_TYPE_DATA)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
157 pretty = FALSE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
158 need_end = TRUE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
159 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
160 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
161
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
162 if (need_end) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
163 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
164 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
165 if (pretty) {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
166 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
167 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
168 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
169
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
170 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
171 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
172 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
173 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
174 } 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
175 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
176 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
180 if (pretty) {
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
181 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
182 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
183 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
184 }
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
185 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
186 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
187 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
188 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
189 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
190 tag, console->tags.tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
191 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
192 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
193 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
194 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
195 } else {
39001
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, 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, ">", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
199 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
200 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
201 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
202 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
203 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
204
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
205 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
206 purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
207 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
208 GtkTextIter iter;
15412
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 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
211 return;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
212
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
213 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
214 purple_xmlnode_append_to_buffer(*packet, 0, &iter, console->tags.incoming);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
215 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
218 purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
219 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
220 GtkTextIter iter;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
221 PurpleXmlNode *node;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
222
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
223 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 return;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
225 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
226
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227 if (!node)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
229
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
230 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
231 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
232 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
235 static gboolean
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
236 message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
237 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
238 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
239 PurpleConnection *gc;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
240 gchar *text;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
241 GtkTextIter start, end;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
242
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
243 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
244 return FALSE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
245
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
246 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
247
5fd44f61d007 Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16749
diff changeset
248 if (gc)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
249 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
250
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
251 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
252 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
253
40708
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
254 if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
255 purple_protocol_server_send_raw(PURPLE_PROTOCOL_SERVER(protocol), gc,
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
256 text, strlen(text));
53a26c29d26c Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
257 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
258
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
259 g_free(text);
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
260 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
261
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
262 return TRUE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
264
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
265 static void
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
266 entry_changed_cb(GtkTextBuffer *buffer, void *data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267 {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
268 GtkTextIter start, end;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
269 char *xmlstr, *str;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
270 GtkTextIter iter;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
271 int wrapped_lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
272 int lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
273 GdkRectangle oneline;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
274 int height;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
275 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
276 PurpleXmlNode *node;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
277 GtkStyleContext *style;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
278
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
279 wrapped_lines = 1;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
280 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
281 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
282 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
283 &iter)) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
284 wrapped_lines++;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
285 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
286
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
287 lines = gtk_text_buffer_get_line_count(buffer);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
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 /* 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
290 lines = MIN(lines, 6);
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
291 wrapped_lines = MIN(wrapped_lines, 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
292
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
293 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
294 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
295 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
296
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
297 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
298 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
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 gtk_widget_set_size_request(console->sw, -1, height + 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
301
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
302 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
303 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
304 if (!str) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
305 return;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
306 }
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
307
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
308 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
309 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
310 style = gtk_widget_get_style_context(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
311 if (node) {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
312 gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
313 } else {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
314 gtk_style_context_add_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
315 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
316 g_free(str);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
317 g_free(xmlstr);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
318 if (node)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
319 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
320 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
321
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
322 static void
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
323 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
324 {
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
325 GtkTextIter where;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
326 GtkTextMark *mark;
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 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
329
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
330 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
331
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
332 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
333 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
334
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
335 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
336
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
337 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
338 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
339 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
340
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
341 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
342 }
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
343
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
344 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
345 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
346 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
347 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
348
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
349 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
350 }
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 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
353 toggle_button_toggled_cb(GtkToolButton *button, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
354 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
355 GtkPopover *popover = GTK_POPOVER(data);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
356
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
357 gtk_popover_popup(popover);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
358 }
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 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
361 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
362 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
363 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
364 const gchar *to;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
365 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
366
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
367 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
368 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
369 "<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
370 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
371 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
372 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
373 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
374 g_free(stanza);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
375
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
376 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
377 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
378 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
379 gtk_popover_popdown(console->iq.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
380 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
381
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
382 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
383 presence_clicked_cb(GtkWidget *w, gpointer data)
15412
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 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
386 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
387 gchar *type, *show;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
388 char *stanza;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
389
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
390 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
391 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
392 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
393 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
394 type = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
395 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
396 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
397 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
398 g_free(show);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
399 show = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
400 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
401 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
402 priority = gtk_entry_get_text(console->presence.priority);
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 31321
diff changeset
403 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
404 priority = "";
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
405
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
406 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
407 "%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
408 *to ? "to='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
409 *to ? to : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
410 *to ? "'" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
411 g_random_int(),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
412
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
413 *type ? "type='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
414 *type ? type : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
415 *type ? "'" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
416
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
417 *show ? "<show>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
418 *show ? show : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
419 *show ? "</show>" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
420
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
421 *status ? "<status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
422 *status ? status : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
423 *status ? "</status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
424
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
425 *priority ? "<priority>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
426 *priority ? priority : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
427 *priority ? "</priority>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
428
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
429 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
430 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
431 g_free(stanza);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
432 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
433 g_free(show);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
434
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
435 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
436 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
437 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
438 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
439 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
440 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
441 gtk_popover_popdown(console->presence.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
442 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
443
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
444 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
445 message_clicked_cb(GtkWidget *w, gpointer data)
15412
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 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
448 const gchar *to, *body, *thread, *subject;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
449 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
450
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
451 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
452 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
453 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
454 subject = gtk_entry_get_text(console->message.subject);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
455
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
456 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
457 "<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
458 "%s%s%s%s%s%s%s%s%s",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
459
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
460 *to ? "to='" : "", *to ? to : "", *to ? "'" : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
461 g_random_int(),
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
462 gtk_combo_box_text_get_active_text(console->message.type),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
463
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
464 *body ? "<body>" : "", *body ? body : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
465 *body ? "</body>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
466
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
467 *subject ? "<subject>" : "", *subject ? subject : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
468 *subject ? "</subject>" : "",
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 *thread ? "<thread>" : "", *thread ? thread : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
471 *thread ? "</thread>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
472
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
473 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
474 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
475 g_free(stanza);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
476
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
477 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
478 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
479 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
480 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
481 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
482 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
483 gtk_popover_popdown(console->message.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
484 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
485
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
486 static void
29783
96ab389c9181 xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents: 29529
diff changeset
487 signing_on_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
488 {
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
489 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
490
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
491 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
492 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
493
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
494 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
495 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
496 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
497
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
498 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
499 purple_account_get_username(account));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
500 console->accounts = g_list_append(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
501 console->count++;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
502
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
503 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
504 console->gc = gc;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
505 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
506 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
507 } else
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
508 gtk_widget_show_all(console->hbox);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
509 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
510
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
511 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
512 signed_off_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
513 {
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
514 int i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
515
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
516 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
517 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
518
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
519 i = g_list_index(console->accounts, gc);
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
520 if (i == -1)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
521 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
522
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
523 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
524 console->accounts = g_list_remove(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
525 console->count--;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
526
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
527 if (gc == console->gc) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
528 GtkTextIter end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
529 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
530 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
531 console->tags.info, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
532 console->gc = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
533 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
534 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
535
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
536 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
537 console_destroy(GtkWidget *window, gpointer nul)
15412
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 g_list_free(console->accounts);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
540 g_free(console);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
541 console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
542 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
543
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
544 static void
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
545 dropdown_changed_cb(GtkComboBox *widget, gpointer nul)
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 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
548 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
549
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
550 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
551 gtk_text_buffer_set_text(console->buffer, "", 0);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
552 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
553
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
554 static void
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
555 create_console(PurplePluginAction *action)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
556 {
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
557 GtkBuilder *builder;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
558 GList *connections;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
559 GtkCssProvider *entry_css;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
560 GtkStyleContext *context;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
561
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
562 if (console) {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
563 gtk_window_present(GTK_WINDOW(console->window));
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
564 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
565 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
566
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
567 console = g_new0(XmppConsole, 1);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
568
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
569 builder = gtk_builder_new_from_resource(
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40894
diff changeset
570 "/im/pidgin/Pidgin3/Plugin/XMPPConsole/console.ui");
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
571 gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
572 console->window = GTK_WIDGET(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
573 gtk_builder_get_object(builder, "PidginXmppConsole"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
574 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
575 G_CALLBACK(console_destroy));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
576
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
577 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
578 console->dropdown =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
579 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
580 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
581 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
582 if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
583 console->count++;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
584 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
585 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
586 purple_account_get_username(purple_connection_get_account(gc)));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
587 if (!console->gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
588 console->gc = gc;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
589 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
590 }
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
591 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
592 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
593 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
594
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
595 console->buffer =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
596 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
597 console->tags.info =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
598 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
599 console->tags.incoming =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
600 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
601 console->tags.outgoing =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
602 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
603 console->tags.bracket =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
604 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
605 console->tags.tag =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
606 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
607 console->tags.attr =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
608 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
609 console->tags.value =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
610 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
611 console->tags.xmlns =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
612 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
613
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
614 if (console->count == 0) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
615 GtkTextIter start, end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
616 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
617 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
618 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
619 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
620
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
621 /* Popover for <iq/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
622 console->iq.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
623 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
624 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
625 console->iq.type =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
626 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
627
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
628 /* Popover for <presence/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
629 console->presence.popover = GTK_POPOVER(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
630 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
631 console->presence.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
632 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
633 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
634 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
635 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
636 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
637 console->presence.status =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
638 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
639 console->presence.priority =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
640 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
641
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
642 /* Popover for <message/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
643 console->message.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
644 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
645 console->message.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
646 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
647 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
648 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
649 console->message.body =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
650 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
651 console->message.subject =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
652 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
653 console->message.thread =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
654 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
655
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
656 gtk_builder_add_callback_symbols(
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
657 builder, "toggle_button_toggled_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
658 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
659 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
660 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
661 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
662 G_CALLBACK(message_clicked_cb), NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
663
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
664 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
665 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
666 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
667 "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
668 -1, NULL);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
669 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
670 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
671 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
672 console->entry_buffer = GTK_TEXT_BUFFER(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
673 gtk_builder_get_object(builder, "entry_buffer"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
674 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
675 G_CALLBACK(message_send_cb));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
676
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
677 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
678 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
679 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
680
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
681 entry_changed_cb(console->entry_buffer, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
682
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
683 gtk_widget_show_all(console->window);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
684 if (console->count < 2)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
685 gtk_widget_hide(console->hbox);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
686
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
687 gtk_builder_connect_signals(builder, console);
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
688 g_object_unref(builder);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
689 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
690
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
691 static GList *
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
692 actions(PurplePlugin *plugin)
15412
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 GList *l = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
695 PurplePluginAction *act = NULL;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
696
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
697 act = purple_plugin_action_new(_("XMPP Console"), create_console);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
698 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
699
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
700 return l;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
701 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
702
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40799
diff changeset
703 static GPluginPluginInfo *
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40799
diff changeset
704 xmpp_console_query(GError **error)
15412
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 const gchar * const authors[] = {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
707 "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
708 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
709 };
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
710
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
711 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
712 "id", PLUGIN_ID,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
713 "name", N_("XMPP Console"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
714 "version", DISPLAY_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
715 "category", N_("Protocol utility"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
716 "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
717 "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
718 "or clients."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
719 "authors", authors,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
720 "website", PURPLE_WEBSITE,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
721 "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
722 "actions-cb", actions,
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
723 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
724 );
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
725 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
726
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
727 static gboolean
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40799
diff changeset
728 xmpp_console_load(GPluginPlugin *plugin, GError **error)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
729 {
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
730 int i;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
731 gboolean any_registered = FALSE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
732
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
733 i = 0;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
734 while (xmpp_prpls[i] != NULL) {
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
735 PurpleProtocol *xmpp;
40799
fb206d19393f Port the pidgin plugins from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
736 PurpleProtocolManager *manager;
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
737
40799
fb206d19393f Port the pidgin plugins from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
738 manager = purple_protocol_manager_get_default();
fb206d19393f Port the pidgin plugins from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents: 40708
diff changeset
739 xmpp = purple_protocol_manager_find(manager, xmpp_prpls[i]);
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
740 i++;
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
741
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
742 if (!xmpp)
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
743 continue;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
744 any_registered = TRUE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
745
41406
3631bc23f0b5 Remove unused global in XMPP console
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
746 purple_signal_connect(xmpp, "jabber-receiving-xmlnode", plugin,
3631bc23f0b5 Remove unused global in XMPP console
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
747 G_CALLBACK(purple_xmlnode_received_cb), NULL);
3631bc23f0b5 Remove unused global in XMPP console
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
748 purple_signal_connect(xmpp, "jabber-sending-text", plugin,
3631bc23f0b5 Remove unused global in XMPP console
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
749 G_CALLBACK(purple_xmlnode_sent_cb), NULL);
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
750 }
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
751
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
752 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
753 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
754 _("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
755 return FALSE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
756 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
757
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
758 purple_signal_connect(purple_connections_get_handle(), "signing-on",
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41078
diff changeset
759 plugin, G_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
760 purple_signal_connect(purple_connections_get_handle(), "signed-off",
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41078
diff changeset
761 plugin, G_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
762
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
763 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
764 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
765
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
766 static gboolean
41078
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 41030
diff changeset
767 xmpp_console_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
768 {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
769 if (console)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
770 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
771 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
772 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
773
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40799
diff changeset
774 GPLUGIN_NATIVE_PLUGIN_DECLARE(xmpp_console)

mercurial