pidgin/plugins/xmppconsole/xmppconsole.c

Thu, 14 Jan 2021 22:33:49 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 14 Jan 2021 22:33:49 -0600
changeset 40708
53a26c29d26c
parent 40502
875489636847
child 40799
fb206d19393f
permissions
-rw-r--r--

Move the PurpleProtocolServer interface to its own file.

Testing Done:
Compiled and ran locally. Connected with bonjour and xmpp without issues.

Bugs closed: PIDGIN-17458

Reviewed at https://reviews.imfreedom.org/r/418/

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

mercurial