mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-25 00:43:38 +00:00
New MUTE web action.
This commit is contained in:
parent
8e27f1d711
commit
3797355f94
3 changed files with 35 additions and 6 deletions
7
data.c
7
data.c
|
@ -885,6 +885,13 @@ d_char *history_get(snac *snac, char *id)
|
|||
}
|
||||
|
||||
|
||||
int history_del(snac *snac, char *id)
|
||||
{
|
||||
xs *fn = _history_fn(snac, id);
|
||||
return unlink(fn);
|
||||
}
|
||||
|
||||
|
||||
void enqueue_input(snac *snac, char *msg, char *req, int retries)
|
||||
/* enqueues an input message */
|
||||
{
|
||||
|
|
33
html.c
33
html.c
|
@ -505,6 +505,10 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
|
|||
if ((actor = xs_dict_get(msg, "attributedTo")) == NULL)
|
||||
return os;
|
||||
|
||||
/* ignore muted morons immediately */
|
||||
if (is_muted(snac, actor))
|
||||
return os;
|
||||
|
||||
if (!valid_status(actor_get(snac, actor, &actor_o)))
|
||||
return os;
|
||||
|
||||
|
@ -842,23 +846,40 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
|
|||
if (action == NULL)
|
||||
return 404;
|
||||
|
||||
if (strcmp(action, "Like") == 0) {
|
||||
snac_debug(&snac, 1, xs_fmt("web action '%s' received", action));
|
||||
|
||||
status = 303;
|
||||
|
||||
if (strcmp(action, L("Like")) == 0) {
|
||||
xs *msg = msg_admiration(&snac, id, "Like");
|
||||
post(&snac, msg);
|
||||
timeline_admire(&snac, id, snac.actor, 1);
|
||||
|
||||
status = 303;
|
||||
}
|
||||
else
|
||||
if (strcmp(action, "Boost") == 0) {
|
||||
if (strcmp(action, L("Boost")) == 0) {
|
||||
xs *msg = msg_admiration(&snac, id, "Announce");
|
||||
post(&snac, msg);
|
||||
timeline_admire(&snac, id, snac.actor, 0);
|
||||
|
||||
status = 303;
|
||||
}
|
||||
else
|
||||
if (strcmp(action, L("MUTE")) == 0) {
|
||||
mute(&snac, actor);
|
||||
}
|
||||
else
|
||||
if (strcmp(action, L("Follow")) == 0) {
|
||||
}
|
||||
else
|
||||
if (strcmp(action, L("Unfollow")) == 0) {
|
||||
}
|
||||
else
|
||||
if (strcmp(action, L("Delete")) == 0) {
|
||||
}
|
||||
else
|
||||
status = 404;
|
||||
|
||||
/* delete the cached timeline */
|
||||
if (status == 303)
|
||||
history_del(&snac, "_timeline.html");
|
||||
}
|
||||
else
|
||||
if (p_path && strcmp(p_path, "admin/user-setup") == 0) {
|
||||
|
|
1
snac.h
1
snac.h
|
@ -88,6 +88,7 @@ int static_get(snac *snac, char *id, d_char **data, int *size);
|
|||
double history_mtime(snac *snac, char *id);
|
||||
void history_add(snac *snac, char *id, char *content, int size);
|
||||
d_char *history_get(snac *snac, char *id);
|
||||
int history_del(snac *snac, char *id);
|
||||
|
||||
void enqueue_input(snac *snac, char *msg, char *req, int retries);
|
||||
void enqueue_output(snac *snac, char *msg, char *actor, int retries);
|
||||
|
|
Loading…
Reference in a new issue