2 * @file purple-private.h
6 * Copyright (C) 2010-2013 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 /* Forward declarations */
26 struct sipe_core_public
;
27 struct _PurpleAccount
;
30 struct _PurpleConnection
;
32 struct _PurpleMessage
;
33 struct _PurpleRoomlist
;
37 #ifndef _PurpleMessageFlags
38 #define _PurpleMessageFlags int
41 struct sipe_backend_private
{
42 struct sipe_core_public
*public;
43 struct _PurpleConnection
*gc
;
44 struct _PurpleAccount
*account
;
45 struct _PurpleRoomlist
*roomlist
;
46 GHashTable
*roomlist_map
; /* name -> uri */
52 struct sipe_backend_fd
{
56 /* Status attributes */
57 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
59 const gchar
*sipe_purple_activity_to_token(guint type
);
60 guint
sipe_purple_token_to_activity(const gchar
*token
);
63 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private
*purple_private
);
66 * Initiates outgoing file transfer, sending @c file to remote peer identified
69 * @param gc a PurpleConnection
70 * @param who string identifying receiver of the file
71 * @param file local file system path of the file to send
73 void sipe_purple_ft_send_file(struct _PurpleConnection
*gc
,
78 * Creates new PurpleXfer structure representing a file transfer.
80 * @param gc a PurpleConnection
81 * @param who remote participant in the file transfer session
83 struct _PurpleXfer
*sipe_purple_ft_new_xfer(struct _PurpleConnection
*gc
,
86 /* libpurple chat callbacks */
87 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
89 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private
*purple_private
);
90 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private
*purple_private
);
91 void sipe_purple_chat_invite(struct _PurpleConnection
*gc
,
95 void sipe_purple_chat_leave(struct _PurpleConnection
*gc
, int id
);
96 int sipe_purple_chat_send(struct _PurpleConnection
*gc
,
98 #if PURPLE_VERSION_CHECK(3,0,0)
99 struct _PurpleMessage
*msg
);
102 _PurpleMessageFlags flags
);
104 GList
*sipe_purple_chat_menu(struct _PurpleChat
*chat
);
106 /* libpurple chat room callbacks */
107 GList
*sipe_purple_chat_info(struct _PurpleConnection
*gc
);
108 GHashTable
*sipe_purple_chat_info_defaults(struct _PurpleConnection
*gc
,
109 const char *chat_name
);
110 void sipe_purple_chat_join(struct _PurpleConnection
*gc
, GHashTable
*data
);
111 struct _PurpleRoomlist
*sipe_purple_roomlist_get_list(struct _PurpleConnection
*gc
);
112 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist
*list
);
114 /* libpurple buddy callbacks */
115 #ifdef PURPLE_VERSION_CHECK
116 void sipe_purple_add_buddy(struct _PurpleConnection
*gc
,
117 struct _PurpleBuddy
*buddy
,
118 struct _PurpleGroup
*group
119 #if PURPLE_VERSION_CHECK(3,0,0)
120 , const gchar
*message
124 void sipe_purple_remove_buddy(struct _PurpleConnection
*gc
,
125 struct _PurpleBuddy
*buddy
,
126 struct _PurpleGroup
*group
);
127 void sipe_purple_group_buddy(struct _PurpleConnection
*gc
,
129 const char *old_group_name
,
130 const char *new_group_name
);
131 GList
*sipe_purple_buddy_menu(struct _PurpleBuddy
*buddy
);
133 /* libpurple status callbacks */
134 void sipe_purple_set_status(struct _PurpleAccount
*account
,
135 struct _PurpleStatus
*status
);
136 void sipe_purple_set_idle(struct _PurpleConnection
*gc
,
140 void capture_pipeline(const gchar
*label
);
143 void sipe_purple_transport_close_all(struct sipe_backend_private
*purple_private
);
145 /* Convenience macros */
146 #if PURPLE_VERSION_CHECK(2,6,0) || PURPLE_VERSION_CHECK(3,0,0)
147 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(account)))
148 #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))))
149 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(gc))
151 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(account)->proto_data)
152 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(purple_buddy_get_account(buddy))->proto_data)
153 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)