2 * @file purple-plugin.c
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
32 #include "sipe-common.h"
34 /* Flag needed for correct version of PURPLE_INIT_PLUGIN() */
35 #ifndef PURPLE_PLUGINS
36 #define PURPLE_PLUGINS
40 * as it's determined on runtime, as Pidgin installation can be anywhere.
43 #include "win32/win32dep.h"
46 #include "accountopt.h"
48 #include "connection.h"
60 #include "purple-private.h"
62 #include "sipe-backend.h"
63 #include "sipe-core.h"
66 #include "core-depurple.h"
68 /* Backward compatibility when compiling against 2.4.x API */
69 #if !PURPLE_VERSION_CHECK(2,5,0)
70 #define PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY 0x0100
73 /* Convenience macros */
74 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) buddy->account->gc->proto_data)
76 /* Status attributes (see also sipe_status_types() */
77 #define SIPE_STATUS_ATTR_ID_MESSAGE "message"
79 /* Sipe core activity <-> Purple status mapping */
80 static const gchar
* const activity_to_purple
[SIPE_ACTIVITY_NUM_TYPES
] = {
81 /* SIPE_ACTIVITY_UNSET */ "unset",
82 /* SIPE_ACTIVITY_ONLINE */ "online",
83 /* SIPE_ACTIVITY_INACTIVE */ "idle",
84 /* SIPE_ACTIVITY_BUSY */ "busy",
85 /* SIPE_ACTIVITY_BUSYIDLE */ "busyidle",
86 /* SIPE_ACTIVITY_DND */ "do-not-disturb",
87 /* SIPE_ACTIVITY_BRB */ "be-right-back",
88 /* SIPE_ACTIVITY_AWAY */ "away",
89 /* SIPE_ACTIVITY_LUNCH */ "out-to-lunch",
90 /* SIPE_ACTIVITY_OFFLINE */ "offline",
91 /* SIPE_ACTIVITY_ON_PHONE */ "on-the-phone",
92 /* SIPE_ACTIVITY_IN_CONF */ "in-a-conference",
93 /* SIPE_ACTIVITY_IN_MEETING */ "in-a-meeting",
94 /* SIPE_ACTIVITY_OOF */ "out-of-office",
95 /* SIPE_ACTIVITY_URGENT_ONLY */ "urgent-interruptions-only",
97 GHashTable
*purple_to_activity
= NULL
;
98 #define PURPLE_STATUS_TO_ACTIVITY(x) \
99 GPOINTER_TO_UINT(g_hash_table_lookup(purple_to_activity, (x)))
101 static void purple_activity_init(void)
103 sipe_activity index
= SIPE_ACTIVITY_UNSET
;
104 purple_to_activity
= g_hash_table_new(g_str_hash
, g_str_equal
);
105 while (index
< SIPE_ACTIVITY_NUM_TYPES
) {
106 g_hash_table_insert(purple_to_activity
,
107 (gpointer
) activity_to_purple
[index
],
108 GUINT_TO_POINTER(index
));
113 gchar
*sipe_backend_version(void)
115 return(g_strdup_printf("Purple/%s", purple_core_get_version()));
118 static void purple_activity_destroy(void)
120 g_hash_table_destroy(purple_to_activity
);
121 purple_to_activity
= NULL
;
124 /* PurplePluginProtocolInfo function calls & data structure */
125 static const char *sipe_list_icon(SIPE_UNUSED_PARAMETER PurpleAccount
*a
,
126 SIPE_UNUSED_PARAMETER PurpleBuddy
*b
)
131 static gchar
*sipe_status_text(PurpleBuddy
*buddy
)
133 const PurpleStatus
*status
= purple_presence_get_active_status(purple_buddy_get_presence(buddy
));
134 return sipe_core_buddy_status(PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC
,
136 PURPLE_STATUS_TO_ACTIVITY(purple_status_get_id(status
)),
137 purple_status_get_name(status
));
140 static void sipe_tooltip_text(PurpleBuddy
*buddy
,
141 PurpleNotifyUserInfo
*user_info
,
142 SIPE_UNUSED_PARAMETER gboolean full
)
144 const PurplePresence
*presence
= purple_buddy_get_presence(buddy
);
145 GSList
*info
= sipe_core_buddy_info(PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC
,
147 purple_status_get_name(purple_presence_get_active_status(presence
)),
148 purple_presence_is_online(presence
));
151 struct sipe_buddy_info
*sbi
= info
->data
;
152 purple_notify_user_info_add_pair(user_info
,
153 sbi
->label
, sbi
->text
);
156 info
= g_slist_delete_link(info
, info
);
160 static GList
*sipe_status_types(SIPE_UNUSED_PARAMETER PurpleAccount
*acc
)
162 PurpleStatusType
*type
;
165 /* Macros to reduce code repetition.
167 #define SIPE_ADD_STATUS(prim,id,name,user) type = purple_status_type_new_with_attrs( \
170 SIPE_STATUS_ATTR_ID_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), \
172 types = g_list_append(types, type);
175 SIPE_ADD_STATUS(PURPLE_STATUS_AVAILABLE
,
181 SIPE_ADD_STATUS(PURPLE_STATUS_UNAVAILABLE
,
182 activity_to_purple
[SIPE_ACTIVITY_BUSY
],
187 SIPE_ADD_STATUS(PURPLE_STATUS_UNAVAILABLE
,
188 activity_to_purple
[SIPE_ACTIVITY_DND
],
193 /* Goes first in the list as
194 * purple picks the first status with the AWAY type
197 SIPE_ADD_STATUS(PURPLE_STATUS_AWAY
,
203 SIPE_ADD_STATUS(PURPLE_STATUS_AWAY
,
204 activity_to_purple
[SIPE_ACTIVITY_BRB
],
209 SIPE_ADD_STATUS(PURPLE_STATUS_INVISIBLE
,
215 type
= purple_status_type_new(PURPLE_STATUS_OFFLINE
,
219 types
= g_list_append(types
, type
);
224 static GList
*sipe_blist_node_menu(PurpleBlistNode
*node
)
226 if(PURPLE_BLIST_NODE_IS_BUDDY(node
)) {
227 return sipe_buddy_menu((PurpleBuddy
*) node
);
228 } else if(PURPLE_BLIST_NODE_IS_CHAT(node
)) {
229 return sipe_chat_menu((PurpleChat
*)node
);
235 static void sipe_login(PurpleAccount
*account
)
237 PurpleConnection
*gc
= purple_account_get_connection(account
);
238 const gchar
*username
= purple_account_get_username(account
);
239 const gchar
*email
= purple_account_get_string(account
, "email", NULL
);
240 const gchar
*email_url
= purple_account_get_string(account
, "email_url", NULL
);
241 const gchar
*transport
= purple_account_get_string(account
, "transport", "auto");
242 struct sipe_core_public
*sipe_public
;
243 gchar
**username_split
;
244 gchar
*login_domain
= NULL
;
245 gchar
*login_account
= NULL
;
248 struct sipe_backend_private
*purple_private
;
250 /* username format: <username>,[<optional login>] */
251 SIPE_DEBUG_INFO("sipe_login: username '%s'", username
);
252 username_split
= g_strsplit(username
, ",", 2);
254 /* login name specified? */
255 if (username_split
[1] && strlen(username_split
[1])) {
256 /* Allowed domain-account separators are / or \ */
257 gchar
**domain_user
= g_strsplit_set(username_split
[1], "/\\", 2);
258 gboolean has_domain
= domain_user
[1] != NULL
;
259 SIPE_DEBUG_INFO("sipe_login: login '%s'", username_split
[1]);
260 login_domain
= has_domain
? g_strdup(domain_user
[0]) : NULL
;
261 login_account
= g_strdup(domain_user
[has_domain
? 1 : 0]);
262 SIPE_DEBUG_INFO("sipe_login: auth domain '%s' user '%s'",
263 login_domain
? login_domain
: "",
265 g_strfreev(domain_user
);
268 sipe_public
= sipe_core_allocate(username_split
[0],
269 login_domain
, login_account
,
270 purple_connection_get_password(gc
),
274 g_free(login_domain
);
275 g_free(login_account
);
276 g_strfreev(username_split
);
279 purple_connection_error_reason(gc
,
280 PURPLE_CONNECTION_ERROR_INVALID_USERNAME
,
285 sipe_public
->backend_private
= purple_private
= g_new0(struct sipe_backend_private
, 1);
286 purple_private
->public = sipe_public
;
287 purple_private
->gc
= gc
;
288 purple_private
->account
= account
;
291 if (purple_account_get_bool(account
, "krb5", FALSE
))
292 SIPE_CORE_FLAG_SET(KRB5
);
294 /* @TODO: is this correct?
295 "sso" is only available when Kerberos support is compiled in */
296 if (purple_account_get_bool(account
, "sso", TRUE
))
297 SIPE_CORE_FLAG_SET(SSO
);
299 gc
->proto_data
= sipe_public
;
300 sipe_purple_setup(sipe_public
, gc
);
301 gc
->flags
|= PURPLE_CONNECTION_HTML
| PURPLE_CONNECTION_FORMATTING_WBFO
| PURPLE_CONNECTION_NO_BGCOLOR
|
302 PURPLE_CONNECTION_NO_FONTSIZE
| PURPLE_CONNECTION_NO_URLDESC
| PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY
;
303 purple_connection_set_display_name(gc
, sipe_public
->sip_name
);
304 purple_connection_update_progress(gc
, _("Connecting"), 1, 2);
306 username_split
= g_strsplit(purple_account_get_string(account
, "server", ""), ":", 2);
307 if (sipe_strequal(transport
, "auto")) {
308 type
= (username_split
[0] == NULL
) ?
309 SIPE_TRANSPORT_AUTO
: SIPE_TRANSPORT_TLS
;
310 } else if (sipe_strequal(transport
, "tls")) {
311 type
= SIPE_TRANSPORT_TLS
;
313 type
= SIPE_TRANSPORT_TCP
;
315 sipe_core_transport_sip_connect(sipe_public
,
318 username_split
[0] ? username_split
[1] : NULL
);
319 g_strfreev(username_split
);
322 static void sipe_close(PurpleConnection
*gc
)
324 struct sipe_core_public
*sipe_public
= PURPLE_GC_TO_SIPE_CORE_PUBLIC
;
327 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
329 sipe_core_deallocate(sipe_public
);
331 if (purple_private
->roomlist_map
)
332 g_hash_table_destroy(purple_private
->roomlist_map
);
333 g_free(purple_private
);
334 gc
->proto_data
= NULL
;
338 #define SIPE_TYPING_SEND_TIMEOUT 4
340 static unsigned int sipe_send_typing(PurpleConnection
*gc
,
342 PurpleTypingState state
)
344 if (state
== PURPLE_NOT_TYPING
)
347 sipe_core_user_feedback_typing(PURPLE_GC_TO_SIPE_CORE_PUBLIC
,
350 return SIPE_TYPING_SEND_TIMEOUT
;
353 static void sipe_add_permit(PurpleConnection
*gc
, const char *name
)
355 sipe_core_contact_allow_deny(PURPLE_GC_TO_SIPE_CORE_PUBLIC
, name
, TRUE
);
358 static void sipe_add_deny(PurpleConnection
*gc
, const char *name
)
360 sipe_core_contact_allow_deny(PURPLE_GC_TO_SIPE_CORE_PUBLIC
, name
, FALSE
);
363 static void sipe_chat_invite(PurpleConnection
*gc
, int id
,
364 SIPE_UNUSED_PARAMETER
const char *message
,
367 sipe_core_chat_create(PURPLE_GC_TO_SIPE_CORE_PUBLIC
, id
, name
);
370 static void sipe_keep_alive(PurpleConnection
*gc
)
372 struct sipe_core_public
*sipe_public
= PURPLE_GC_TO_SIPE_CORE_PUBLIC
;
373 struct sipe_backend_private
*purple_private
= sipe_public
->backend_private
;
374 time_t now
= time(NULL
);
376 if ((sipe_public
->keepalive_timeout
> 0) &&
377 ((guint
) (now
- purple_private
->last_keepalive
) >= sipe_public
->keepalive_timeout
) &&
378 ((guint
) (now
- gc
->last_received
) >= sipe_public
->keepalive_timeout
)
380 sipe_core_transport_sip_keepalive(sipe_public
);
381 purple_private
->last_keepalive
= now
;
385 static void sipe_alias_buddy(PurpleConnection
*gc
, const char *name
,
386 SIPE_UNUSED_PARAMETER
const char *alias
)
388 sipe_core_group_set_user(PURPLE_GC_TO_SIPE_CORE_PUBLIC
, name
);
391 #if PURPLE_VERSION_CHECK(2,5,0)
393 sipe_get_account_text_table(SIPE_UNUSED_PARAMETER PurpleAccount
*account
)
396 table
= g_hash_table_new(g_str_hash
, g_str_equal
);
397 g_hash_table_insert(table
, "login_label", (gpointer
)_("user@company.com"));
401 #if PURPLE_VERSION_CHECK(2,6,0)
403 static gboolean
sipe_initiate_media(PurpleAccount
*account
, const char *who
,
404 SIPE_UNUSED_PARAMETER PurpleMediaSessionType type
)
406 sipe_core_media_initiate_call(PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC
,
408 (type
& PURPLE_MEDIA_VIDEO
));
412 static PurpleMediaCaps
sipe_get_media_caps(SIPE_UNUSED_PARAMETER PurpleAccount
*account
,
413 SIPE_UNUSED_PARAMETER
const char *who
)
415 return PURPLE_MEDIA_CAPS_AUDIO
416 | PURPLE_MEDIA_CAPS_AUDIO_VIDEO
417 | PURPLE_MEDIA_CAPS_MODIFY_SESSION
;
423 static PurplePluginProtocolInfo prpl_info
=
425 OPT_PROTO_CHAT_TOPIC
,
426 NULL
, /* user_splits */
427 NULL
, /* protocol_options */
428 NO_BUDDY_ICONS
, /* icon_spec */
429 sipe_list_icon
, /* list_icon */
430 NULL
, /* list_emblems */
431 sipe_status_text
, /* status_text */
432 sipe_tooltip_text
, /* tooltip_text */ // add custom info to contact tooltip
433 sipe_status_types
, /* away_states */
434 sipe_blist_node_menu
, /* blist_node_menu */
435 sipe_chat_info
, /* chat_info */
436 sipe_chat_info_defaults
, /* chat_info_defaults */
437 sipe_login
, /* login */
438 sipe_close
, /* close */
439 sipe_im_send
, /* send_im */
440 NULL
, /* set_info */ // TODO maybe
441 sipe_send_typing
, /* send_typing */
442 sipe_get_info
, /* get_info */
443 sipe_set_status
, /* set_status */
444 sipe_set_idle
, /* set_idle */
445 NULL
, /* change_passwd */
446 sipe_add_buddy
, /* add_buddy */
447 NULL
, /* add_buddies */
448 sipe_remove_buddy
, /* remove_buddy */
449 NULL
, /* remove_buddies */
450 sipe_add_permit
, /* add_permit */
451 sipe_add_deny
, /* add_deny */
452 sipe_add_deny
, /* rem_permit */
453 sipe_add_permit
, /* rem_deny */
454 NULL
, /* set_permit_deny */
455 sipe_join_chat
, /* join_chat */
456 NULL
, /* reject_chat */
457 NULL
, /* get_chat_name */
458 sipe_chat_invite
, /* chat_invite */
459 sipe_chat_leave
, /* chat_leave */
460 NULL
, /* chat_whisper */
461 sipe_chat_send
, /* chat_send */
462 sipe_keep_alive
, /* keepalive */
463 NULL
, /* register_user */
464 NULL
, /* get_cb_info */ // deprecated
465 NULL
, /* get_cb_away */ // deprecated
466 sipe_alias_buddy
, /* alias_buddy */
467 sipe_group_buddy
, /* group_buddy */
468 sipe_rename_group
, /* rename_group */
469 NULL
, /* buddy_free */
470 sipe_convo_closed
, /* convo_closed */
471 purple_normalize_nocase
, /* normalize */
472 NULL
, /* set_buddy_icon */
473 sipe_remove_group
, /* remove_group */
474 NULL
, /* get_cb_real_name */ // TODO?
475 NULL
, /* set_chat_topic */
476 NULL
, /* find_blist_chat */
477 sipe_roomlist_get_list
, /* roomlist_get_list */
478 sipe_roomlist_cancel
, /* roomlist_cancel */
479 NULL
, /* roomlist_expand_category */
480 NULL
, /* can_receive_file */
481 sipe_ft_send_file
, /* send_file */
482 sipe_ft_new_xfer
, /* new_xfer */
483 NULL
, /* offline_message */
484 NULL
, /* whiteboard_prpl_ops */
486 NULL
, /* roomlist_room_serialize */
487 NULL
, /* unregister_user */
488 NULL
, /* send_attention */
489 NULL
, /* get_attention_types */
490 #if !PURPLE_VERSION_CHECK(2,5,0)
491 /* Backward compatibility when compiling against 2.4.x API */
492 (void (*)(void)) /* _purple_reserved4 */
494 sizeof(PurplePluginProtocolInfo
), /* struct_size */
495 #if PURPLE_VERSION_CHECK(2,5,0)
496 sipe_get_account_text_table
, /* get_account_text_table */
497 #if PURPLE_VERSION_CHECK(2,6,0)
499 sipe_initiate_media
, /* initiate_media */
500 sipe_get_media_caps
, /* get_media_caps */
502 NULL
, /* initiate_media */
503 NULL
, /* get_media_caps */
505 #if PURPLE_VERSION_CHECK(2,7,0)
506 NULL
, /* get_moods */
507 NULL
, /* set_public_alias */
508 NULL
, /* get_public_alias */
514 /* PurplePluginInfo function calls & data structure */
515 static gboolean
sipe_plugin_load(SIPE_UNUSED_PARAMETER PurplePlugin
*plugin
)
520 static gboolean
sipe_plugin_unload(SIPE_UNUSED_PARAMETER PurplePlugin
*plugin
)
525 static void sipe_plugin_destroy(SIPE_UNUSED_PARAMETER PurplePlugin
*plugin
)
529 purple_activity_destroy();
532 entry
= prpl_info
.protocol_options
;
534 purple_account_option_destroy(entry
->data
);
535 entry
= g_list_delete_link(entry
, entry
);
537 prpl_info
.protocol_options
= NULL
;
539 entry
= prpl_info
.user_splits
;
541 purple_account_user_split_destroy(entry
->data
);
542 entry
= g_list_delete_link(entry
, entry
);
544 prpl_info
.user_splits
= NULL
;
547 static void sipe_show_about_plugin(PurplePluginAction
*action
)
549 gchar
*tmp
= sipe_core_about();
550 purple_notify_formatted((PurpleConnection
*) action
->context
,
551 NULL
, " ", NULL
, tmp
, NULL
, NULL
);
555 static void sipe_show_find_contact(PurplePluginAction
*action
)
557 PurpleConnection
*gc
= (PurpleConnection
*) action
->context
;
558 PurpleRequestFields
*fields
;
559 PurpleRequestFieldGroup
*group
;
560 PurpleRequestField
*field
;
562 fields
= purple_request_fields_new();
563 group
= purple_request_field_group_new(NULL
);
564 purple_request_fields_add_group(fields
, group
);
566 field
= purple_request_field_string_new("givenName", _("First name"), NULL
, FALSE
);
567 purple_request_field_group_add_field(group
, field
);
568 field
= purple_request_field_string_new("sn", _("Last name"), NULL
, FALSE
);
569 purple_request_field_group_add_field(group
, field
);
570 field
= purple_request_field_string_new("company", _("Company"), NULL
, FALSE
);
571 purple_request_field_group_add_field(group
, field
);
572 field
= purple_request_field_string_new("c", _("Country"), NULL
, FALSE
);
573 purple_request_field_group_add_field(group
, field
);
575 purple_request_fields(gc
,
577 _("Search for a contact"),
578 _("Enter the information for the person you wish to find. Empty fields will be ignored."),
580 _("_Search"), G_CALLBACK(sipe_search_contact_with_cb
),
582 purple_connection_get_account(gc
), NULL
, NULL
, gc
);
585 static void sipe_republish_calendar(PurplePluginAction
*action
)
587 PurpleConnection
*gc
= (PurpleConnection
*) action
->context
;
588 sipe_core_update_calendar(PURPLE_GC_TO_SIPE_CORE_PUBLIC
);
591 static void sipe_reset_status(PurplePluginAction
*action
)
593 PurpleConnection
*gc
= (PurpleConnection
*) action
->context
;
594 sipe_core_reset_status(PURPLE_GC_TO_SIPE_CORE_PUBLIC
);
597 static GList
*sipe_actions(SIPE_UNUSED_PARAMETER PurplePlugin
*plugin
,
598 SIPE_UNUSED_PARAMETER gpointer context
)
601 PurplePluginAction
*act
;
603 act
= purple_plugin_action_new(_("About SIPE plugin..."), sipe_show_about_plugin
);
604 menu
= g_list_prepend(menu
, act
);
606 act
= purple_plugin_action_new(_("Contact search..."), sipe_show_find_contact
);
607 menu
= g_list_prepend(menu
, act
);
609 act
= purple_plugin_action_new(_("Republish Calendar"), sipe_republish_calendar
);
610 menu
= g_list_prepend(menu
, act
);
612 act
= purple_plugin_action_new(_("Reset status"), sipe_reset_status
);
613 menu
= g_list_prepend(menu
, act
);
615 return g_list_reverse(menu
);
618 static PurplePluginInfo info
= {
620 PURPLE_MAJOR_VERSION
,
621 PURPLE_MINOR_VERSION
,
622 PURPLE_PLUGIN_PROTOCOL
, /**< type */
623 NULL
, /**< ui_requirement */
625 NULL
, /**< dependencies */
626 PURPLE_PRIORITY_DEFAULT
, /**< priority */
627 "prpl-sipe", /**< id */
628 "Office Communicator", /**< name */
629 PACKAGE_VERSION
, /**< version */
630 "Microsoft Office Communicator Protocol Plugin", /**< summary */
631 "A plugin for the extended SIP/SIMPLE protocol used by " /**< description */
632 "Microsoft Live/Office Communications Server (LCS2005/OCS2007+)", /**< description */
633 "Anibal Avelar <avelar@gmail.com>, " /**< author */
634 "Gabriel Burt <gburt@novell.com>, " /**< author */
635 "Stefan Becker <stefan.becker@nokia.com>, " /**< author */
636 "pier11 <pier11@operamail.com>", /**< author */
637 PACKAGE_URL
, /**< homepage */
638 sipe_plugin_load
, /**< load */
639 sipe_plugin_unload
, /**< unload */
640 sipe_plugin_destroy
, /**< destroy */
641 NULL
, /**< ui_info */
642 &prpl_info
, /**< extra_info */
651 static void init_plugin(PurplePlugin
*plugin
)
653 PurpleAccountUserSplit
*split
;
654 PurpleAccountOption
*option
;
656 /* This needs to be called first */
657 sipe_core_init(LOCALEDIR
);
658 purple_activity_init();
660 purple_plugin_register(plugin
);
663 * When adding new string settings please make sure to keep these
667 * purple-settings.c:setting_name[]
669 split
= purple_account_user_split_new(_("Login\n user or DOMAIN\\user or\n user@company.com"), NULL
, ',');
670 purple_account_user_split_set_reverse(split
, FALSE
);
671 prpl_info
.user_splits
= g_list_append(prpl_info
.user_splits
, split
);
673 option
= purple_account_option_string_new(_("Server[:Port]\n(leave empty for auto-discovery)"), "server", "");
674 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
676 option
= purple_account_option_list_new(_("Connection type"), "transport", NULL
);
677 purple_account_option_add_list_item(option
, _("Auto"), "auto");
678 purple_account_option_add_list_item(option
, _("SSL/TLS"), "tls");
679 purple_account_option_add_list_item(option
, _("TCP"), "tcp");
680 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
682 /*option = purple_account_option_bool_new(_("Publish status (note: everyone may watch you)"), "doservice", TRUE);
683 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);*/
685 option
= purple_account_option_string_new(_("User Agent"), "useragent", "");
686 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
689 option
= purple_account_option_bool_new(_("Use Kerberos"), "krb5", FALSE
);
690 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
692 /* Suitable for sspi/NTLM, sspi/Kerberos and krb5 security mechanisms
693 * No login/password is taken into account if this option present,
694 * instead used default credentials stored in OS.
696 option
= purple_account_option_bool_new(_("Use Single Sign-On"), "sso", TRUE
);
697 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
700 /** Example (Exchange): https://server.company.com/EWS/Exchange.asmx
701 * Example (Domino) : https://[domino_server]/[mail_database_name].nsf
703 option
= purple_account_option_string_new(_("Email services URL\n(leave empty for auto-discovery)"), "email_url", "");
704 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
706 option
= purple_account_option_string_new(_("Email address\n(if different from Username)"), "email", "");
707 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
709 /** Example (Exchange): DOMAIN\user or user@company.com
710 * Example (Domino) : email_address
712 option
= purple_account_option_string_new(_("Email login\n(if different from Login)"), "email_login", "");
713 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
715 option
= purple_account_option_string_new(_("Email password\n(if different from Password)"), "email_password", "");
716 purple_account_option_set_masked(option
, TRUE
);
717 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
719 /** Example (federated domain): company.com (i.e. ocschat@company.com)
720 * Example (non-default user): user@company.com
722 option
= purple_account_option_string_new(_("Group Chat Proxy\n company.com or user@company.com\n(leave empty to determine from Username)"), "groupchat_user", "");
723 prpl_info
.protocol_options
= g_list_append(prpl_info
.protocol_options
, option
);
726 /* This macro makes the code a purple plugin */
727 PURPLE_INIT_PLUGIN(sipe
, init_plugin
, info
);