summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c
index ec1d820..a6fa645 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -173,22 +173,51 @@ d_char *msg_update(snac *snac, char *object)
173void process_message(snac *snac, char *msg, char *req) 173void process_message(snac *snac, char *msg, char *req)
174/* processes an ActivityPub message from the input queue */ 174/* processes an ActivityPub message from the input queue */
175{ 175{
176 /* they exist, were checked previously */ 176 /* actor and type exist, were checked previously */
177 char *actor = xs_dict_get(msg, "actor"); 177 char *actor = xs_dict_get(msg, "actor");
178 char *type = xs_dict_get(msg, "type"); 178 char *type = xs_dict_get(msg, "type");
179
180 char *object, *utype;
181
182 object = xs_dict_get(msg, "object");
183 if (object != NULL && xs_type(object) == XSTYPE_SOD)
184 utype = xs_dict_get(object, "type");
185 else
186 utype = "(null)";
179 187
180 /* check the signature */ 188 /* check the signature */
181 /* ... */ 189 /* ... */
182 190
191/*
183 if (strcmp(type, "Follow") == 0) { 192 if (strcmp(type, "Follow") == 0) {
184 } 193 }
185 else 194 else
186 if (strcmp(type, "Undo") == 0) { 195 if (strcmp(type, "Undo") == 0) {
187 } 196 }
188 else 197 else
198*/
189 if (strcmp(type, "Create") == 0) { 199 if (strcmp(type, "Create") == 0) {
200 if (strcmp(utype, "Note") == 0) {
201 if (is_muted(snac, actor))
202 snac_log(snac, xs_fmt("ignored 'Note' from muted actor %s", actor));
203 else {
204 char *id = xs_dict_get(object, "id");
205 char *in_reply_to = xs_dict_get(object, "inReplyTo");
206
207 if (in_reply_to != NULL) {
208 /* recursively download ancestors */
209 /* ... */
210 }
211
212 snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
213 timeline_add(snac, id, msg, in_reply_to);
214 }
215 }
216 else
217 snac_debug(snac, 1, xs_fmt("ignored 'Create' for object type '%s'", utype));
190 } 218 }
191 else 219 else
220/*
192 if (strcmp(type, "Accept") == 0) { 221 if (strcmp(type, "Accept") == 0) {
193 } 222 }
194 else 223 else
@@ -201,6 +230,7 @@ void process_message(snac *snac, char *msg, char *req)
201 if (strcmp(type, "Delete") == 0) { 230 if (strcmp(type, "Delete") == 0) {
202 } 231 }
203 else 232 else
233*/
204 snac_debug(snac, 1, xs_fmt("process_message type '%s' ignored", type)); 234 snac_debug(snac, 1, xs_fmt("process_message type '%s' ignored", type));
205} 235}
206 236