diff options
| author | 2023-12-06 14:46:51 +0100 | |
|---|---|---|
| committer | 2023-12-06 14:46:51 +0100 | |
| commit | bad729c631819db04191605a237c8fa632818dd8 (patch) | |
| tree | ececcb0643dfa5020e2b155c0208808d8e4a73e9 /data.c | |
| parent | Show the md5 of the original post in its link in html_actor_icon(). (diff) | |
| download | snac2-bad729c631819db04191605a237c8fa632818dd8.tar.gz snac2-bad729c631819db04191605a237c8fa632818dd8.tar.xz snac2-bad729c631819db04191605a237c8fa632818dd8.zip | |
Started work to support shared inboxes.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 23 |
1 files changed, 22 insertions, 1 deletions
| @@ -99,6 +99,9 @@ int srv_open(char *basedir, int auto_upgrade) | |||
| 99 | xs *ibdir = xs_fmt("%s/inbox", srv_basedir); | 99 | xs *ibdir = xs_fmt("%s/inbox", srv_basedir); |
| 100 | mkdirx(ibdir); | 100 | mkdirx(ibdir); |
| 101 | 101 | ||
| 102 | xs *tmpdir = xs_fmt("%s/tmp", srv_basedir); | ||
| 103 | mkdirx(tmpdir); | ||
| 104 | |||
| 102 | #ifdef __OpenBSD__ | 105 | #ifdef __OpenBSD__ |
| 103 | char *v = xs_dict_get(srv_config, "disable_openbsd_security"); | 106 | char *v = xs_dict_get(srv_config, "disable_openbsd_security"); |
| 104 | 107 | ||
| @@ -1586,9 +1589,12 @@ void tag_index(const char *id, const xs_dict *obj) | |||
| 1586 | char *name = xs_dict_get(v, "name"); | 1589 | char *name = xs_dict_get(v, "name"); |
| 1587 | 1590 | ||
| 1588 | if (!xs_is_null(type) && !xs_is_null(name) && strcmp(type, "Hashtag") == 0) { | 1591 | if (!xs_is_null(type) && !xs_is_null(name) && strcmp(type, "Hashtag") == 0) { |
| 1589 | if (*name == '#') | 1592 | while (*name == '#' || *name == '@') |
| 1590 | name++; | 1593 | name++; |
| 1591 | 1594 | ||
| 1595 | if (*name == '\0') | ||
| 1596 | continue; | ||
| 1597 | |||
| 1592 | name = xs_tolower_i(name); | 1598 | name = xs_tolower_i(name); |
| 1593 | 1599 | ||
| 1594 | xs *md5_tag = xs_md5_hex(name, strlen(name)); | 1600 | xs *md5_tag = xs_md5_hex(name, strlen(name)); |
| @@ -2123,6 +2129,21 @@ void enqueue_input(snac *snac, const xs_dict *msg, const xs_dict *req, int retri | |||
| 2123 | } | 2129 | } |
| 2124 | 2130 | ||
| 2125 | 2131 | ||
| 2132 | void enqueue_shared_input(const xs_dict *msg, const xs_dict *req, int retries) | ||
| 2133 | /* enqueues an input message from the shared input */ | ||
| 2134 | { | ||
| 2135 | xs *qmsg = _new_qmsg("input", msg, retries); | ||
| 2136 | char *ntid = xs_dict_get(qmsg, "ntid"); | ||
| 2137 | xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); | ||
| 2138 | |||
| 2139 | qmsg = xs_dict_append(qmsg, "req", req); | ||
| 2140 | |||
| 2141 | qmsg = _enqueue_put(fn, qmsg); | ||
| 2142 | |||
| 2143 | srv_debug(1, xs_fmt("enqueue_shared_input %s", fn)); | ||
| 2144 | } | ||
| 2145 | |||
| 2146 | |||
| 2126 | void enqueue_output_raw(const char *keyid, const char *seckey, | 2147 | void enqueue_output_raw(const char *keyid, const char *seckey, |
| 2127 | xs_dict *msg, xs_str *inbox, int retries, int p_status) | 2148 | xs_dict *msg, xs_str *inbox, int retries, int p_status) |
| 2128 | /* enqueues an output message to an inbox */ | 2149 | /* enqueues an output message to an inbox */ |