summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c4
-rw-r--r--html.c2
-rw-r--r--main.c2
-rw-r--r--mastoapi.c2
-rw-r--r--snac.h2
5 files changed, 7 insertions, 5 deletions
diff --git a/data.c b/data.c
index 72b63f8..92574c2 100644
--- a/data.c
+++ b/data.c
@@ -1575,14 +1575,14 @@ xs_list *history_list(snac *snac)
1575} 1575}
1576 1576
1577 1577
1578void lastlog_write(snac *snac) 1578void lastlog_write(snac *snac, const char *source)
1579/* writes the last time the user logged in */ 1579/* writes the last time the user logged in */
1580{ 1580{
1581 xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir); 1581 xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir);
1582 FILE *f; 1582 FILE *f;
1583 1583
1584 if ((f = fopen(fn, "w")) != NULL) { 1584 if ((f = fopen(fn, "w")) != NULL) {
1585 fprintf(f, "%lf\n", ftime()); 1585 fprintf(f, "%lf %s\n", ftime(), source);
1586 fclose(f); 1586 fclose(f);
1587 } 1587 }
1588} 1588}
diff --git a/html.c b/html.c
index 8d4203d..1227cfe 100644
--- a/html.c
+++ b/html.c
@@ -34,7 +34,7 @@ int login(snac *snac, const xs_dict *headers)
34 } 34 }
35 35
36 if (logged_in) 36 if (logged_in)
37 lastlog_write(snac); 37 lastlog_write(snac, "web");
38 38
39 return logged_in; 39 return logged_in;
40} 40}
diff --git a/main.c b/main.c
index 3f34673..322aa67 100644
--- a/main.c
+++ b/main.c
@@ -145,6 +145,8 @@ int main(int argc, char *argv[])
145 return 1; 145 return 1;
146 } 146 }
147 147
148 lastlog_write(&snac, "cmdline");
149
148 if (strcmp(cmd, "resetpwd") == 0) { 150 if (strcmp(cmd, "resetpwd") == 0) {
149 return resetpwd(&snac); 151 return resetpwd(&snac);
150 } 152 }
diff --git a/mastoapi.c b/mastoapi.c
index b82ecfa..1b9ab09 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -854,7 +854,7 @@ int process_auth_token(snac *snac, const xs_dict *req)
854 logged_in = 1; 854 logged_in = 1;
855 855
856 /* this counts as a 'login' */ 856 /* this counts as a 'login' */
857 lastlog_write(snac); 857 lastlog_write(snac, "mastoapi");
858 858
859 srv_debug(2, xs_fmt("mastoapi auth: valid token for user %s", uid)); 859 srv_debug(2, xs_fmt("mastoapi auth: valid token for user %s", uid));
860 } 860 }
diff --git a/snac.h b/snac.h
index 6a8092a..2a66255 100644
--- a/snac.h
+++ b/snac.h
@@ -142,7 +142,7 @@ xs_str *history_get(snac *snac, const char *id);
142int history_del(snac *snac, const char *id); 142int history_del(snac *snac, const char *id);
143xs_list *history_list(snac *snac); 143xs_list *history_list(snac *snac);
144 144
145void lastlog_write(snac *snac); 145void lastlog_write(snac *snac, const char *source);
146 146
147xs_str *notify_check_time(snac *snac, int reset); 147xs_str *notify_check_time(snac *snac, int reset);
148void notify_add(snac *snac, const char *type, const char *utype, 148void notify_add(snac *snac, const char *type, const char *utype,