purple: work around broken idle indication
[siplcs.git] / src / purple / purple-private.h
blob268595b036cb3ac8ef188e60a747a0a41fd9fbef
1 /**
2 * @file purple-private.h
4 * pidgin-sipe
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
23 #include "version.h"
25 /* Forward declarations */
26 struct sipe_chat_session;
27 struct sipe_core_public;
28 struct _PurpleAccount;
29 struct _PurpleBuddy;
30 struct _PurpleChat;
31 struct _PurpleConnection;
32 struct _PurpleConversation;
33 struct _PurpleGroup;
34 struct _PurpleMessage;
35 struct _PurplePluginAction;
36 struct _PurpleRoomlist;
37 struct _PurpleStatus;
38 struct _PurpleXfer;
40 #ifndef _PurpleMessageFlags
41 #define _PurpleMessageFlags int
42 #endif
44 struct sipe_backend_private {
45 struct sipe_core_public *public;
46 struct _PurpleConnection *gc;
47 struct _PurpleAccount *account;
48 struct _PurpleRoomlist *roomlist;
49 /* see sipe_backend_chat_create() */
50 struct sipe_chat_session *adium_chat_session;
51 GHashTable *roomlist_map; /* name -> uri */
52 GList *rejoin_chats;
53 GSList *transports;
54 GSList *dns_queries;
56 /* work around broken libpurple idle notification */
57 gchar *deferred_status_note;
58 guint deferred_status_activity;
59 guint deferred_status_timeout;
61 /* flags */
62 gboolean status_changed_by_core; /* status changed by core */
63 gboolean user_is_not_idle; /* user came back online */
66 struct sipe_backend_fd {
67 int fd;
70 /* Status attributes */
71 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
73 const gchar *sipe_purple_activity_to_token(guint type);
74 guint sipe_purple_token_to_activity(const gchar *token);
76 /* DNS queries */
77 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private *purple_private);
79 /**
80 * Initiates outgoing file transfer, sending @c file to remote peer identified
81 * by @c who.
83 * @param gc a PurpleConnection
84 * @param who string identifying receiver of the file
85 * @param file local file system path of the file to send
87 void sipe_purple_ft_send_file(struct _PurpleConnection *gc,
88 const char *who,
89 const char *file);
91 /**
92 * Creates new PurpleXfer structure representing a file transfer.
94 * @param gc a PurpleConnection
95 * @param who remote participant in the file transfer session
97 struct _PurpleXfer *sipe_purple_ft_new_xfer(struct _PurpleConnection *gc,
98 const char *who);
100 /* libpurple chat callbacks */
101 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
103 struct sipe_chat_session *sipe_purple_chat_get_session(struct _PurpleConversation *conv);
104 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private *purple_private);
105 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private *purple_private);
106 void sipe_purple_chat_invite(struct _PurpleConnection *gc,
107 int id,
108 const char *message,
109 const char *name);
110 void sipe_purple_chat_leave(struct _PurpleConnection *gc, int id);
111 int sipe_purple_chat_send(struct _PurpleConnection *gc,
112 int id,
113 #if PURPLE_VERSION_CHECK(3,0,0)
114 struct _PurpleMessage *msg);
115 #else
116 const char *what,
117 _PurpleMessageFlags flags);
118 #endif
119 GList *sipe_purple_chat_menu(struct _PurpleChat *chat);
121 /* libpurple chat room callbacks */
122 GList *sipe_purple_chat_info(struct _PurpleConnection *gc);
123 GHashTable *sipe_purple_chat_info_defaults(struct _PurpleConnection *gc,
124 const char *chat_name);
125 void sipe_purple_chat_join(struct _PurpleConnection *gc, GHashTable *data);
126 struct _PurpleRoomlist *sipe_purple_roomlist_get_list(struct _PurpleConnection *gc);
127 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist *list);
129 /* libpurple buddy callbacks */
130 #ifdef PURPLE_VERSION_CHECK
131 void sipe_purple_add_buddy(struct _PurpleConnection *gc,
132 struct _PurpleBuddy *buddy,
133 struct _PurpleGroup *group
134 #if PURPLE_VERSION_CHECK(3,0,0)
135 , const gchar *message
136 #endif
138 #endif
139 void sipe_purple_remove_buddy(struct _PurpleConnection *gc,
140 struct _PurpleBuddy *buddy,
141 struct _PurpleGroup *group);
142 void sipe_purple_group_buddy(struct _PurpleConnection *gc,
143 const char *who,
144 const char *old_group_name,
145 const char *new_group_name);
146 GList *sipe_purple_buddy_menu(struct _PurpleBuddy *buddy);
148 /* libpurple search callbacks */
149 void sipe_purple_show_find_contact(struct _PurplePluginAction *action);
151 /* libpurple status callbacks */
152 void sipe_purple_set_status(struct _PurpleAccount *account,
153 struct _PurpleStatus *status);
154 void sipe_purple_set_idle(struct _PurpleConnection *gc,
155 int interval);
157 /* media */
158 void capture_pipeline(const gchar *label);
160 /* transport */
161 void sipe_purple_transport_close_all(struct sipe_backend_private *purple_private);
163 /* Convenience macros */
164 #if PURPLE_VERSION_CHECK(2,6,0) || PURPLE_VERSION_CHECK(3,0,0)
165 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(account)))
166 #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))))
167 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(gc))
168 #else
169 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(account)->proto_data)
170 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_account_get_connection(purple_buddy_get_account(buddy))->proto_data)
171 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)
172 #endif
175 Local Variables:
176 mode: c
177 c-file-style: "bsd"
178 indent-tabs-mode: t
179 tab-width: 8
180 End: