mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
New function lastlog_write().
This commit is contained in:
parent
7c00a9918a
commit
1fe34ffb4a
3 changed files with 20 additions and 2 deletions
13
data.c
13
data.c
|
@ -1366,6 +1366,19 @@ d_char *history_list(snac *snac)
|
|||
}
|
||||
|
||||
|
||||
void lastlog_write(snac *snac)
|
||||
/* writes the last time and date the user logged in */
|
||||
{
|
||||
xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir);
|
||||
FILE *f;
|
||||
|
||||
if ((f = fopen(fn, "w")) != NULL) {
|
||||
fprintf(f, "%lf\n", ftime());
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** inbox collection **/
|
||||
|
||||
void inbox_add(const char *inbox)
|
||||
|
|
7
html.c
7
html.c
|
@ -13,11 +13,11 @@
|
|||
|
||||
#include "snac.h"
|
||||
|
||||
int login(snac *snac, char *headers)
|
||||
int login(snac *snac, const xs_dict *headers)
|
||||
/* tries a login */
|
||||
{
|
||||
int logged_in = 0;
|
||||
char *auth = xs_dict_get(headers, "authorization");
|
||||
const char *auth = xs_dict_get(headers, "authorization");
|
||||
|
||||
if (auth && xs_startswith(auth, "Basic ")) {
|
||||
int sz;
|
||||
|
@ -33,6 +33,9 @@ int login(snac *snac, char *headers)
|
|||
}
|
||||
}
|
||||
|
||||
if (logged_in)
|
||||
lastlog_write(snac);
|
||||
|
||||
return logged_in;
|
||||
}
|
||||
|
||||
|
|
2
snac.h
2
snac.h
|
@ -132,6 +132,8 @@ d_char *history_get(snac *snac, char *id);
|
|||
int history_del(snac *snac, char *id);
|
||||
d_char *history_list(snac *snac);
|
||||
|
||||
void lastlog_write(snac *snac);
|
||||
|
||||
void inbox_add(const char *inbox);
|
||||
void inbox_add_by_actor(const xs_dict *actor);
|
||||
xs_list *inbox_list(void);
|
||||
|
|
Loading…
Reference in a new issue