2 * @file purple-private.h
6 * Copyright (C) 2010-2017 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
25 #define SIPE_PURPLE_PLUGIN_ID "prpl-sipe"
26 #define SIPE_PURPLE_PLUGIN_NAME "Office Communicator"
28 #define SIPE_PURPLE_PLUGIN_SUMMARY \
29 "Microsoft Office Communicator Protocol Plugin"
31 #define SIPE_PURPLE_PLUGIN_DESCRIPTION \
32 "A plugin for the extended SIP/SIMPLE protocol used by " \
33 "Microsoft Live/Office Communications/Lync Server (LCS2005/OCS2007+)"
35 #define SIPE_PURPLE_PLUGIN_AUTHORS \
36 "Stefan Becker <chemobejk@gmail.com>, " \
37 "Jakub Adam <jakub.adam@ktknet.cz>, " \
38 "Anibal Avelar <avelar@gmail.com> (retired), " \
39 "pier11 <pier11@operamail.com> (retired), " \
40 "Gabriel Burt <gburt@novell.com> (retired)"
42 #define SIPE_PURPLE_PROTOCOL_OPTIONS OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL
44 #if PURPLE_VERSION_CHECK(3,0,0)
45 #include "conversationtypes.h" /* PurpleIMTypingState */
46 #include "plugins.h" /* PurplePlugin */
48 #include "conversation.h" /* PurpleTypingState */
49 #include "plugin.h" /* PurplePlugin */
50 #define PurpleIMTypingState PurpleTypingState
51 #define _PurpleProtocolAction _PurplePluginAction
54 /* Forward declarations */
55 struct sipe_chat_session
;
56 struct sipe_core_public
;
57 struct _PurpleAccount
;
58 struct _PurpleBlistNode
;
61 struct _PurpleConnection
;
62 struct _PurpleConversation
;
64 struct _PurpleMessage
;
65 struct _PurpleNotifyUserInfo
;
66 struct _PurplePluginAction
;
67 struct _PurpleRoomlist
;
71 #ifndef _PurpleMessageFlags
72 #define _PurpleMessageFlags int
75 struct sipe_backend_private
{
76 struct sipe_core_public
*public;
77 struct _PurpleConnection
*gc
;
78 struct _PurpleAccount
*account
;
79 struct _PurpleRoomlist
*roomlist
;
80 /* see sipe_backend_chat_create() */
81 struct sipe_chat_session
*adium_chat_session
;
82 GHashTable
*roomlist_map
; /* name -> uri */
87 /* work around broken libpurple idle notification */
88 gchar
*deferred_status_note
;
89 guint deferred_status_activity
;
90 guint deferred_status_timeout
;
93 gboolean status_changed_by_core
; /* status changed by core */
94 gboolean user_is_not_idle
; /* user came back online */
97 struct sipe_backend_fd
{
101 /* Status attributes */
102 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
104 const gchar
*sipe_purple_activity_to_token(guint type
);
105 guint
sipe_purple_token_to_activity(const gchar
*token
);
108 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private
*purple_private
);
111 * Initiates outgoing file transfer, sending @c file to remote peer identified
114 * @param gc a PurpleConnection
115 * @param who string identifying receiver of the file
116 * @param file local file system path of the file to send
118 void sipe_purple_ft_send_file(struct _PurpleConnection
*gc
,
122 /* libpurple chat callbacks */
123 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
125 struct sipe_chat_session
*sipe_purple_chat_get_session(struct _PurpleConversation
*conv
);
126 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private
*purple_private
);
127 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private
*purple_private
);
128 void sipe_purple_chat_invite(struct _PurpleConnection
*gc
,
132 void sipe_purple_chat_leave(struct _PurpleConnection
*gc
, int id
);
133 int sipe_purple_chat_send(struct _PurpleConnection
*gc
,
135 #if PURPLE_VERSION_CHECK(3,0,0)
136 struct _PurpleMessage
*msg
);
139 _PurpleMessageFlags flags
);
141 GList
*sipe_purple_chat_menu(struct _PurpleChat
*chat
);
143 /* libpurple chat room callbacks */
144 GList
*sipe_purple_chat_info(struct _PurpleConnection
*gc
);
145 GHashTable
*sipe_purple_chat_info_defaults(struct _PurpleConnection
*gc
,
146 const char *chat_name
);
147 void sipe_purple_chat_join(struct _PurpleConnection
*gc
, GHashTable
*data
);
148 struct _PurpleRoomlist
*sipe_purple_roomlist_get_list(struct _PurpleConnection
*gc
);
149 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist
*list
);
151 /* libpurple buddy callbacks */
152 #ifdef PURPLE_VERSION_CHECK
153 void sipe_purple_add_buddy(struct _PurpleConnection
*gc
,
154 struct _PurpleBuddy
*buddy
,
155 struct _PurpleGroup
*group
156 #if PURPLE_VERSION_CHECK(3,0,0)
157 , const gchar
*message
161 void sipe_purple_remove_buddy(struct _PurpleConnection
*gc
,
162 struct _PurpleBuddy
*buddy
,
163 struct _PurpleGroup
*group
);
164 void sipe_purple_group_buddy(struct _PurpleConnection
*gc
,
166 const char *old_group_name
,
167 const char *new_group_name
);
168 GList
*sipe_purple_buddy_menu(struct _PurpleBuddy
*buddy
);
170 /* libpurple search callbacks */
171 void sipe_purple_show_find_contact(struct _PurpleProtocolAction
*action
);
173 /* libpurple status callbacks */
174 void sipe_purple_set_status(struct _PurpleAccount
*account
,
175 struct _PurpleStatus
*status
);
176 void sipe_purple_set_idle(struct _PurpleConnection
*gc
,
180 void capture_pipeline(const gchar
*label
);
183 void sipe_purple_transport_close_all(struct sipe_backend_private
*purple_private
);
185 /* Convenience macros */
186 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(account)))
187 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(purple_buddy_get_account(buddy))))
188 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(gc))
190 /* Protocol common functions */
192 gboolean
sipe_purple_plugin_load(PurplePlugin
*plugin
);
193 gboolean
sipe_purple_plugin_unload(PurplePlugin
*plugin
);
195 gpointer
sipe_purple_user_split(void);
196 GList
*sipe_purple_account_options(void);
198 void sipe_purple_republish_calendar(struct _PurpleAccount
*account
);
199 void sipe_purple_reset_status(struct _PurpleAccount
*account
);
201 GList
*sipe_purple_actions(void);
202 gchar
*sipe_purple_status_text(struct _PurpleBuddy
*buddy
);
203 void sipe_purple_tooltip_text(struct _PurpleBuddy
*buddy
,
204 struct _PurpleNotifyUserInfo
*user_info
,
206 GList
*sipe_purple_blist_node_menu(struct _PurpleBlistNode
*node
);
207 void sipe_purple_convo_closed(struct _PurpleConnection
*gc
, const char *who
);
208 GHashTable
*sipe_purple_get_account_text_table(struct _PurpleAccount
*account
);
210 void sipe_purple_login(struct _PurpleAccount
*account
);
211 void sipe_purple_close(struct _PurpleConnection
*gc
);
212 GList
*sipe_purple_status_types(struct _PurpleAccount
*account
);
213 const char *sipe_purple_list_icon(struct _PurpleAccount
*account
,
214 struct _PurpleBuddy
*buddy
);
216 void sipe_purple_get_info(struct _PurpleConnection
*gc
, const char *who
);
217 void sipe_purple_alias_buddy(struct _PurpleConnection
*gc
, const char *name
,
219 void sipe_purple_group_rename(struct _PurpleConnection
*gc
, const char *old_name
,
220 struct _PurpleGroup
*group
, GList
*moved_buddies
);
221 void sipe_purple_group_remove(struct _PurpleConnection
*gc
,
222 struct _PurpleGroup
*group
);
224 unsigned int sipe_purple_send_typing(struct _PurpleConnection
*gc
,
225 const char *who
, PurpleIMTypingState state
);
227 void sipe_purple_add_permit(struct _PurpleConnection
*gc
, const char *name
);
228 void sipe_purple_add_deny(struct _PurpleConnection
*gc
, const char *name
);
230 gboolean
sipe_purple_initiate_media(struct _PurpleAccount
*account
,
232 PurpleMediaSessionType type
);
233 PurpleMediaCaps
sipe_purple_get_media_caps(struct _PurpleAccount
*account
,