mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Added mastoapi unfollow.
This commit is contained in:
parent
291f251ced
commit
4fca7c8a7e
2
data.c
2
data.c
@ -1125,7 +1125,7 @@ int following_check(snac *snac, const char *actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int following_get(snac *snac, char *actor, d_char **data)
|
int following_get(snac *snac, const char *actor, d_char **data)
|
||||||
/* returns the 'Follow' object */
|
/* returns the 'Follow' object */
|
||||||
{
|
{
|
||||||
xs *fn = _following_fn(snac, actor);
|
xs *fn = _following_fn(snac, actor);
|
||||||
|
16
mastoapi.c
16
mastoapi.c
@ -1644,6 +1644,22 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(opt, "unfollow") == 0) {
|
if (strcmp(opt, "unfollow") == 0) {
|
||||||
|
if (valid_status(object_get_by_md5(md5, &actor_o))) {
|
||||||
|
const char *actor = xs_dict_get(actor_o, "id");
|
||||||
|
|
||||||
|
/* get the following object */
|
||||||
|
xs *object = NULL;
|
||||||
|
|
||||||
|
if (valid_status(following_get(&snac, actor, &object))) {
|
||||||
|
xs *msg = msg_undo(&snac, xs_dict_get(object, "object"));
|
||||||
|
|
||||||
|
following_del(&snac, actor);
|
||||||
|
|
||||||
|
enqueue_output_by_actor(&snac, msg, actor, 0);
|
||||||
|
|
||||||
|
rsp = mastoapi_relationship(&snac, md5);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
snac.h
2
snac.h
@ -115,7 +115,7 @@ d_char *local_list(snac *snac, int max);
|
|||||||
int following_add(snac *snac, const char *actor, const xs_dict *msg);
|
int following_add(snac *snac, const char *actor, const xs_dict *msg);
|
||||||
int following_del(snac *snac, char *actor);
|
int following_del(snac *snac, char *actor);
|
||||||
int following_check(snac *snac, const char *actor);
|
int following_check(snac *snac, const char *actor);
|
||||||
int following_get(snac *snac, char *actor, d_char **data);
|
int following_get(snac *snac, const char *actor, d_char **data);
|
||||||
d_char *following_list(snac *snac);
|
d_char *following_list(snac *snac);
|
||||||
|
|
||||||
void mute(snac *snac, const char *actor);
|
void mute(snac *snac, const char *actor);
|
||||||
|
Loading…
Reference in New Issue
Block a user