Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/roster.c @ 148:c3624b2a7059
[/trunk] Changeset 160 by mikael
* Add roster_msg_setflag() (which updates ROSTER_FLAG_MSG flag for buddy
and his _group_.
author | mikael |
---|---|
date | Sat, 30 Apr 2005 22:45:00 +0000 |
parents | 7571de4aed73 |
children | faf534be8ff0 |
comparison
equal
deleted
inserted
replaced
147:7571de4aed73 | 148:c3624b2a7059 |
---|---|
224 if (value) | 224 if (value) |
225 roster_usr->flags |= flags; | 225 roster_usr->flags |= flags; |
226 else | 226 else |
227 roster_usr->flags &= ~flags; | 227 roster_usr->flags &= ~flags; |
228 } | 228 } |
229 | 229 |
230 // roster_msg_setflag() | |
231 // Set the ROSTER_FLAG_MSG to the given value for the given jid. | |
232 // It will update the buddy's group message flag. | |
233 void roster_msg_setflag(const char *jid, guint value) | |
234 { | |
235 GSList *sl_user; | |
236 roster *roster_usr, *roster_grp; | |
237 | |
238 sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); | |
239 if (sl_user == NULL) | |
240 return; | |
241 | |
242 roster_usr = (roster*)sl_user->data; | |
243 roster_grp = (roster*)roster_usr->list->data; | |
244 if (value) { | |
245 // Message flag is TRUE. This is easy, we just have to set both flags | |
246 // to TRUE... | |
247 roster_usr->flags |= ROSTER_FLAG_MSG; | |
248 roster_grp->flags |= ROSTER_FLAG_MSG; // group | |
249 } else { | |
250 // Message flag is FALSE. | |
251 guint msg = FALSE; | |
252 roster_usr->flags &= ~ROSTER_FLAG_MSG; | |
253 // For the group value we need to watch all buddies in this group; | |
254 // if one is flagged, then the group will be flagged. | |
255 // I will re-use sl_user and roster_usr here, as they aren't used | |
256 // anymore. | |
257 sl_user = roster_grp->list; | |
258 while (sl_user) { | |
259 roster_usr = (roster*)sl_user->data; | |
260 if (roster_usr->flags & ROSTER_FLAG_MSG) { | |
261 msg = TRUE; | |
262 break; | |
263 } | |
264 sl_user = g_slist_next(sl_user); | |
265 } | |
266 if (!msg) | |
267 roster_grp->flags &= ~ROSTER_FLAG_MSG; | |
268 else | |
269 roster_grp->flags |= ROSTER_FLAG_MSG; | |
270 // Actually the "else" part is useless, because the group | |
271 // ROSTER_FLAG_MSG should already be set... | |
272 } | |
273 } | |
274 | |
230 void roster_settype(const char *jid, guint type) | 275 void roster_settype(const char *jid, guint type) |
231 { | 276 { |
232 GSList *sl_user; | 277 GSList *sl_user; |
233 roster *roster_usr; | 278 roster *roster_usr; |
234 | 279 |
269 { | 314 { |
270 if (roster_find(jidname, type, roster_type)) | 315 if (roster_find(jidname, type, roster_type)) |
271 return TRUE; | 316 return TRUE; |
272 return FALSE; | 317 return FALSE; |
273 } | 318 } |
274 | |
275 // char *roster_getgroup(...) / Or *GSList? Which use?? | |
276 // ... setgroup(char*) ?? | |
277 // guchar roster_getflags(...) | |
278 // guchar roster_getname(...) / setname ?? | |
279 // roster_del_group? | |
280 | 319 |
281 | 320 |
282 /* ### BuddyList functions ### */ | 321 /* ### BuddyList functions ### */ |
283 | 322 |
284 // buddylist_set_hide_offline_buddies(hide) | 323 // buddylist_set_hide_offline_buddies(hide) |