commit a73636f

default  ·  2023-05-24 07:43:11 +0000 UTC
parent adcdb28
Questions (polls) are now stored (but not yet shown).
1 files changed,  +25, -11
+25, -11
 1@@ -1135,22 +1135,28 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
 2     }
 3     else
 4     if (strcmp(type, "Create") == 0) {
 5+        if (is_muted(snac, actor))
 6+            snac_log(snac, xs_fmt("ignored 'Create' + '%s' from muted actor %s", utype, actor));
 7+
 8         if (strcmp(utype, "Note") == 0) {
 9-            if (is_muted(snac, actor))
10-                snac_log(snac, xs_fmt("ignored 'Note' from muted actor %s", actor));
11-            else {
12-                char *id          = xs_dict_get(object, "id");
13-                char *in_reply_to = xs_dict_get(object, "inReplyTo");
14-                xs *wrk           = NULL;
15+            char *id          = xs_dict_get(object, "id");
16+            char *in_reply_to = xs_dict_get(object, "inReplyTo");
17+            xs *wrk           = NULL;
18 
19-                timeline_request(snac, &in_reply_to, &wrk);
20+            timeline_request(snac, &in_reply_to, &wrk);
21 
22-                if (timeline_add(snac, id, object)) {
23-                    snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
24-                    do_notify = 1;
25-                }
26+            if (timeline_add(snac, id, object)) {
27+                snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
28+                do_notify = 1;
29             }
30         }
31+        else
32+        if (strcmp(utype, "Question") == 0) {
33+            char *id = xs_dict_get(object, "id");
34+
35+            if (timeline_add(snac, id, object))
36+                snac_log(snac, xs_fmt("new 'Question' %s %s", actor, id));
37+        }
38         else
39             snac_debug(snac, 1, xs_fmt("ignored 'Create' for object type '%s'", utype));
40     }
41@@ -1222,6 +1228,14 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
42 
43             snac_log(snac, xs_fmt("updated post %s", id));
44         }
45+        else
46+        if (strcmp(utype, "Question") == 0) {
47+            char *id = xs_dict_get(object, "id");
48+
49+            object_add_ow(id, object);
50+
51+            snac_log(snac, xs_fmt("updated poll %s", id));
52+        }
53         else
54             snac_log(snac, xs_fmt("ignored 'Update' for object type '%s'", utype));
55     }