Thu, 21 May 2020 21:21:54 -0500
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
| 16303 | 1 | /* purple |
| 2 | * | |
| 3 | * Purple is the legal property of its developers, whose names are too numerous | |
| 4 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 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 | 20 | * |
| 21 | */ | |
| 22 | ||
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | |
|
40350
72271baf92bc
Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents:
40331
diff
changeset
|
25 | #include <purple.h> |
|
28136
a3b6446eb2c4
Add support for XMPP URIs on Windows. Closes #2326.
Paul Aurich <darkrain42@pidgin.im>
parents:
27601
diff
changeset
|
26 | |
|
36665
5bef44ba334a
Build a single library for jabber.
Ankit Vani <a@nevitus.org>
parents:
36653
diff
changeset
|
27 | #include "xmpp.h" |
| 16303 | 28 | |
| 29 | static void | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
30 | xmpp_protocol_init(XMPPProtocol *self) |
| 16303 | 31 | { |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
32 | PurpleProtocol *protocol = PURPLE_PROTOCOL(self); |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18996
diff
changeset
|
33 | 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
|
34 | 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
|
35 | 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
|
36 | |
|
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
|
37 | /* 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
|
38 | 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
|
39 | purple_account_user_split_set_reverse(split, FALSE); |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
40 | protocol->user_splits = g_list_append(protocol->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
|
41 | |
|
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
|
42 | 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
|
43 | purple_account_user_split_set_reverse(split, FALSE); |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
44 | protocol->user_splits = g_list_append(protocol->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
|
45 | |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
46 | #define ADD_VALUE(list, desc, v) { \ |
|
40331
684befe3ae5d
Add purple_key_value_pair_new_full with free function for value in PurpleKeyValuePair
qarkai <qarkai@gmail.com>
parents:
40329
diff
changeset
|
47 | PurpleKeyValuePair *kvp = purple_key_value_pair_new_full((desc), g_strdup((v)), g_free); \ |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
48 | 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
|
49 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26041
diff
changeset
|
50 | |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
51 | 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
|
52 | 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
|
53 | 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
|
54 | 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
|
55 | |
|
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
56 | #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
|
57 | |
|
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
58 | option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
59 | protocol->account_options = g_list_append(protocol->account_options, |
|
30740
017077f79a0f
jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <darkrain42@pidgin.im>
parents:
30138
diff
changeset
|
60 | 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
|
61 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18996
diff
changeset
|
62 | 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
|
63 | _("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
|
64 | "auth_plain_in_clear", FALSE); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
65 | protocol->account_options = g_list_append(protocol->account_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
|
66 | 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
|
67 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18996
diff
changeset
|
68 | option = purple_account_option_int_new(_("Connect port"), "port", 5222); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
69 | protocol->account_options = g_list_append(protocol->account_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
|
70 | 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
|
71 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18996
diff
changeset
|
72 | 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
|
73 | "connect_server", NULL); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
74 | protocol->account_options = g_list_append(protocol->account_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
|
75 | 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
|
76 | |
|
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
|
77 | option = purple_account_option_string_new(_("File transfer proxies"), |
|
37198
5813479c8e02
Remove default XMPP file transfer proxy and replace existing defaults in user prefs. See ticket #16535. (ok'd by elb, etan, datallah)
Michael McConville <mmcconville@mykolab.com>
parents:
37163
diff
changeset
|
78 | "ft_proxies", NULL); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
79 | protocol->account_options = g_list_append(protocol->account_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
|
80 | 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
|
81 | |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27225
diff
changeset
|
82 | 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
|
83 | "bosh_url", NULL); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
84 | protocol->account_options = g_list_append(protocol->account_options, |
|
27397
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27225
diff
changeset
|
85 | option); |
|
690965a5ff24
Make "BOSH URL" its own account option.
Paul Aurich <darkrain42@pidgin.im>
parents:
27225
diff
changeset
|
86 | |
|
38082
63975292a852
Remove comment and docstring mentions of MSN
Mike Ruprecht <cmaiku@gmail.com>
parents:
31595
diff
changeset
|
87 | /* this should probably be part of global smiley theme settings |
|
63975292a852
Remove comment and docstring mentions of MSN
Mike Ruprecht <cmaiku@gmail.com>
parents:
31595
diff
changeset
|
88 | * later on |
|
63975292a852
Remove comment and docstring mentions of MSN
Mike Ruprecht <cmaiku@gmail.com>
parents:
31595
diff
changeset
|
89 | */ |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23277
diff
changeset
|
90 | 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
|
91 | "custom_smileys", TRUE); |
|
37038
8832d14d7d0c
Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents:
36984
diff
changeset
|
92 | protocol->account_options = g_list_append(protocol->account_options, |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23277
diff
changeset
|
93 | option); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23277
diff
changeset
|
94 | |
| 36984 | 95 | purple_prefs_remove("/plugins/prpl/jabber"); |
|
36582
095b9c85c45c
Refactored jabber to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
96 | } |
|
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
|
97 | |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
98 | static void |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
99 | xmpp_protocol_class_init(G_GNUC_UNUSED XMPPProtocolClass *klass) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
100 | { |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
101 | } |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
102 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
103 | static void |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
104 | xmpp_protocol_class_finalize(G_GNUC_UNUSED XMPPProtocolClass *klass) |
|
36684
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
105 | { |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
106 | } |
|
ecc74498e088
Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents:
36678
diff
changeset
|
107 | |
|
39894
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
108 | G_DEFINE_DYNAMIC_TYPE(XMPPProtocol, xmpp_protocol, JABBER_TYPE_PROTOCOL); |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
109 | |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
110 | /* This exists solely because the above macro makes xmpp_protocol_register_type |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
111 | * static. */ |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
112 | void |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
113 | xmpp_protocol_register(PurplePlugin *plugin) |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
114 | { |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
115 | xmpp_protocol_register_type(G_TYPE_MODULE(plugin)); |
|
7eab91ea30a1
Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
116 | } |