File: mw_st_list.h

package info (click to toggle)
meanwhile 1.0.2-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,732 kB
  • ctags: 3,503
  • sloc: ansic: 13,856; sh: 8,360; makefile: 145
file content (217 lines) | stat: -rw-r--r-- 5,382 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

/*
  Meanwhile - Unofficial Lotus Sametime Community Client Library
  Copyright (C) 2004  Christopher (siege) O'Brien
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.
  
  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _MW_ST_LIST_H
#define _MW_ST_LIST_H


/** @file mw_st_list.h

    Parse and compose buddy lists in the format commonly used by Sametime
    Connect clients.
*/


#include <glib.h>
#include "mw_common.h"


#ifdef __cplusplus
extern "C" {
#endif


#define ST_LIST_MAJOR  3
#define ST_LIST_MINOR  1
#define ST_LIST_MICRO  3


enum mwSametimeGroupType {
  mwSametimeGroup_NORMAL  = 1,  /**< a normal group of users */
  mwSametimeGroup_DYNAMIC = 2,  /**< a server-side group */
  mwSametimeGroup_UNKNOWN = 0,  /**< error determining group type */
};


enum mwSametimeUserType {
  mwSametimeUser_NORMAL   = 1,  /**< user on same community */
  mwSametimeUser_EXTERNAL = 2,  /**< external user */
  mwSametimeUser_UNKNOWN  = 0,  /**< error determining user type */
};


/** @struct mwSametimeList

    Represents a group-based buddy list. */
struct mwSametimeList;


/** @struct mwSametimeGroup

    Represents a group in a buddy list */
struct mwSametimeGroup;


/** @struct mwSametimeUser

    Represents a user in a group in a buddy list */
struct mwSametimeUser;


/** Create a new list */
struct mwSametimeList *mwSametimeList_new();


/** Free the list, all of its groups, and all of the groups' members */
void mwSametimeList_free(struct mwSametimeList *l);


/** Load a sametime list from a buffer. The list must be encapsulated
    as a string (eg, the first two bytes in the buffer should be the
    length of the string) */
void mwSametimeList_get(struct mwGetBuffer *b, struct mwSametimeList *l);


/** Write a sametime list onto a buffer. The list will be encapsulated
    in a string (the first two bytes written will be the length of the
    rest of the written list data) */
void mwSametimeList_put(struct mwPutBuffer *b, struct mwSametimeList *l);


/** convert a plain string into a sametime list */
struct mwSametimeList *mwSametimeList_load(const char *str);


/** convert a sametime list into a string */
char *mwSametimeList_store(struct mwSametimeList *l);


void mwSametimeList_setMajor(struct mwSametimeList *l, guint v);


guint mwSametimeList_getMajor(struct mwSametimeList *l);


void mwSametimeList_setMinor(struct mwSametimeList *l, guint v);


guint mwSametimeList_getMinor(struct mwSametimeList *l);


void mwSametimeList_setMicro(struct mwSametimeList *l, guint v);


guint mwSametimeList_getMicro(struct mwSametimeList *l);


/** Get a GList snapshot of the groups in a list */
GList *mwSametimeList_getGroups(struct mwSametimeList *l);


struct mwSametimeGroup *
mwSametimeList_findGroup(struct mwSametimeList *l,
			 const char *name);


/** Create a new group in a list */
struct mwSametimeGroup *
mwSametimeGroup_new(struct mwSametimeList *l,
		    enum mwSametimeGroupType type,
		    const char *name);


/** Remove a group from its list, and free it. Also frees all users
    contained in the group */
void mwSametimeGroup_free(struct mwSametimeGroup *g);


enum mwSametimeGroupType mwSametimeGroup_getType(struct mwSametimeGroup *g);


const char *mwSametimeGroup_getName(struct mwSametimeGroup *g);


void mwSametimeGroup_setAlias(struct mwSametimeGroup *g,
			      const char *alias);


const char *mwSametimeGroup_getAlias(struct mwSametimeGroup *g);


void mwSametimeGroup_setOpen(struct mwSametimeGroup *g, gboolean open);


gboolean mwSametimeGroup_isOpen(struct mwSametimeGroup *g);


struct mwSametimeList *mwSametimeGroup_getList(struct mwSametimeGroup *g);


/** Get a GList snapshot of the users in a list */
GList *mwSametimeGroup_getUsers(struct mwSametimeGroup *g);


struct mwSametimeUser *
mwSametimeGroup_findUser(struct mwSametimeGroup *g,
			 struct mwIdBlock *user);


/** Create a user in a group */
struct mwSametimeUser *
mwSametimeUser_new(struct mwSametimeGroup *g,
		   enum mwSametimeUserType type,
		   struct mwIdBlock *user);


/** Remove user from its group, and free it */
void mwSametimeUser_free(struct mwSametimeUser *u);


struct mwSametimeGroup *mwSametimeUser_getGroup(struct mwSametimeUser *u);


enum mwSametimeUserType mwSametimeUser_getType(struct mwSametimeUser *u);


const char *mwSametimeUser_getUser(struct mwSametimeUser *u);


const char *mwSametimeUser_getCommunity(struct mwSametimeUser *u);


void mwSametimeUser_setShortName(struct mwSametimeUser *u, const char *name);


const char *mwSametimeUser_getShortName(struct mwSametimeUser *u);


void mwSametimeUser_setAlias(struct mwSametimeUser *u, const char *alias);


const char *mwSametimeUser_getAlias(struct mwSametimeUser *u);



#ifdef __cplusplus
}
#endif


#endif /* _MW_ST_LIST_H */