buddy: add interface for number of buddies
[siplcs.git] / src / purple / purple-private.h
blob3473f784b828108e108b564b0d51678dd3508606
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 /* 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 GSList *transports;
46 GSList *dns_queries;
47 time_t last_keepalive;
50 struct sipe_backend_fd {
51 int fd;
54 /* Status attributes */
55 #define SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE "message"
57 const gchar *sipe_purple_activity_to_token(guint type);
58 guint sipe_purple_token_to_activity(const gchar *token);
60 /* DNS queries */
61 void sipe_purple_dns_query_cancel_all(struct sipe_backend_private *purple_private);
63 /**
64 * Initiates outgoing file transfer, sending @c file to remote peer identified
65 * by @c who.
67 * @param gc a PurpleConnection
68 * @param who string identifying receiver of the file
69 * @param file local file system path of the file to send
71 void sipe_purple_ft_send_file(struct _PurpleConnection *gc,
72 const char *who,
73 const char *file);
75 /**
76 * Creates new PurpleXfer structure representing a file transfer.
78 * @param gc a PurpleConnection
79 * @param who remote participant in the file transfer session
81 struct _PurpleXfer *sipe_purple_ft_new_xfer(struct _PurpleConnection *gc,
82 const char *who);
84 /* libpurple chat callbacks */
85 #define SIPE_PURPLE_COMPONENT_KEY_CONVERSATION "_conv"
87 void sipe_purple_chat_setup_rejoin(struct sipe_backend_private *purple_private);
88 void sipe_purple_chat_destroy_rejoin(struct sipe_backend_private *purple_private);
89 void sipe_purple_chat_invite(struct _PurpleConnection *gc,
90 int id,
91 const char *message,
92 const char *name);
93 void sipe_purple_chat_leave(struct _PurpleConnection *gc, int id);
94 int sipe_purple_chat_send(struct _PurpleConnection *gc,
95 int id,
96 const char *what,
97 _PurpleMessageFlags flags);
98 GList *sipe_purple_chat_menu(struct _PurpleChat *chat);
100 /* libpurple chat room callbacks */
101 GList *sipe_purple_chat_info(struct _PurpleConnection *gc);
102 GHashTable *sipe_purple_chat_info_defaults(struct _PurpleConnection *gc,
103 const char *chat_name);
104 void sipe_purple_chat_join(struct _PurpleConnection *gc, GHashTable *data);
105 struct _PurpleRoomlist *sipe_purple_roomlist_get_list(struct _PurpleConnection *gc);
106 void sipe_purple_roomlist_cancel(struct _PurpleRoomlist *list);
108 /* libpurple buddy callbacks */
109 #ifdef PURPLE_VERSION_CHECK
110 void sipe_purple_add_buddy(struct _PurpleConnection *gc,
111 struct _PurpleBuddy *buddy,
112 struct _PurpleGroup *group
113 #if PURPLE_VERSION_CHECK(3,0,0)
114 , const gchar *message
115 #endif
117 #endif
118 void sipe_purple_remove_buddy(struct _PurpleConnection *gc,
119 struct _PurpleBuddy *buddy,
120 struct _PurpleGroup *group);
121 void sipe_purple_group_buddy(struct _PurpleConnection *gc,
122 const char *who,
123 const char *old_group_name,
124 const char *new_group_name);
125 GList *sipe_purple_buddy_menu(struct _PurpleBuddy *buddy);
127 /* libpurple status callbacks */
128 void sipe_purple_set_status(struct _PurpleAccount *account,
129 struct _PurpleStatus *status);
130 void sipe_purple_set_idle(struct _PurpleConnection *gc,
131 int interval);
133 /* media */
134 void capture_pipeline(const gchar *label);
136 /* transport */
137 void sipe_purple_transport_close_all(struct sipe_backend_private *purple_private);
139 /* Convenience macros */
140 #define PURPLE_ACCOUNT_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) account->gc->proto_data)
141 #define PURPLE_BUDDY_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) buddy->account->gc->proto_data)
142 #define PURPLE_GC_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) gc->proto_data)
145 Local Variables:
146 mode: c
147 c-file-style: "bsd"
148 indent-tabs-mode: t
149 tab-width: 8
150 End: