libpurple/protocols/jabber/libxmpp.c

Mon, 02 Sep 2013 17:20:49 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 02 Sep 2013 17:20:49 +0530
branch
soc.2013.gobjectification.plugins
changeset 36653
4084c34c051d
parent 36638
5f6dcd83e8c1
permissions
-rw-r--r--

Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.

16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /* purple
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 *
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
5 * source distribution.
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 *
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18273
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 *
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 */
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 /* libxmpp is the XMPP protocol plugin. It is linked against libjabbercommon,
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 * which may be used to support other protocols (Bonjour) which may need to
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 * share code.
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26 */
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
27
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18178
diff changeset
28 #include "internal.h"
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
29 #include "chat.h"
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
30 #include "core.h"
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
31 #include "plugins.h"
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
32
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
33 #include "libxmpp.h"
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
34
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36525
diff changeset
35 static PurpleProtocol *my_protocol = NULL;
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
36
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
37 static PurpleAccount *find_acct(const char *protocol, const char *acct_id)
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
38 {
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
39 PurpleAccount *acct = NULL;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
40
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
41 /* If we have a specific acct, use it */
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
42 if (acct_id) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
43 acct = purple_accounts_find(acct_id, protocol);
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
44 if (acct && !purple_account_is_connected(acct))
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
45 acct = NULL;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
46 } else { /* Otherwise find an active account for the protocol */
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
47 GList *l = purple_accounts_get_all();
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
48 while (l) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
49 if (!strcmp(protocol, purple_account_get_protocol_id(l->data))
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
50 && purple_account_is_connected(l->data)) {
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
51 acct = l->data;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
52 break;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
53 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
54 l = l->next;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
55 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
56 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
57
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
58 return acct;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
59 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
60
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
61 static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params)
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
62 {
29109
43b1543582a6 On Windows, treat a 'xmpp:foo@bar.com' URI as opening an IM window.
Paul Aurich <darkrain42@pidgin.im>
parents: 28879
diff changeset
63 char *acct_id = params ? g_hash_table_lookup(params, "account") : NULL;
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
64 PurpleAccount *acct;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
65
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
66 if (g_ascii_strcasecmp(proto, "xmpp"))
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
67 return FALSE;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
68
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
69 acct = find_acct(purple_protocol_get_id(my_protocol), acct_id);
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
70
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
71 if (!acct)
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
72 return FALSE;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
73
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
74 /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */
29109
43b1543582a6 On Windows, treat a 'xmpp:foo@bar.com' URI as opening an IM window.
Paul Aurich <darkrain42@pidgin.im>
parents: 28879
diff changeset
75 /* params is NULL if the URI has no '?' (or anything after it) */
43b1543582a6 On Windows, treat a 'xmpp:foo@bar.com' URI as opening an IM window.
Paul Aurich <darkrain42@pidgin.im>
parents: 28879
diff changeset
76 if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) {
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
77 char *body = g_hash_table_lookup(params, "body");
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
78 if (user && *user) {
34634
90fa70aa7e28 Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
79 PurpleIMConversation *im =
34627
08733a7475df Replaced purple_conversation_new() with purple_[im,chat]_conversation_new()
Ankit Vani <a@nevitus.org>
parents: 32338
diff changeset
80 purple_im_conversation_new(acct, user);
34634
90fa70aa7e28 Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
81 purple_conversation_present(PURPLE_CONVERSATION(im));
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
82 if (body && *body)
34634
90fa70aa7e28 Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
83 purple_conversation_send_confirm(PURPLE_CONVERSATION(im), body);
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
84 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
85 } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) {
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
86 char *name = g_hash_table_lookup(params, "name");
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
87 if (user && *user)
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
88 purple_blist_request_add_buddy(acct, user, NULL, name);
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
89 } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) {
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
90 PurpleConnection *gc = purple_account_get_connection(acct);
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
91 if (user && *user) {
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
92 GHashTable *params = jabber_chat_info_defaults(gc, user);
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
93 jabber_chat_join(gc, params);
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
94 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
95 return TRUE;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
96 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
97
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
98 return FALSE;
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
99 }
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
100
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
101 static void
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
102 xmpp_protocol_base_init(XMPPProtocolClass *klass)
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 {
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
104 PurpleProtocolClass *proto_class = PURPLE_PROTOCOL_CLASS(klass);
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
105 PurpleAccountUserSplit *split;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
106 PurpleAccountOption *option;
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
107 GList *encryption_values = NULL;
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
108
17008
502623177086 Handle people forgetting to enter a domain. Also, change 'server,' in the account options to 'domain,' which is its proper name, and hopefully less confusion
Sean Egan <seanegan@pidgin.im>
parents: 17007
diff changeset
109 /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
110 split = purple_account_user_split_new(_("Domain"), NULL, '@');
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
111 purple_account_user_split_set_reverse(split, FALSE);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
112 proto_class->user_splits = g_list_append(proto_class->user_splits, split);
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
113
29863
314a27e16325 jabber: Fix leaving the Resource blank in Finch, so it isn't '(null)'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29847
diff changeset
114 split = purple_account_user_split_new(_("Resource"), "", '/');
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
115 purple_account_user_split_set_reverse(split, FALSE);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
116 proto_class->user_splits = g_list_append(proto_class->user_splits, split);
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
117
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
118 #define ADD_VALUE(list, desc, v) { \
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
119 PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
120 kvp->key = g_strdup((desc)); \
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
121 kvp->value = g_strdup((v)); \
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
122 list = g_list_prepend(list, kvp); \
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
123 }
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
124
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
125 ADD_VALUE(encryption_values, _("Require encryption"), "require_tls");
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
126 ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls");
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
127 ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl");
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
128 #if 0
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
129 ADD_VALUE(encryption_values, "None", "none");
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
130 #endif
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
131 encryption_values = g_list_reverse(encryption_values);
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
132
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
133 #undef ADD_VALUE
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
134
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
135 option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
136 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
30740
017077f79a0f jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents: 30138
diff changeset
137 option);
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
138
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
139 option = purple_account_option_bool_new(
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
140 _("Allow plaintext auth over unencrypted streams"),
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
141 "auth_plain_in_clear", FALSE);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
142 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
143 option);
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26041
diff changeset
144
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
145 option = purple_account_option_int_new(_("Connect port"), "port", 5222);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
146 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
147 option);
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
148
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18996
diff changeset
149 option = purple_account_option_string_new(_("Connect server"),
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
150 "connect_server", NULL);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
151 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
152 option);
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
153
21688
a16385b34219 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents: 21395
diff changeset
154 option = purple_account_option_string_new(_("File transfer proxies"),
a16385b34219 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents: 21395
diff changeset
155 "ft_proxies",
27060
f73b519db0c9 Marcus convinced me (I didn't need much) this is a better idea.
Paul Aurich <darkrain42@pidgin.im>
parents: 27059
diff changeset
156 /* TODO: Is this an acceptable default?
f73b519db0c9 Marcus convinced me (I didn't need much) this is a better idea.
Paul Aurich <darkrain42@pidgin.im>
parents: 27059
diff changeset
157 * Also, keep this in sync as they add more servers */
29370
9ff8f3bdd0f5 jabber: Update the default FT proxy (if it's still set as the previous, broken, default).
Paul Aurich <darkrain42@pidgin.im>
parents: 29292
diff changeset
158 JABBER_DEFAULT_FT_PROXIES);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
159 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
21688
a16385b34219 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents: 21395
diff changeset
160 option);
a16385b34219 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents: 21395
diff changeset
161
27397
690965a5ff24 Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents: 27225
diff changeset
162 option = purple_account_option_string_new(_("BOSH URL"),
690965a5ff24 Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents: 27225
diff changeset
163 "bosh_url", NULL);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
164 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
27397
690965a5ff24 Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents: 27225
diff changeset
165 option);
690965a5ff24 Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents: 27225
diff changeset
166
23626
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
167 /* this should probably be part of global smiley theme settings later on,
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
168 shared with MSN */
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
169 option = purple_account_option_bool_new(_("Show Custom Smileys"),
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
170 "custom_smileys", TRUE);
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
171 proto_class->protocol_options = g_list_append(proto_class->protocol_options,
23626
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
172 option);
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 23277
diff changeset
173
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
174 purple_prefs_remove("/protocols/jabber");
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
175 }
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
176
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
177 static void xmpp_protocol_base_finalize(XMPPProtocolClass *klass) { }
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
178 static void xmpp_protocol_interface_init(PurpleProtocolInterface *iface) { }
21717
424d552a8435 Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
179
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
180 static PurplePluginInfo *
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
181 plugin_query(GError **error)
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
182 {
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
183 return purple_plugin_info_new(
36638
5f6dcd83e8c1 Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
184 "id", "protocol-xmpp",
5f6dcd83e8c1 Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
185 "name", "XMPP Protocol",
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
186 "version", DISPLAY_VERSION,
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
187 "category", N_("Protocol"),
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
188 "summary", N_("XMPP Protocol Plugin"),
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
189 "description", N_("XMPP Protocol Plugin"),
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
190 "website", PURPLE_WEBSITE,
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
191 "abi-version", PURPLE_ABI_VERSION,
36653
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
192 "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL |
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
193 PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
194 NULL
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
195 );
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
196 }
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
197
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
198 static gboolean
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
199 plugin_load(PurplePlugin *plugin, GError **error)
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
200 {
36628
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
201 my_protocol = purple_protocols_add(XMPP_TYPE_PROTOCOL, error);
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
202 if (!my_protocol)
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
203 return FALSE;
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
204
36525
ea477f05a2ea Connect signals by protocol instead of plugin
Ankit Vani <a@nevitus.org>
parents: 36509
diff changeset
205 purple_signal_connect(purple_get_core(), "uri-handler", my_protocol,
28136
a3b6446eb2c4 Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents: 27601
diff changeset
206 PURPLE_CALLBACK(xmpp_uri_handler), NULL);
36496
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
207
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
208 jabber_protocol_init(my_protocol);
36496
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
209 return TRUE;
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210 }
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
211
36496
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
212 static gboolean
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
213 plugin_unload(PurplePlugin *plugin, GError **error)
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
214 {
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
215 jabber_protocol_uninit(my_protocol);
36628
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
216 if (!purple_protocols_remove(my_protocol, error))
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
217 return FALSE;
16303
0dd957edcc0a Very important to add files \!
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218
36496
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
219 return TRUE;
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
220 }
e7fe371c60a6 Refactored jabber to use the new API
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
221
36613
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
222 extern PurplePlugin *_jabber_plugin;
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
223
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
224 PURPLE_PROTOCOL_DEFINE_EXTENDED(_jabber_plugin, XMPPProtocol, xmpp_protocol,
36582
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
225 JABBER_TYPE_PROTOCOL, 0);
095b9c85c45c Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36545
diff changeset
226
36613
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
227 PURPLE_PLUGIN_INIT_VAL(_jabber_plugin, jabber, plugin_query, plugin_load,
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
228 plugin_unload);

mercurial