update files in preparation for next release
[siplcs.git] / src / core / sipe-group.h
blob2f6454c173a0f7ca077e445f1e461d7cd540ba75
1 /**
2 * @file sipe-group.h
4 * pidgin-sipe
6 * Copyright (C) 2011-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_buddy;
25 struct sipe_core_private;
26 struct sipe_ucs_transaction;
28 struct sipe_group {
29 gchar *name;
30 gchar *exchange_key;
31 gchar *change_key;
32 guint id;
33 gboolean is_obsolete;
36 struct sipe_group *sipe_group_find_by_id(struct sipe_core_private *sipe_private,
37 guint id);
39 struct sipe_group *sipe_group_find_by_name(struct sipe_core_private *sipe_private,
40 const gchar * name);
42 void sipe_group_create(struct sipe_core_private *sipe_private,
43 struct sipe_ucs_transaction *trans,
44 const gchar *name,
45 const gchar *who);
47 gboolean sipe_group_rename(struct sipe_core_private *sipe_private,
48 struct sipe_group *group,
49 const gchar *name);
51 /**
52 * Creates @c sipe_group structure for a new group and adds it into the group
53 * list of given account. If buddy is already in the list, its existing
54 * structure is returned.
56 * @param sipe_private SIPE core data
57 * @param name name of group (may be @c NULL)
58 * @param exchange_key Exchange key (may be @c NULL)
59 * @param change_key Change key (may be @c NULL)
60 * @param id numeric ID of group
62 * @return @c sipe_group structure or @c NULL if group creation failed
64 struct sipe_group *sipe_group_add(struct sipe_core_private *sipe_private,
65 const gchar *name,
66 const gchar *exchange_key,
67 const gchar *change_key,
68 guint id);
70 /* remove group from core & backend */
71 void sipe_group_remove(struct sipe_core_private *sipe_private,
72 struct sipe_group *group);
74 /* update alias/group list for a buddy on the server */
75 void sipe_group_update_buddy(struct sipe_core_private *sipe_private,
76 struct sipe_buddy *buddy);
78 /**
79 * Prepare group list for an update
81 * @param sipe_private SIPE core data
83 void sipe_group_update_start(struct sipe_core_private *sipe_private);
85 /**
86 * Finish group list update. This will remove obsolete groups.
88 * NOTE: this must be call after sipe_buddy_update_finish(), i.e. it
89 * assumes that the group is no longer associated with any buddy.
91 * @param sipe_private SIPE core data
93 void sipe_group_update_finish(struct sipe_core_private *sipe_private);
95 /**
96 * Return first group
98 * @param sipe_private SIPE core data
100 * @return sipe_group structure or @c NULL if there are no groups
102 struct sipe_group *sipe_group_first(struct sipe_core_private *sipe_private);
105 * Number of groups
107 * @param sipe_private SIPE core data
109 guint sipe_group_count(struct sipe_core_private *sipe_private);
112 * Initialize group data
114 * @param sipe_private SIPE core data
116 void sipe_group_init(struct sipe_core_private *sipe_private);
119 * Free group data
121 * @param sipe_private SIPE core data
123 void sipe_group_free(struct sipe_core_private *sipe_private);