extern int account_flush(t_account * account, unsigned flags) { int res; assert(account); res = attrgroup_flush(account->attrgroup, flags); if (res<0) return res; account_unload_friends(account); return res; }
extern int attrlayer_flush(int flags) { static t_elist *curr = &loadedlist; static t_elist *next = NULL; t_attrgroup *attrgroup; unsigned int fcount; unsigned int tcount; fcount = tcount = 0; if (curr == &loadedlist || FLAG_ISSET(flags, FS_ALL)) { curr = elist_next(&loadedlist); next = elist_next(curr); } /* elist_for_each_safe splitted into separate startup for userstep function */ for (; curr != &loadedlist; curr = next, next = elist_next(curr)) { if (!FLAG_ISSET(flags, FS_ALL) && tcount >= prefs_get_user_step()) break; attrgroup = elist_entry(curr, t_attrgroup, loadedlist); switch (attrgroup_flush(attrgroup, flags)) { case 0: /* stop on the first account not flushed (ie accessed too early) */ goto loopout; case 1: fcount++; break; case -1: eventlog(eventlog_level_error, __FUNCTION__, "could not flush account"); break; default: break; } tcount++; } loopout: if (fcount > 0) eventlog(eventlog_level_debug, __FUNCTION__, "flushed %u user accounts", fcount); if (!FLAG_ISSET(flags, FS_ALL) && curr != &loadedlist) return 1; return 0; }