mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
Log (and not notify) repeated likes and announces.
This commit is contained in:
parent
ae6aafeb88
commit
e9553379e9
3 changed files with 18 additions and 9 deletions
|
@ -1955,9 +1955,12 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
|||
if (xs_type(object) == XSTYPE_DICT)
|
||||
object = xs_dict_get(object, "id");
|
||||
|
||||
timeline_admire(snac, object, actor, 1);
|
||||
snac_log(snac, xs_fmt("new 'Like' %s %s", actor, object));
|
||||
do_notify = 1;
|
||||
if (timeline_admire(snac, object, actor, 1) == 201) {
|
||||
snac_log(snac, xs_fmt("new 'Like' %s %s", actor, object));
|
||||
do_notify = 1;
|
||||
}
|
||||
else
|
||||
snac_log(snac, xs_fmt("repeated 'Like' from %s to %s", actor, object));
|
||||
}
|
||||
else
|
||||
if (strcmp(type, "Announce") == 0) { /** **/
|
||||
|
@ -1983,9 +1986,13 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
|||
xs *who_o = NULL;
|
||||
|
||||
if (valid_status(actor_request(snac, who, &who_o))) {
|
||||
timeline_admire(snac, object, actor, 0);
|
||||
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
|
||||
do_notify = 1;
|
||||
if (timeline_admire(snac, object, actor, 0) == 201) {
|
||||
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
|
||||
do_notify = 1;
|
||||
}
|
||||
else
|
||||
snac_log(snac, xs_fmt("repeated 'Announce' from %s to %s",
|
||||
actor, object));
|
||||
}
|
||||
else
|
||||
snac_debug(snac, 1, xs_fmt("dropped 'Announce' on actor request error %s", who));
|
||||
|
|
6
data.c
6
data.c
|
@ -1107,7 +1107,7 @@ int timeline_add(snac *snac, const char *id, const xs_dict *o_msg)
|
|||
}
|
||||
|
||||
|
||||
void timeline_admire(snac *snac, const char *id, const char *admirer, int like)
|
||||
int timeline_admire(snac *snac, const char *id, const char *admirer, int like)
|
||||
/* updates a timeline entry with a new admiration */
|
||||
{
|
||||
/* if we are admiring this, add to both timelines */
|
||||
|
@ -1116,10 +1116,12 @@ void timeline_admire(snac *snac, const char *id, const char *admirer, int like)
|
|||
object_user_cache_add(snac, id, "private");
|
||||
}
|
||||
|
||||
object_admire(id, admirer, like);
|
||||
int ret = object_admire(id, admirer, like);
|
||||
|
||||
snac_debug(snac, 1, xs_fmt("timeline_admire (%s) %s %s",
|
||||
like ? "Like" : "Announce", id, admirer));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
2
snac.h
2
snac.h
|
@ -133,7 +133,7 @@ int timeline_del(snac *snac, char *id);
|
|||
xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show);
|
||||
xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show);
|
||||
int timeline_add(snac *snac, const char *id, const xs_dict *o_msg);
|
||||
void timeline_admire(snac *snac, const char *id, const char *admirer, int like);
|
||||
int timeline_admire(snac *snac, const char *id, const char *admirer, int like);
|
||||
|
||||
xs_list *timeline_top_level(snac *snac, xs_list *list);
|
||||
xs_list *local_list(snac *snac, int max);
|
||||
|
|
Loading…
Reference in a new issue