3
Meanwhile - Unofficial Lotus Sametime Community Client Library
4
Copyright (C) 2004 Christopher (siege) O'Brien
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
16
You should have received a copy of the GNU Library General Public
17
License along with this library; if not, write to the Free
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include <glib/glist.h>
27
#include "mw_common.h"
30
#define ST_LIST_MAJOR 3
31
#define ST_LIST_MINOR 1
32
#define ST_LIST_MICRO 3
35
enum mwSametimeGroupType {
36
mwSametimeGroup_NORMAL = 1, /**< a normal group of users */
37
mwSametimeGroup_DYNAMIC = 2, /**< a server-side group */
38
mwSametimeGroup_UNKNOWN = 0, /**< error determining group type */
42
enum mwSametimeUserType {
43
mwSametimeUser_NORMAL = 1, /**< user on same community */
44
mwSametimeUser_EXTERNAL = 2, /**< external user */
45
mwSametimeUser_UNKNOWN = 0, /**< error determining user type */
49
/** @struct mwSametimeList
51
Represents a group-based buddy list. */
52
struct mwSametimeList;
55
/** @struct mwSametimeGroup
57
Represents a group in a buddy list */
58
struct mwSametimeGroup;
61
/** @struct mwSametimeUser
63
Represents a user in a group in a buddy list */
64
struct mwSametimeUser;
67
/** Create a new list */
68
struct mwSametimeList *mwSametimeList_new();
71
/** Free the list, all of its groups, and all of the groups' members */
72
void mwSametimeList_free(struct mwSametimeList *l);
75
/** Load a sametime list from a buffer. The list must be encapsulated
76
as a string (eg, the first two bytes in the buffer should be the
77
length of the string) */
78
void mwSametimeList_get(struct mwGetBuffer *b, struct mwSametimeList *l);
81
/** Write a sametime list onto a buffer. The list will be encapsulated
82
in a string (the first two bytes written will be the length of the
83
rest of the written list data) */
84
void mwSametimeList_put(struct mwPutBuffer *b, struct mwSametimeList *l);
87
/** convert a plain string into a sametime list */
88
struct mwSametimeList *mwSametimeList_load(const char *str);
91
/** convert a sametime list into a string */
92
char *mwSametimeList_store(struct mwSametimeList *l);
95
void mwSametimeList_setMajor(struct mwSametimeList *l, guint v);
98
guint mwSametimeList_getMajor(struct mwSametimeList *l);
101
void mwSametimeList_setMinor(struct mwSametimeList *l, guint v);
104
guint mwSametimeList_getMinor(struct mwSametimeList *l);
107
void mwSametimeList_setMicro(struct mwSametimeList *l, guint v);
110
guint mwSametimeList_getMicro(struct mwSametimeList *l);
113
/** Get a GList snapshot of the groups in a list */
114
GList *mwSametimeList_getGroups(struct mwSametimeList *l);
117
struct mwSametimeGroup *
118
mwSametimeList_findGroup(struct mwSametimeList *l,
122
/** Create a new group in a list */
123
struct mwSametimeGroup *
124
mwSametimeGroup_new(struct mwSametimeList *l,
125
enum mwSametimeGroupType type,
129
/** Remove a group from its list, and free it. Also frees all users
130
contained in the group */
131
void mwSametimeGroup_free(struct mwSametimeGroup *g);
134
enum mwSametimeGroupType mwSametimeGroup_getType(struct mwSametimeGroup *g);
137
const char *mwSametimeGroup_getName(struct mwSametimeGroup *g);
140
void mwSametimeGroup_setAlias(struct mwSametimeGroup *g,
144
const char *mwSametimeGroup_getAlias(struct mwSametimeGroup *g);
147
void mwSametimeGroup_setOpen(struct mwSametimeGroup *g, gboolean open);
150
gboolean mwSametimeGroup_isOpen(struct mwSametimeGroup *g);
153
struct mwSametimeList *mwSametimeGroup_getList(struct mwSametimeGroup *g);
156
/** Get a GList snapshot of the users in a list */
157
GList *mwSametimeGroup_getUsers(struct mwSametimeGroup *g);
160
struct mwSametimeUser *
161
mwSametimeGroup_findUser(struct mwSametimeGroup *g,
162
struct mwIdBlock *user);
165
/** Create a user in a group */
166
struct mwSametimeUser *
167
mwSametimeUser_new(struct mwSametimeGroup *g,
168
enum mwSametimeUserType type,
169
struct mwIdBlock *user);
172
/** Remove user from its group, and free it */
173
void mwSametimeUser_free(struct mwSametimeUser *u);
176
struct mwSametimeGroup *mwSametimeUser_getGroup(struct mwSametimeUser *u);
179
enum mwSametimeUserType mwSametimeUser_getType(struct mwSametimeUser *u);
182
const char *mwSametimeUser_getUser(struct mwSametimeUser *u);
185
const char *mwSametimeUser_getCommunity(struct mwSametimeUser *u);
188
void mwSametimeUser_setShortName(struct mwSametimeUser *u, const char *name);
191
const char *mwSametimeUser_getShortName(struct mwSametimeUser *u);
194
void mwSametimeUser_setAlias(struct mwSametimeUser *u, const char *alias);
197
const char *mwSametimeUser_getAlias(struct mwSametimeUser *u);