Standardize all protocol header guard macros.
[pidgin-git.git] / libpurple / protocols / jabber / gtalk.c
blob49547b67ef216172d42d760a518c066bf73d2ee3
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"
28 #include "gtalk.h"
30 static const char *
31 gtalk_list_icon(PurpleAccount *a, PurpleBuddy *b)
33 return "google-talk";
36 static void
37 gtalk_protocol_init(PurpleProtocol *protocol)
39 PurpleAccountUserSplit *split;
40 PurpleAccountOption *option;
41 GList *encryption_values = NULL;
43 protocol->id = "prpl-gtalk";
44 protocol->name = "Google Talk (XMPP)";
46 /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */
47 split = purple_account_user_split_new(_("Domain"), "gmail.com", '@');
48 purple_account_user_split_set_reverse(split, FALSE);
49 protocol->user_splits = g_list_append(protocol->user_splits, split);
51 split = purple_account_user_split_new(_("Resource"), "", '/');
52 purple_account_user_split_set_reverse(split, FALSE);
53 protocol->user_splits = g_list_append(protocol->user_splits, split);
55 #define ADD_VALUE(list, desc, v) { \
56 PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \
57 kvp->key = g_strdup((desc)); \
58 kvp->value = g_strdup((v)); \
59 list = g_list_prepend(list, kvp); \
62 ADD_VALUE(encryption_values, _("Require encryption"), "require_tls");
63 ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls");
64 ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl");
65 encryption_values = g_list_reverse(encryption_values);
67 #undef ADD_VALUE
69 option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values);
70 protocol->account_options = g_list_append(protocol->account_options,
71 option);
73 option = purple_account_option_bool_new(
74 _("Allow plaintext auth over unencrypted streams"),
75 "auth_plain_in_clear", FALSE);
76 protocol->account_options = g_list_append(protocol->account_options,
77 option);
79 option = purple_account_option_int_new(_("Connect port"), "port", 5222);
80 protocol->account_options = g_list_append(protocol->account_options,
81 option);
83 option = purple_account_option_string_new(_("Connect server"),
84 "connect_server", NULL);
85 protocol->account_options = g_list_append(protocol->account_options,
86 option);
88 option = purple_account_option_string_new(_("File transfer proxies"),
89 "ft_proxies", NULL);
90 protocol->account_options = g_list_append(protocol->account_options,
91 option);
93 option = purple_account_option_string_new(_("BOSH URL"),
94 "bosh_url", NULL);
95 protocol->account_options = g_list_append(protocol->account_options,
96 option);
98 /* this should probably be part of global smiley theme settings later on,
99 shared with MSN */
100 option = purple_account_option_bool_new(_("Show Custom Smileys"),
101 "custom_smileys", TRUE);
102 protocol->account_options = g_list_append(protocol->account_options,
103 option);
106 static void
107 gtalk_protocol_class_init(PurpleProtocolClass *klass)
109 klass->list_icon = gtalk_list_icon;
112 static void
113 gtalk_protocol_server_iface_init(PurpleProtocolServerInterface *server_iface)
115 /* disable xmpp functions not available for gtalk */
116 server_iface->register_user = NULL;
117 server_iface->unregister_user = NULL;
120 PURPLE_DEFINE_TYPE_EXTENDED(
121 GTalkProtocol, gtalk_protocol, JABBER_TYPE_PROTOCOL, 0,
123 PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER,
124 gtalk_protocol_server_iface_init)