diff options
| author | 2023-05-24 09:43:11 +0200 | |
|---|---|---|
| committer | 2023-05-24 09:43:11 +0200 | |
| commit | a73636f671045daec1feee6ba521434b3549c595 (patch) | |
| tree | 220e5faa794b7968b83d348f9d47a9dd414945e9 | |
| parent | Updated TODO. (diff) | |
| download | penes-snac2-a73636f671045daec1feee6ba521434b3549c595.tar.gz penes-snac2-a73636f671045daec1feee6ba521434b3549c595.tar.xz penes-snac2-a73636f671045daec1feee6ba521434b3549c595.zip | |
Questions (polls) are now stored (but not yet shown).
| -rw-r--r-- | activitypub.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/activitypub.c b/activitypub.c index 406aee8..8a91f6a 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1135,23 +1135,29 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) | |||
| 1135 | } | 1135 | } |
| 1136 | else | 1136 | else |
| 1137 | if (strcmp(type, "Create") == 0) { | 1137 | if (strcmp(type, "Create") == 0) { |
| 1138 | if (is_muted(snac, actor)) | ||
| 1139 | snac_log(snac, xs_fmt("ignored 'Create' + '%s' from muted actor %s", utype, actor)); | ||
| 1140 | |||
| 1138 | if (strcmp(utype, "Note") == 0) { | 1141 | if (strcmp(utype, "Note") == 0) { |
| 1139 | if (is_muted(snac, actor)) | 1142 | char *id = xs_dict_get(object, "id"); |
| 1140 | snac_log(snac, xs_fmt("ignored 'Note' from muted actor %s", actor)); | 1143 | char *in_reply_to = xs_dict_get(object, "inReplyTo"); |
| 1141 | else { | 1144 | xs *wrk = NULL; |
| 1142 | char *id = xs_dict_get(object, "id"); | ||
| 1143 | char *in_reply_to = xs_dict_get(object, "inReplyTo"); | ||
| 1144 | xs *wrk = NULL; | ||
| 1145 | 1145 | ||
| 1146 | timeline_request(snac, &in_reply_to, &wrk); | 1146 | timeline_request(snac, &in_reply_to, &wrk); |
| 1147 | 1147 | ||
| 1148 | if (timeline_add(snac, id, object)) { | 1148 | if (timeline_add(snac, id, object)) { |
| 1149 | snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); | 1149 | snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); |
| 1150 | do_notify = 1; | 1150 | do_notify = 1; |
| 1151 | } | ||
| 1152 | } | 1151 | } |
| 1153 | } | 1152 | } |
| 1154 | else | 1153 | else |
| 1154 | if (strcmp(utype, "Question") == 0) { | ||
| 1155 | char *id = xs_dict_get(object, "id"); | ||
| 1156 | |||
| 1157 | if (timeline_add(snac, id, object)) | ||
| 1158 | snac_log(snac, xs_fmt("new 'Question' %s %s", actor, id)); | ||
| 1159 | } | ||
| 1160 | else | ||
| 1155 | snac_debug(snac, 1, xs_fmt("ignored 'Create' for object type '%s'", utype)); | 1161 | snac_debug(snac, 1, xs_fmt("ignored 'Create' for object type '%s'", utype)); |
| 1156 | } | 1162 | } |
| 1157 | else | 1163 | else |
| @@ -1223,6 +1229,14 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) | |||
| 1223 | snac_log(snac, xs_fmt("updated post %s", id)); | 1229 | snac_log(snac, xs_fmt("updated post %s", id)); |
| 1224 | } | 1230 | } |
| 1225 | else | 1231 | else |
| 1232 | if (strcmp(utype, "Question") == 0) { | ||
| 1233 | char *id = xs_dict_get(object, "id"); | ||
| 1234 | |||
| 1235 | object_add_ow(id, object); | ||
| 1236 | |||
| 1237 | snac_log(snac, xs_fmt("updated poll %s", id)); | ||
| 1238 | } | ||
| 1239 | else | ||
| 1226 | snac_log(snac, xs_fmt("ignored 'Update' for object type '%s'", utype)); | 1240 | snac_log(snac, xs_fmt("ignored 'Update' for object type '%s'", utype)); |
| 1227 | } | 1241 | } |
| 1228 | else | 1242 | else |