2 * @file purple-private.h
6 * Copyright (C) 2010-2015 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 #define PurpleIMTypingState PurpleTypingState
46 #define _PurpleProtocolAction _PurplePluginAction
49 /* Forward declarations */
50 struct sipe_chat_session
;
51 struct sipe_core_public
;
52 struct _PurpleAccount
;
53 struct _PurpleBlistNode
;
56 struct _PurpleConnection
;
57 struct _PurpleConversation
;
59 struct _PurpleMessage
;
60 struct _PurplePluginAction
;
61 struct _PurpleRoomlist
;
65 #ifndef _PurpleMessageFlags
66 #define _PurpleMessageFlags int
69 struct sipe_backend_private
{
70 struct sipe_core_public
*public;
71 struct _PurpleConnection
*gc
;
72 struct _PurpleAccount
*account
;
73 struct _PurpleRoomlist
*roomlist
;
74 /* see sipe_backend_chat_create() */
75 struct sipe_chat_session
*adium_chat_session
;
76 GHashTable
*roomlist_map
; /* name -> uri */
81 /* work around broken libpurple idle notification */
82 gchar
*deferred_status_note
;
83 guint deferred_status_activity
;
84 guint deferred_status_timeout
;
87 gboolean status_changed_by_core
; /* status changed by core */
88 gboolean user_is_not_idle
; /* user came back online */
91 struct sipe_backend_fd
{
95 /* Status attributes */
96 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
98 const gchar
*sipe_purple_activity_to_token(guint type
);
99 guint
sipe_purple_token_to_activity(const gchar
*token
);
102 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private
*purple_private
);
105 * Initiates outgoing file transfer, sending @c file to remote peer identified
108 * @param gc a PurpleConnection
109 * @param who string identifying receiver of the file
110 * @param file local file system path of the file to send
112 void sipe_purple_ft_send_file(struct _PurpleConnection
*gc
,
117 * Creates new PurpleXfer structure representing a file transfer.
119 * @param gc a PurpleConnection
120 * @param who remote participant in the file transfer session
122 struct _PurpleXfer
*sipe_purple_ft_new_xfer(struct _PurpleConnection
*gc
,
125 /* libpurple chat callbacks */
126 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
128 struct sipe_chat_session
*sipe_purple_chat_get_session(struct _PurpleConversation
*conv
);
129 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private
*purple_private
);
130 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private
*purple_private
);
131 void sipe_purple_chat_invite(struct _PurpleConnection
*gc
,
135 void sipe_purple_chat_leave(struct _PurpleConnection
*gc
, int id
);
136 int sipe_purple_chat_send(struct _PurpleConnection
*gc
,
138 #if PURPLE_VERSION_CHECK(3,0,0)
139 struct _PurpleMessage
*msg
);
142 _PurpleMessageFlags flags
);
144 GList
*sipe_purple_chat_menu(struct _PurpleChat
*chat
);
146 /* libpurple chat room callbacks */
147 GList
*sipe_purple_chat_info(struct _PurpleConnection
*gc
);
148 GHashTable
*sipe_purple_chat_info_defaults(struct _PurpleConnection
*gc
,
149 const char *chat_name
);
150 void sipe_purple_chat_join(struct _PurpleConnection
*gc
, GHashTable
*data
);
151 struct _PurpleRoomlist
*sipe_purple_roomlist_get_list(struct _PurpleConnection
*gc
);
152 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist
*list
);
154 /* libpurple buddy callbacks */
155 #ifdef PURPLE_VERSION_CHECK
156 void sipe_purple_add_buddy(struct _PurpleConnection
*gc
,
157 struct _PurpleBuddy
*buddy
,
158 struct _PurpleGroup
*group
159 #if PURPLE_VERSION_CHECK(3,0,0)
160 , const gchar
*message
164 void sipe_purple_remove_buddy(struct _PurpleConnection
*gc
,
165 struct _PurpleBuddy
*buddy
,
166 struct _PurpleGroup
*group
);
167 void sipe_purple_group_buddy(struct _PurpleConnection
*gc
,
169 const char *old_group_name
,
170 const char *new_group_name
);
171 GList
*sipe_purple_buddy_menu(struct _PurpleBuddy
*buddy
);
173 /* libpurple search callbacks */
174 void sipe_purple_show_find_contact(struct _PurpleProtocolAction
*action
);
176 /* libpurple status callbacks */
177 void sipe_purple_set_status(struct _PurpleAccount
*account
,
178 struct _PurpleStatus
*status
);
179 void sipe_purple_set_idle(struct _PurpleConnection
*gc
,
183 void capture_pipeline(const gchar
*label
);
186 void sipe_purple_transport_close_all(struct sipe_backend_private
*purple_private
);
188 /* Convenience macros */
189 #if PURPLE_VERSION_CHECK(2,6,0) || PURPLE_VERSION_CHECK(3,0,0)
190 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(account)))
191 #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))))
192 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(gc))
194 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(account)->proto_data)
195 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(purple_buddy_get_account(buddy))->proto_data)
196 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)
199 /* Protocol common functions */
201 gboolean
sipe_purple_plugin_load(PurplePlugin
*plugin
);
202 gboolean
sipe_purple_plugin_unload(PurplePlugin
*plugin
);
204 gpointer
sipe_purple_user_split(void);
205 GList
*sipe_purple_account_options(void);
207 GList
*sipe_purple_actions(void);
208 gchar
*sipe_purple_status_text(struct _PurpleBuddy
*buddy
);
209 void sipe_purple_tooltip_text(struct _PurpleBuddy
*buddy
,
210 struct _PurpleNotifyUserInfo
*user_info
,
212 GList
*sipe_purple_blist_node_menu(struct _PurpleBlistNode
*node
);
213 void sipe_purple_convo_closed(struct _PurpleConnection
*gc
, const char *who
);
214 GHashTable
*sipe_purple_get_account_text_table(struct _PurpleAccount
*account
);
216 void sipe_purple_login(struct _PurpleAccount
*account
);
217 void sipe_purple_close(struct _PurpleConnection
*gc
);
218 GList
*sipe_purple_status_types(struct _PurpleAccount
*account
);
219 const char *sipe_purple_list_icon(struct _PurpleAccount
*account
,
220 struct _PurpleBuddy
*buddy
);
222 void sipe_purple_get_info(struct _PurpleConnection
*gc
, const char *who
);
223 void sipe_purple_alias_buddy(struct _PurpleConnection
*gc
, const char *name
,
225 void sipe_purple_group_rename(struct _PurpleConnection
*gc
, const char *old_name
,
226 struct _PurpleGroup
*group
, GList
*moved_buddies
);
227 void sipe_purple_group_remove(struct _PurpleConnection
*gc
,
228 struct _PurpleGroup
*group
);
230 unsigned int sipe_purple_send_typing(struct _PurpleConnection
*gc
,
231 const char *who
, PurpleIMTypingState state
);
233 void sipe_purple_add_permit(struct _PurpleConnection
*gc
, const char *name
);
234 void sipe_purple_add_deny(struct _PurpleConnection
*gc
, const char *name
);
236 gboolean
sipe_purple_initiate_media(struct _PurpleAccount
*account
,
238 PurpleMediaSessionType type
);
239 PurpleMediaCaps
sipe_purple_get_media_caps(struct _PurpleAccount
*account
,