mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
New function purge_all().
This commit is contained in:
parent
2efdcaae05
commit
3462ecc950
3 changed files with 23 additions and 12 deletions
21
data.c
21
data.c
|
@ -1055,3 +1055,24 @@ void purge(snac *snac)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void purge_all(void)
|
||||||
|
/* purge all users */
|
||||||
|
{
|
||||||
|
snac snac;
|
||||||
|
xs *list = user_list();
|
||||||
|
char *p, *uid;
|
||||||
|
|
||||||
|
srv_debug(1, xs_fmt("purge start"));
|
||||||
|
|
||||||
|
p = list;
|
||||||
|
while (xs_list_iter(&p, &uid)) {
|
||||||
|
if (user_open(&snac, uid)) {
|
||||||
|
purge(&snac);
|
||||||
|
user_free(&snac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
srv_debug(1, xs_fmt("purge end"));
|
||||||
|
}
|
||||||
|
|
13
main.c
13
main.c
|
@ -97,18 +97,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(cmd, "purge") == 0) {
|
if (strcmp(cmd, "purge") == 0) {
|
||||||
/* iterate all users */
|
purge_all();
|
||||||
xs *list = user_list();
|
|
||||||
char *p, *uid;
|
|
||||||
|
|
||||||
p = list;
|
|
||||||
while (xs_list_iter(&p, &uid)) {
|
|
||||||
if (user_open(&snac, uid)) {
|
|
||||||
purge(&snac);
|
|
||||||
user_free(&snac);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
snac.h
1
snac.h
|
@ -96,6 +96,7 @@ d_char *queue(snac *snac);
|
||||||
d_char *dequeue(snac *snac, char *fn);
|
d_char *dequeue(snac *snac, char *fn);
|
||||||
|
|
||||||
void purge(snac *snac);
|
void purge(snac *snac);
|
||||||
|
void purge_all(void);
|
||||||
|
|
||||||
d_char *http_signed_request(snac *snac, char *method, char *url,
|
d_char *http_signed_request(snac *snac, char *method, char *url,
|
||||||
d_char *headers,
|
d_char *headers,
|
||||||
|
|
Loading…
Reference in a new issue