api: replace gchar *status_id with guint activity
[siplcs.git] / src / purple / purple-private.h
blobbc4d4931e4670bef3a060bd5cc2898861125429c
1 /**
2 * @file purple-private.h
4 * pidgin-sipe
6 * Copyright (C) 2010-11 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 _PurpleBuddy;
27 struct _PurpleChat;
28 struct _PurpleConnection;
29 struct _PurpleGroup;
30 struct _PurpleRoomlist;
31 struct _PurpleStatus;
32 struct _PurpleXfer;
34 #ifndef _PurpleMessageFlags
35 #define _PurpleMessageFlags int
36 #endif
38 struct sipe_backend_private {
39 struct sipe_core_public *public;
40 struct _PurpleConnection *gc;
41 struct _PurpleAccount *account;
42 struct _PurpleRoomlist *roomlist;
43 GHashTable *roomlist_map; /* name -> uri */
44 GList *rejoin_chats;
45 time_t last_keepalive;
48 struct sipe_backend_fd {
49 int fd;
52 /* Status attributes */
53 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
55 const gchar *sipe_purple_activity_to_token(guint type);
56 guint sipe_purple_token_to_activity(const gchar *token);
58 /**
59 * Initiates outgoing file transfer, sending @c file to remote peer identified
60 * by @c who.
62 * @param gc a PurpleConnection
63 * @param who string identifying receiver of the file
64 * @param file local file system path of the file to send
66 void sipe_purple_ft_send_file(struct _PurpleConnection *gc,
67 const char *who,
68 const char *file);
70 /**
71 * Creates new PurpleXfer structure representing a file transfer.
73 * @param gc a PurpleConnection
74 * @param who remote participant in the file transfer session
76 struct _PurpleXfer *sipe_purple_ft_new_xfer(struct _PurpleConnection *gc,
77 const char *who);
79 /* libpurple chat callbacks */
80 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
82 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private *purple_private);
83 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private *purple_private);
84 void sipe_purple_chat_invite(struct _PurpleConnection *gc,
85 int id,
86 const char *message,
87 const char *name);
88 void sipe_purple_chat_leave(struct _PurpleConnection *gc, int id);
89 int sipe_purple_chat_send(struct _PurpleConnection *gc,
90 int id,
91 const char *what,
92 _PurpleMessageFlags flags);
93 GList *sipe_purple_chat_menu(struct _PurpleChat *chat);
95 /* libpurple chat room callbacks */
96 GList *sipe_purple_chat_info(struct _PurpleConnection *gc);
97 GHashTable *sipe_purple_chat_info_defaults(struct _PurpleConnection *gc,
98 const char *chat_name);
99 void sipe_purple_chat_join(struct _PurpleConnection *gc, GHashTable *data);
100 struct _PurpleRoomlist *sipe_purple_roomlist_get_list(struct _PurpleConnection *gc);
101 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist *list);
103 /* libpurple buddy callbacks */
104 void sipe_purple_add_buddy(struct _PurpleConnection *gc,
105 struct _PurpleBuddy *buddy,
106 struct _PurpleGroup *group);
107 void sipe_purple_remove_buddy(struct _PurpleConnection *gc,
108 struct _PurpleBuddy *buddy,
109 struct _PurpleGroup *group);
110 void sipe_purple_group_buddy(struct _PurpleConnection *gc,
111 const char *who,
112 const char *old_group_name,
113 const char *new_group_name);
114 GList *sipe_purple_buddy_menu(struct _PurpleBuddy *buddy);
116 /* libpurple status callbacks */
117 void sipe_purple_set_status(struct _PurpleAccount *account,
118 struct _PurpleStatus *status);
119 void sipe_purple_set_idle(struct _PurpleConnection *gc,
120 int interval);
122 /* Convenience macros */
123 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) account->gc->proto_data)
124 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) buddy->account->gc->proto_data)
125 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)
128 Local Variables:
129 mode: c
130 c-file-style: "bsd"
131 indent-tabs-mode: t
132 tab-width: 8
133 End: