commit e2c332c

default  ·  2022-11-25 11:09:30 +0000 UTC
parent 200a6a0
On Update + Person, call object_del() before actor_add().
3 files changed,  +7, -0
M data.c
M snac.h
+2, -0
 1@@ -917,7 +917,9 @@ int process_message(snac *snac, char *msg, char *req)
 2     else
 3     if (strcmp(type, "Update") == 0) {
 4         if (strcmp(utype, "Person") == 0) {
 5+            object_del(actor);
 6             actor_add(snac, actor, xs_dict_get(msg, "object"));
 7+
 8             snac_log(snac, xs_fmt("updated actor %s", actor));
 9         }
10         else
M data.c
+3, -0
 1@@ -433,6 +433,9 @@ int object_add(const char *id, d_char *obj)
 2         return 204; /* No content */
 3     }
 4 
 5+//    if (xs_dict_get(obj, "suspended") != NULL)
 6+//        srv_log(xs_fmt("object_add suspended: true %s", id));
 7+
 8     if ((f = fopen(fn, "w")) != NULL) {
 9         flock(fileno(f), LOCK_EX);
10 
M snac.h
+2, -0
1@@ -57,6 +57,8 @@ int index_del(const char *fn, const char *md5);
2 d_char *index_list(const char *fn, int max);
3 d_char *index_list_desc(const char *fn, int max);
4 
5+int object_del(const char *id);
6+
7 int follower_add(snac *snac, char *actor, char *msg);
8 int follower_del(snac *snac, char *actor);
9 int follower_check(snac *snac, char *actor);