summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c20
-rw-r--r--mastoapi.c6
-rw-r--r--snac.h1
3 files changed, 22 insertions, 5 deletions
diff --git a/data.c b/data.c
index 4e5696e..bc85171 100644
--- a/data.c
+++ b/data.c
@@ -232,6 +232,26 @@ d_char *user_list(void)
232} 232}
233 233
234 234
235int user_open_by_md5(snac *snac, const char *md5)
236/* iterates all users searching by md5 */
237{
238 xs *ulist = user_list();
239 xs_list *p = ulist;
240 xs_str *v;
241
242 while (xs_list_iter(&p, &v)) {
243 user_open(snac, v);
244
245 if (strcmp(snac->md5, md5) == 0)
246 return 1;
247
248 user_free(snac);
249 }
250
251 return 0;
252}
253
254
235double mtime_nl(const char *fn, int *n_link) 255double mtime_nl(const char *fn, int *n_link)
236/* returns the mtime and number of links of a file or directory, or 0.0 */ 256/* returns the mtime and number of links of a file or directory, or 0.0 */
237{ 257{
diff --git a/mastoapi.c b/mastoapi.c
index d1ae463..7860046 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -722,12 +722,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
722 xs *out = NULL; 722 xs *out = NULL;
723 xs *actor = NULL; 723 xs *actor = NULL;
724 724
725 /* if uid it's the md5 of this actor, transform into a real uid */
726 if (strcmp(uid, snac1.md5) == 0)
727 uid = xs_dict_get(snac1.config, "uid");
728
729 /* is it a local user? */ 725 /* is it a local user? */
730 if (user_open(&snac2, uid)) { 726 if (user_open(&snac2, uid) || user_open_by_md5(&snac2, uid)) {
731 if (opt == NULL) { 727 if (opt == NULL) {
732 /* account information */ 728 /* account information */
733 actor = msg_actor(&snac2); 729 actor = msg_actor(&snac2);
diff --git a/snac.h b/snac.h
index 2ab4402..c46b85c 100644
--- a/snac.h
+++ b/snac.h
@@ -42,6 +42,7 @@ typedef struct _snac {
42int user_open(snac *snac, const char *uid); 42int user_open(snac *snac, const char *uid);
43void user_free(snac *snac); 43void user_free(snac *snac);
44d_char *user_list(void); 44d_char *user_list(void);
45int user_open_by_md5(snac *snac, const char *md5);
45 46
46void snac_debug(snac *snac, int level, d_char *str); 47void snac_debug(snac *snac, int level, d_char *str);
47#define snac_log(snac, str) snac_debug(snac, 0, str) 48#define snac_log(snac, str) snac_debug(snac, 0, str)