filetransfer: Do not use raw file descriptors in sipe core
[siplcs.git] / src / purple / purple-private.h
blobb831a3578986d49cb7323c6d47fdca720e682333
1 /**
2 * @file purple-private.h
4 * pidgin-sipe
6 * Copyright (C) 2010 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 /* Forward declarations */
24 struct sipe_core_public;
25 struct _PurpleAccount;
26 struct _PurpleChat;
27 struct _PurpleConnection;
28 struct _PurpleRoomlist;
29 struct _PurpleXfer;
31 #ifndef _PurpleMessageFlags
32 #define _PurpleMessageFlags int
33 #endif
35 struct sipe_backend_private {
36 struct sipe_core_public *public;
37 struct _PurpleConnection *gc;
38 struct _PurpleAccount *account;
39 struct _PurpleRoomlist *roomlist;
40 GHashTable *roomlist_map; /* name -> uri */
41 GList *rejoin_chats;
42 time_t last_keepalive;
45 struct sipe_backend_fd {
46 int fd;
49 /**
50 * Initiates outgoing file transfer, sending @c file to remote peer identified
51 * by @c who.
53 * @param gc a PurpleConnection
54 * @param who string identifying receiver of the file
55 * @param file local file system path of the file to send
57 void sipe_purple_ft_send_file(struct _PurpleConnection *gc,
58 const char *who,
59 const char *file);
61 /**
62 * Creates new PurpleXfer structure representing a file transfer.
64 * @param gc a PurpleConnection
65 * @param who remote participant in the file transfer session
67 struct _PurpleXfer *sipe_purple_ft_new_xfer(struct _PurpleConnection *gc,
68 const char *who);
70 /* libpurple chat callbacks */
71 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
73 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private *purple_private);
74 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private *purple_private);
75 void sipe_purple_chat_invite(struct _PurpleConnection *gc,
76 int id,
77 const char *message,
78 const char *name);
79 void sipe_purple_chat_leave(struct _PurpleConnection *gc, int id);
80 int sipe_purple_chat_send(struct _PurpleConnection *gc,
81 int id,
82 const char *what,
83 _PurpleMessageFlags flags);
84 GList *sipe_purple_chat_menu(struct _PurpleChat *chat);
86 /* libpurple chat room callbacks */
87 GList *sipe_purple_chat_info(struct _PurpleConnection *gc);
88 GHashTable *sipe_purple_chat_info_defaults(struct _PurpleConnection *gc,
89 const char *chat_name);
90 void sipe_purple_chat_join(struct _PurpleConnection *gc, GHashTable *data);
91 struct _PurpleRoomlist *sipe_purple_roomlist_get_list(struct _PurpleConnection *gc);
92 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist *list);
94 /* Convenience macros */
95 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) account->gc->proto_data)
96 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)
99 Local Variables:
100 mode: c
101 c-file-style: "bsd"
102 indent-tabs-mode: t
103 tab-width: 8
104 End: