core cleanup: xmlnode replacement in sipe-ews.c
[siplcs.git] / src / purple / purple-plugin.c
blob226f263cf2a583cae64805db09da5c9ce0e47f57
1 /**
2 * @file purple-plugin.c
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include <stdlib.h>
28 #include <time.h>
30 #ifndef PURPLE_PLUGINS
31 #define PURPLE_PLUGINS
32 #endif
34 /* for LOCALEDIR */
35 #ifdef _WIN32
36 #include "win32dep.h"
37 #endif
39 #include "sipe-common.h"
41 #include "accountopt.h"
42 #include "prpl.h"
43 #include "plugin.h"
45 #include "sipe-nls.h"
47 #include "sipe-core-api.h"
48 #include "sipe-backend-debug.h"
50 #include "core-depurple.h"
52 void sipe_plugin_destroy(SIPE_UNUSED_PARAMETER PurplePlugin *plugin)
54 GList *entry;
56 sip_sec_destroy();
58 entry = prpl_info.protocol_options;
59 while (entry) {
60 purple_account_option_destroy(entry->data);
61 entry = g_list_delete_link(entry, entry);
63 prpl_info.protocol_options = NULL;
65 entry = prpl_info.user_splits;
66 while (entry) {
67 purple_account_user_split_destroy(entry->data);
68 entry = g_list_delete_link(entry, entry);
70 prpl_info.user_splits = NULL;
73 static void init_plugin(PurplePlugin *plugin)
75 PurpleAccountUserSplit *split;
76 PurpleAccountOption *option;
78 srand(time(NULL));
79 sip_sec_init();
81 #ifdef ENABLE_NLS
82 SIPE_DEBUG_INFO("bindtextdomain = %s",
83 bindtextdomain(PACKAGE_NAME, LOCALEDIR));
84 SIPE_DEBUG_INFO("bind_textdomain_codeset = %s",
85 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"));
86 textdomain(PACKAGE_NAME);
87 #endif
89 purple_plugin_register(plugin);
91 split = purple_account_user_split_new(_("Login\n user or DOMAIN\\user or\n user@company.com"), NULL, ',');
92 purple_account_user_split_set_reverse(split, FALSE);
93 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
95 option = purple_account_option_string_new(_("Server[:Port]\n(leave empty for auto-discovery)"), "server", "");
96 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
98 option = purple_account_option_list_new(_("Connection type"), "transport", NULL);
99 purple_account_option_add_list_item(option, _("Auto"), "auto");
100 purple_account_option_add_list_item(option, _("SSL/TLS"), "tls");
101 purple_account_option_add_list_item(option, _("TCP"), "tcp");
102 purple_account_option_add_list_item(option, _("UDP"), "udp");
103 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
105 /*option = purple_account_option_bool_new(_("Publish status (note: everyone may watch you)"), "doservice", TRUE);
106 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);*/
108 option = purple_account_option_string_new(_("User Agent"), "useragent", "");
109 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
111 #ifdef HAVE_KERBEROS
112 option = purple_account_option_bool_new(_("Use Kerberos"), "krb5", FALSE);
113 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
115 /* Suitable for sspi/NTLM, sspi/Kerberos and krb5 security mechanisms
116 * No login/password is taken into account if this option present,
117 * instead used default credentials stored in OS.
119 option = purple_account_option_bool_new(_("Use Single Sign-On"), "sso", TRUE);
120 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
121 #endif
123 option = purple_account_option_list_new(_("Calendar source"), "calendar", NULL);
124 purple_account_option_add_list_item(option, _("Exchange 2007/2010"), "EXCH");
125 purple_account_option_add_list_item(option, _("None"), "NONE");
126 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
128 /** Example: https://server.company.com/EWS/Exchange.asmx */
129 option = purple_account_option_string_new(_("Email services URL\n(leave empty for auto-discovery)"), "email_url", "");
130 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
132 option = purple_account_option_string_new(_("Email address\n(if different from Username)"), "email", "");
133 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
135 /** Example: DOMAIN\user or user@company.com */
136 option = purple_account_option_string_new(_("Email login\n(if different from Login)"), "email_login", "");
137 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
139 option = purple_account_option_string_new(_("Email password\n(if different from Password)"), "email_password", "");
140 purple_account_option_set_masked(option, TRUE);
141 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
144 PURPLE_INIT_PLUGIN(sipe, init_plugin, info);
147 Local Variables:
148 mode: c
149 c-file-style: "bsd"
150 indent-tabs-mode: t
151 tab-width: 8
152 End: