Mercurial > pidgin
comparison src/protocols/sametime/meanwhile/mw_st_list.h @ 10969:3ef77720e577
[gaim-migrate @ 12790]
importing meanwhile library for use in the sametime plugin
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Sun, 05 Jun 2005 02:50:13 +0000 |
parents | |
children | fc464a0abccc |
comparison
equal
deleted
inserted
replaced
10968:e0d5038fbb7e | 10969:3ef77720e577 |
---|---|
1 | |
2 /* | |
3 Meanwhile - Unofficial Lotus Sametime Community Client Library | |
4 Copyright (C) 2004 Christopher (siege) O'Brien | |
5 | |
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. | |
10 | |
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. | |
15 | |
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 | |
19 */ | |
20 | |
21 #ifndef _MW_ST_LIST_H | |
22 #define _MW_ST_LIST_H | |
23 | |
24 | |
25 #include <glib.h> | |
26 #include <glib/glist.h> | |
27 #include "mw_common.h" | |
28 | |
29 | |
30 #define ST_LIST_MAJOR 3 | |
31 #define ST_LIST_MINOR 1 | |
32 #define ST_LIST_MICRO 3 | |
33 | |
34 | |
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 */ | |
39 }; | |
40 | |
41 | |
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 */ | |
46 }; | |
47 | |
48 | |
49 /** @struct mwSametimeList | |
50 | |
51 Represents a group-based buddy list. */ | |
52 struct mwSametimeList; | |
53 | |
54 | |
55 /** @struct mwSametimeGroup | |
56 | |
57 Represents a group in a buddy list */ | |
58 struct mwSametimeGroup; | |
59 | |
60 | |
61 /** @struct mwSametimeUser | |
62 | |
63 Represents a user in a group in a buddy list */ | |
64 struct mwSametimeUser; | |
65 | |
66 | |
67 /** Create a new list */ | |
68 struct mwSametimeList *mwSametimeList_new(); | |
69 | |
70 | |
71 /** Free the list, all of its groups, and all of the groups' members */ | |
72 void mwSametimeList_free(struct mwSametimeList *l); | |
73 | |
74 | |
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); | |
79 | |
80 | |
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); | |
85 | |
86 | |
87 /** convert a plain string into a sametime list */ | |
88 struct mwSametimeList *mwSametimeList_load(const char *str); | |
89 | |
90 | |
91 /** convert a sametime list into a string */ | |
92 char *mwSametimeList_store(struct mwSametimeList *l); | |
93 | |
94 | |
95 void mwSametimeList_setMajor(struct mwSametimeList *l, guint v); | |
96 | |
97 | |
98 guint mwSametimeList_getMajor(struct mwSametimeList *l); | |
99 | |
100 | |
101 void mwSametimeList_setMinor(struct mwSametimeList *l, guint v); | |
102 | |
103 | |
104 guint mwSametimeList_getMinor(struct mwSametimeList *l); | |
105 | |
106 | |
107 void mwSametimeList_setMicro(struct mwSametimeList *l, guint v); | |
108 | |
109 | |
110 guint mwSametimeList_getMicro(struct mwSametimeList *l); | |
111 | |
112 | |
113 /** Get a GList snapshot of the groups in a list */ | |
114 GList *mwSametimeList_getGroups(struct mwSametimeList *l); | |
115 | |
116 | |
117 struct mwSametimeGroup * | |
118 mwSametimeList_findGroup(struct mwSametimeList *l, | |
119 const char *name); | |
120 | |
121 | |
122 /** Create a new group in a list */ | |
123 struct mwSametimeGroup * | |
124 mwSametimeGroup_new(struct mwSametimeList *l, | |
125 enum mwSametimeGroupType type, | |
126 const char *name); | |
127 | |
128 | |
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); | |
132 | |
133 | |
134 enum mwSametimeGroupType mwSametimeGroup_getType(struct mwSametimeGroup *g); | |
135 | |
136 | |
137 const char *mwSametimeGroup_getName(struct mwSametimeGroup *g); | |
138 | |
139 | |
140 void mwSametimeGroup_setAlias(struct mwSametimeGroup *g, | |
141 const char *alias); | |
142 | |
143 | |
144 const char *mwSametimeGroup_getAlias(struct mwSametimeGroup *g); | |
145 | |
146 | |
147 void mwSametimeGroup_setOpen(struct mwSametimeGroup *g, gboolean open); | |
148 | |
149 | |
150 gboolean mwSametimeGroup_isOpen(struct mwSametimeGroup *g); | |
151 | |
152 | |
153 struct mwSametimeList *mwSametimeGroup_getList(struct mwSametimeGroup *g); | |
154 | |
155 | |
156 /** Get a GList snapshot of the users in a list */ | |
157 GList *mwSametimeGroup_getUsers(struct mwSametimeGroup *g); | |
158 | |
159 | |
160 struct mwSametimeUser * | |
161 mwSametimeGroup_findUser(struct mwSametimeGroup *g, | |
162 struct mwIdBlock *user); | |
163 | |
164 | |
165 /** Create a user in a group */ | |
166 struct mwSametimeUser * | |
167 mwSametimeUser_new(struct mwSametimeGroup *g, | |
168 enum mwSametimeUserType type, | |
169 struct mwIdBlock *user); | |
170 | |
171 | |
172 /** Remove user from its group, and free it */ | |
173 void mwSametimeUser_free(struct mwSametimeUser *u); | |
174 | |
175 | |
176 struct mwSametimeGroup *mwSametimeUser_getGroup(struct mwSametimeUser *u); | |
177 | |
178 | |
179 enum mwSametimeUserType mwSametimeUser_getType(struct mwSametimeUser *u); | |
180 | |
181 | |
182 const char *mwSametimeUser_getUser(struct mwSametimeUser *u); | |
183 | |
184 | |
185 const char *mwSametimeUser_getCommunity(struct mwSametimeUser *u); | |
186 | |
187 | |
188 void mwSametimeUser_setShortName(struct mwSametimeUser *u, const char *name); | |
189 | |
190 | |
191 const char *mwSametimeUser_getShortName(struct mwSametimeUser *u); | |
192 | |
193 | |
194 void mwSametimeUser_setAlias(struct mwSametimeUser *u, const char *alias); | |
195 | |
196 | |
197 const char *mwSametimeUser_getAlias(struct mwSametimeUser *u); | |
198 | |
199 | |
200 #endif |