Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / protocols / jabber / xmpp.c
blobe0008db2e3bd34be78dc01a088cf4c8cf41d1962
1 /* purple
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.
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.
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.
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
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #include "internal.h"
24 #include "chat.h"
25 #include "core.h"
26 #include "plugins.h"
27 #include "purpleaccountusersplit.h"
29 #include "xmpp.h"
31 static void
32 xmpp_protocol_init(XMPPProtocol *self)
34 PurpleProtocol *protocol = PURPLE_PROTOCOL(self);
35 PurpleAccountUserSplit *split;
36 PurpleAccountOption *option;
37 GList *encryption_values = NULL;
39 /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */
40 split = purple_account_user_split_new(_("Domain"), NULL, '@');
41 purple_account_user_split_set_reverse(split, FALSE);
42 protocol->user_splits = g_list_append(protocol->user_splits, split);
44 split = purple_account_user_split_new(_("Resource"), "", '/');
45 purple_account_user_split_set_reverse(split, FALSE);
46 protocol->user_splits = g_list_append(protocol->user_splits, split);
48 #define ADD_VALUE(list, desc, v) { \
49 PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \
50 kvp->key = g_strdup((desc)); \
51 kvp->value = g_strdup((v)); \
52 list = g_list_prepend(list, kvp); \
55 ADD_VALUE(encryption_values, _("Require encryption"), "require_tls");
56 ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls");
57 ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl");
58 encryption_values = g_list_reverse(encryption_values);
60 #undef ADD_VALUE
62 option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values);
63 protocol->account_options = g_list_append(protocol->account_options,
64 option);
66 option = purple_account_option_bool_new(
67 _("Allow plaintext auth over unencrypted streams"),
68 "auth_plain_in_clear", FALSE);
69 protocol->account_options = g_list_append(protocol->account_options,
70 option);
72 option = purple_account_option_int_new(_("Connect port"), "port", 5222);
73 protocol->account_options = g_list_append(protocol->account_options,
74 option);
76 option = purple_account_option_string_new(_("Connect server"),
77 "connect_server", NULL);
78 protocol->account_options = g_list_append(protocol->account_options,
79 option);
81 option = purple_account_option_string_new(_("File transfer proxies"),
82 "ft_proxies", NULL);
83 protocol->account_options = g_list_append(protocol->account_options,
84 option);
86 option = purple_account_option_string_new(_("BOSH URL"),
87 "bosh_url", NULL);
88 protocol->account_options = g_list_append(protocol->account_options,
89 option);
91 /* this should probably be part of global smiley theme settings
92 * later on
94 option = purple_account_option_bool_new(_("Show Custom Smileys"),
95 "custom_smileys", TRUE);
96 protocol->account_options = g_list_append(protocol->account_options,
97 option);
99 purple_prefs_remove("/plugins/prpl/jabber");
102 static void
103 xmpp_protocol_class_init(G_GNUC_UNUSED XMPPProtocolClass *klass)
107 static void
108 xmpp_protocol_class_finalize(G_GNUC_UNUSED XMPPProtocolClass *klass)
112 G_DEFINE_DYNAMIC_TYPE(XMPPProtocol, xmpp_protocol, JABBER_TYPE_PROTOCOL);
114 /* This exists solely because the above macro makes xmpp_protocol_register_type
115 * static. */
116 void
117 xmpp_protocol_register(PurplePlugin *plugin)
119 xmpp_protocol_register_type(G_TYPE_MODULE(plugin));