2 * @file purple-private.h
6 * Copyright (C) 2010-2019 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 /* Forward declarations */
49 struct _PurpleProtocolAction
;
50 struct _PurpleProtocolXfer
;
52 #include "conversation.h" /* PurpleTypingState */
53 #include "plugin.h" /* PurplePlugin */
54 #define PurpleIMTypingState PurpleTypingState
55 #define _PurpleProtocolAction _PurplePluginAction
57 /* Forward declarations */
58 struct _PurplePluginAction
;
61 /* Forward declarations */
62 struct sipe_chat_session
;
63 struct sipe_core_public
;
64 struct _PurpleAccount
;
65 struct _PurpleBlistNode
;
68 struct _PurpleConnection
;
69 struct _PurpleConversation
;
71 struct _PurpleMessage
;
72 struct _PurpleNotifyUserInfo
;
73 struct _PurpleRoomlist
;
77 #ifndef _PurpleMessageFlags
78 #define _PurpleMessageFlags int
81 struct sipe_backend_private
{
82 struct sipe_core_public
*public;
83 struct _PurpleConnection
*gc
;
84 struct _PurpleAccount
*account
;
85 struct _PurpleRoomlist
*roomlist
;
86 /* see sipe_backend_chat_create() */
87 struct sipe_chat_session
*adium_chat_session
;
88 GHashTable
*roomlist_map
; /* name -> uri */
93 /* work around broken libpurple idle notification */
94 gchar
*deferred_status_note
;
95 guint deferred_status_activity
;
96 guint deferred_status_timeout
;
99 gboolean status_changed_by_core
; /* status changed by core */
100 gboolean user_is_not_idle
; /* user came back online */
103 struct sipe_backend_fd
{
107 /* Status attributes */
108 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
110 const gchar
*sipe_purple_activity_to_token(guint type
);
111 guint
sipe_purple_token_to_activity(const gchar
*token
);
114 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private
*purple_private
);
117 * Initiates outgoing file transfer, sending @c file to remote peer identified
120 * @param gc a PurpleConnection
121 * @param who string identifying receiver of the file
122 * @param file local file system path of the file to send
124 void sipe_purple_ft_send_file(
125 #if PURPLE_VERSION_CHECK(3,0,0)
126 struct _PurpleProtocolXfer
*xfer
,
128 struct _PurpleConnection
*gc
,
132 void sipe_purple_xfer_register(GTypeModule
*module
);
134 /* libpurple chat callbacks */
135 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
137 struct sipe_chat_session
*sipe_purple_chat_get_session(struct _PurpleConversation
*conv
);
138 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private
*purple_private
);
139 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private
*purple_private
);
140 void sipe_purple_chat_invite(struct _PurpleConnection
*gc
,
144 void sipe_purple_chat_leave(struct _PurpleConnection
*gc
, int id
);
145 int sipe_purple_chat_send(struct _PurpleConnection
*gc
,
147 #if PURPLE_VERSION_CHECK(3,0,0)
148 struct _PurpleMessage
*msg
);
151 _PurpleMessageFlags flags
);
153 GList
*sipe_purple_chat_menu(struct _PurpleChat
*chat
);
155 /* libpurple chat room callbacks */
156 GList
*sipe_purple_chat_info(struct _PurpleConnection
*gc
);
157 GHashTable
*sipe_purple_chat_info_defaults(struct _PurpleConnection
*gc
,
158 const char *chat_name
);
159 void sipe_purple_chat_join(struct _PurpleConnection
*gc
, GHashTable
*data
);
160 struct _PurpleRoomlist
*sipe_purple_roomlist_get_list(struct _PurpleConnection
*gc
);
161 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist
*list
);
163 /* libpurple buddy callbacks */
164 #ifdef PURPLE_VERSION_CHECK
165 void sipe_purple_add_buddy(struct _PurpleConnection
*gc
,
166 struct _PurpleBuddy
*buddy
,
167 struct _PurpleGroup
*group
168 #if PURPLE_VERSION_CHECK(3,0,0)
169 , const gchar
*message
173 void sipe_purple_remove_buddy(struct _PurpleConnection
*gc
,
174 struct _PurpleBuddy
*buddy
,
175 struct _PurpleGroup
*group
);
176 void sipe_purple_group_buddy(struct _PurpleConnection
*gc
,
178 const char *old_group_name
,
179 const char *new_group_name
);
180 GList
*sipe_purple_buddy_menu(struct _PurpleBuddy
*buddy
);
182 /* libpurple search callbacks */
183 void sipe_purple_show_find_contact(struct _PurpleProtocolAction
*action
);
185 /* libpurple status callbacks */
186 void sipe_purple_set_status(struct _PurpleAccount
*account
,
187 struct _PurpleStatus
*status
);
188 void sipe_purple_set_idle(struct _PurpleConnection
*gc
,
192 void capture_pipeline(const gchar
*label
);
195 void sipe_purple_transport_close_all(struct sipe_backend_private
*purple_private
);
197 /* Convenience macros */
198 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(account)))
199 #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))))
200 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(gc))
202 /* Protocol common functions */
204 gboolean
sipe_purple_plugin_load(PurplePlugin
*plugin
);
205 gboolean
sipe_purple_plugin_unload(PurplePlugin
*plugin
);
207 gpointer
sipe_purple_user_split(void);
208 GList
*sipe_purple_account_options(void);
210 void sipe_purple_republish_calendar(struct _PurpleAccount
*account
);
211 void sipe_purple_reset_status(struct _PurpleAccount
*account
);
213 GList
*sipe_purple_actions(void);
214 gchar
*sipe_purple_status_text(struct _PurpleBuddy
*buddy
);
215 void sipe_purple_tooltip_text(struct _PurpleBuddy
*buddy
,
216 struct _PurpleNotifyUserInfo
*user_info
,
218 GList
*sipe_purple_blist_node_menu(struct _PurpleBlistNode
*node
);
219 void sipe_purple_convo_closed(struct _PurpleConnection
*gc
, const char *who
);
220 GHashTable
*sipe_purple_get_account_text_table(struct _PurpleAccount
*account
);
222 void sipe_purple_login(struct _PurpleAccount
*account
);
223 void sipe_purple_close(struct _PurpleConnection
*gc
);
224 GList
*sipe_purple_status_types(struct _PurpleAccount
*account
);
225 const char *sipe_purple_list_icon(struct _PurpleAccount
*account
,
226 struct _PurpleBuddy
*buddy
);
228 void sipe_purple_get_info(struct _PurpleConnection
*gc
, const char *who
);
229 void sipe_purple_alias_buddy(struct _PurpleConnection
*gc
, const char *name
,
231 void sipe_purple_group_rename(struct _PurpleConnection
*gc
, const char *old_name
,
232 struct _PurpleGroup
*group
, GList
*moved_buddies
);
233 void sipe_purple_group_remove(struct _PurpleConnection
*gc
,
234 struct _PurpleGroup
*group
);
236 unsigned int sipe_purple_send_typing(struct _PurpleConnection
*gc
,
237 const char *who
, PurpleIMTypingState state
);
239 void sipe_purple_add_permit(struct _PurpleConnection
*gc
, const char *name
);
240 void sipe_purple_add_deny(struct _PurpleConnection
*gc
, const char *name
);
242 gboolean
sipe_purple_initiate_media(struct _PurpleAccount
*account
,
244 PurpleMediaSessionType type
);
245 PurpleMediaCaps
sipe_purple_get_media_caps(struct _PurpleAccount
*account
,