Merge branch 'mob' of git+ssh://repo.or.cz/srv/git/siplcs into mob
[siplcs.git] / src / purple / purple-private.h
blobe155fcf56328f01bbc6df707ccdf025b0a6d68cf
1 /**
2 * @file purple-private.h
4 * pidgin-sipe
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
23 #include "version.h"
25 /* Forward declarations */
26 struct sipe_core_public;
27 struct _PurpleAccount;
28 struct _PurpleBuddy;
29 struct _PurpleChat;
30 struct _PurpleConnection;
31 struct _PurpleGroup;
32 struct _PurpleMessage;
33 struct _PurpleRoomlist;
34 struct _PurpleStatus;
35 struct _PurpleXfer;
37 #ifndef _PurpleMessageFlags
38 #define _PurpleMessageFlags int
39 #endif
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 */
47 GList *rejoin_chats;
48 GSList *transports;
49 GSList *dns_queries;
52 struct sipe_backend_fd {
53 int 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);
62 /* DNS queries */
63 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private *purple_private);
65 /**
66 * Initiates outgoing file transfer, sending @c file to remote peer identified
67 * by @c who.
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,
74 const char *who,
75 const char *file);
77 /**
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,
84 const char *who);
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,
92 int id,
93 const char *message,
94 const char *name);
95 void sipe_purple_chat_leave(struct _PurpleConnection *gc, int id);
96 int sipe_purple_chat_send(struct _PurpleConnection *gc,
97 int id,
98 #if PURPLE_VERSION_CHECK(3,0,0)
99 struct _PurpleMessage *msg);
100 #else
101 const char *what,
102 _PurpleMessageFlags flags);
103 #endif
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
121 #endif
123 #endif
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,
128 const char *who,
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,
137 int interval);
139 /* media */
140 void capture_pipeline(const gchar *label);
142 /* transport */
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))
150 #else
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)
154 #endif
157 Local Variables:
158 mode: c
159 c-file-style: "bsd"
160 indent-tabs-mode: t
161 tab-width: 8
162 End: