~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to gnome/src/presence.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
 
3
 *  Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
 
4
 *
 
5
 *  This program is free software; you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation; either version 3 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
 
18
 *
 
19
 *  Additional permission under GNU GPL version 3 section 7:
 
20
 *
 
21
 *  If you modify this program, or any covered work, by linking or
 
22
 *  combining it with the OpenSSL project's OpenSSL library (or a
 
23
 *  modified version of that library), containing parts covered by the
 
24
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 
25
 *  grants you additional permission to convey the resulting work.
 
26
 *  Corresponding Source for a non-source form of such a combination
 
27
 *  shall include the source code for the parts of OpenSSL used as well
 
28
 *  as that of the covered work.
 
29
 */
 
30
 
 
31
#ifndef __PRESENCE_H__
 
32
#define __PRESENCE_H__
 
33
 
 
34
#include <glib.h>
 
35
 
 
36
#include "sflphone_client.h"
 
37
#include "accountlist.h"
 
38
#include "callable_obj.h"
 
39
 
 
40
//#define PRESENCE_DEBUG // allow for exhaustive description of the buddies
 
41
 
 
42
typedef struct
 
43
{
 
44
    gchar * alias;  // persistent
 
45
    gchar * group;  // persistent
 
46
    gchar * uri;    // persistent
 
47
    gchar * acc;    // persistent
 
48
    gboolean subscribed; // is subscription active
 
49
    gboolean status;    // Online/Offline
 
50
    gchar * note;   // more detailed status
 
51
} buddy_t;
 
52
 
 
53
/**
 
54
 * This function inits the buddy list from the client's gsettings schema.
 
55
 * @param client The given client which provide the schema
 
56
 */
 
57
void presence_buddy_list_init(SFLPhoneClient *client);
 
58
 
 
59
/**
 
60
 * This function clears the buddy list.
 
61
 */
 
62
void presence_buddy_list_flush();
 
63
 
 
64
/**
 
65
 * This function saved a modified buddy and resubscribes if necessary.
 
66
 * @param buddy A known buddy but with new information to be saved.
 
67
 * @param backup A backup of this buddy before it was changed
 
68
 */
 
69
void presence_buddy_list_edit_buddy(buddy_t * buddy, buddy_t *backup);
 
70
 
 
71
/**
 
72
 * This function adds a buddy in the list.
 
73
 * @param buddy The buddy structure to be added.
 
74
 */
 
75
void presence_buddy_list_add_buddy(buddy_t * buddy);
 
76
 
 
77
/**
 
78
 * This function removes a buddy from the list.
 
79
 * @param buddy The buddy structure to be removed.
 
80
 */
 
81
void presence_buddy_list_remove_buddy(buddy_t * buddy);
 
82
 
 
83
/**
 
84
 * This function returns the number of buddies in list.
 
85
 * @return guint The size of the buddy list.
 
86
 */
 
87
guint presence_buddy_list_get_size();
 
88
 
 
89
/**
 
90
 * This function returns a pointer to the buddy list.
 
91
 * @return Glist * The pointer to the list.
 
92
 */
 
93
GList * presence_buddy_list_get();
 
94
 
 
95
/**
 
96
 * This function returns the nth buddy of the list.
 
97
 * @return buddy_t * The pointer to the nth buddy.
 
98
 */
 
99
buddy_t * presence_buddy_list_get_nth(guint n);
 
100
 
 
101
/**
 
102
 * This function returns a buddy which matches with params.
 
103
 * @param accID The account ID associated to the buddy.
 
104
 * @param uri The buddy's uri.
 
105
 * @return Glist * The pointer to the found buddy.
 
106
 */
 
107
buddy_t * presence_buddy_list_buddy_get_by_string(const gchar *accID, const gchar *uri);
 
108
 
 
109
/**
 
110
 * This function returns a buddy which matches with params.
 
111
 * @param uri The buddy's uri.
 
112
 * @return Glist * The pointer to the found buddy.
 
113
 */
 
114
buddy_t * presence_buddy_list_buddy_get_by_uri(const gchar *uri);
 
115
 
 
116
/**
 
117
 * This function detects if the buddy already exists, based
 
118
 * on its accountID and URI and return the pointer to the real element
 
119
 * of the list.
 
120
 * @param buddy The buddy to be found in the list.
 
121
 * @return buddy_t *  The pointer to the buddy if it exist and NULL if not.
 
122
 */
 
123
buddy_t * presence_buddy_list_get_buddy(buddy_t * buddy);
 
124
 
 
125
/**
 
126
 * This function detects if the buddy already exists, based
 
127
 * on its accountID and URI and return the pointer to the real element
 
128
 * of the list.
 
129
 * @param buddy The buddy to be found in the list.
 
130
 * @return GList*  The pointer to the link in the list if it exist and NULL if not.
 
131
 */
 
132
GList * presence_buddy_list_get_link(buddy_t * buddy);
 
133
 
 
134
/**
 
135
 * This function create a new buddy with default value.
 
136
 * @return buddy_t The pointer to the new buddy.
 
137
 */
 
138
buddy_t * presence_buddy_create();
 
139
 
 
140
/**
 
141
 * This function deep-copies a given buddy.
 
142
 * @param b_src The source buddy.
 
143
 * @return buddy_t The pointer to the dest buddy.
 
144
 */
 
145
buddy_t * presence_buddy_copy(buddy_t * b_src);
 
146
 
 
147
/**
 
148
 * This function frees completely a given buddy.
 
149
 * @param b The given buddy to be deleted.
 
150
 */
 
151
void presence_buddy_delete(buddy_t *buddy);
 
152
 
 
153
/**
 
154
 * This function print the entire list for debugging purpose.
 
155
 */
 
156
void presence_buddy_list_print();
 
157
 
 
158
/**
 
159
 * This function calls the dbus method to subscribe to a buddy.
 
160
 * of a given account.
 
161
 * @param buddy The buddy pointer
 
162
 * @param flag True to subscribe and False to unsubscribe
 
163
 */
 
164
void presence_buddy_subscribe(buddy_t * buddy, gboolean flag);
 
165
 
 
166
/**
 
167
 * This function grabs data from a callable object and copies it
 
168
 * into a given buddy.
 
169
 * @param c The input callable object.
 
170
 * @param b The output buddy.
 
171
 */
 
172
void presence_callable_to_buddy(callable_obj_t *c, buddy_t *b);
 
173
 
 
174
/**
 
175
 * This function the group list based on the existing group fields of the buddies.
 
176
 */
 
177
void presence_group_list_init();
 
178
 
 
179
/**
 
180
 * This function edit a group in the list and the associated buddies.
 
181
 * @param new_group The new group name.
 
182
 * @param old_group The old group pointer to be edited.
 
183
 */
 
184
void presence_group_list_edit_group(gchar *new_group, gchar *old_group);
 
185
 
 
186
/**
 
187
 * This function adds a group in the list.
 
188
 * @param group The group structure to be added.
 
189
 */
 
190
void presence_group_list_add_group(const gchar * group);
 
191
 
 
192
/**
 
193
 * This function removes a group from the list and all
 
194
 * associated buddies.
 
195
 * @param group The group structure to be removed.
 
196
 */
 
197
void presence_group_list_remove_group(const gchar * group);
 
198
 
 
199
/**
 
200
 * This function returns the number of groups in list.
 
201
 * @return guint The size of the group list.
 
202
 */
 
203
guint presence_group_list_get_size();
 
204
 
 
205
/**
 
206
 * This function returns a pointer to the group list.
 
207
 * @return Glist * The pointer to the list.
 
208
 */
 
209
GList * presence_group_list_get();
 
210
 
 
211
/**
 
212
 * This function returns the nth group of the list.
 
213
 * @return gchar * The pointer to the nth group.
 
214
 */
 
215
gchar * presence_group_list_get_nth(guint n);
 
216
 
 
217
/**
 
218
 * This function detects if the group already exists, based
 
219
 * on its accountID and URI and return the pointer to the real element
 
220
 * of the list.
 
221
 * @param group The group to be found in the list.
 
222
 * @return group *  The pointer to the group if it exist and NULL if not.
 
223
 */
 
224
gchar * presence_group_list_get_group(const gchar *group);
 
225
 
 
226
/**
 
227
 * This function detects if the group already exists, based
 
228
 * on its accountID and URI and return the pointer to the real element
 
229
 * of the list.
 
230
 * @param group The group to be found in the list.
 
231
 * @return  GList *  The pointer to the group if it exist and NULL if not.
 
232
 */
 
233
GList * presence_group_list_get_link(const gchar *group);
 
234
 
 
235
/**
 
236
 * Flush the group list;
 
237
 */
 
238
void presence_group_list_flush();
 
239
 
 
240
/**
 
241
 * This function print the entire list for debugging purpose.
 
242
 */
 
243
void presence_group_list_print();
 
244
 
 
245
static const char *const PRESENCE_STATUS_ONLINE = "Online";
 
246
static const char *const PRESENCE_STATUS_OFFLINE = "Offline";
 
247
 
 
248
#endif