summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c
index 88febbf..e003cfc 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -264,7 +264,9 @@ void process_tags(const char *content, d_char **n_content, d_char **tag)
264 char *p, *v; 264 char *p, *v;
265 int n = 0; 265 int n = 0;
266 266
267 p = split = xs_regex_split(content, "(@[A-Za-z0-9_]+@[A-Za-z0-9\\.-]+|#[^ ,\\.:;]+)"); 267 split = xs_regex_split(content, "(@[A-Za-z0-9_]+@[A-Za-z0-9\\.-]+|#[^ ,\\.:;]+)");
268
269 p = split;
268 while (xs_list_iter(&p, &v)) { 270 while (xs_list_iter(&p, &v)) {
269 if ((n & 0x1)) { 271 if ((n & 0x1)) {
270 if (*v == '@') { 272 if (*v == '@') {
@@ -320,18 +322,24 @@ d_char *msg_base(snac *snac, char *type, char *id, char *actor, char *date, char
320 xs *published = NULL; 322 xs *published = NULL;
321 323
322 /* generated values */ 324 /* generated values */
323 if (date && strcmp(date, "@now") == 0) 325 if (date && strcmp(date, "@now") == 0) {
324 date = published = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ"); 326 published = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
327 date = published;
328 }
325 329
326 if (id != NULL) { 330 if (id != NULL) {
327 if (strcmp(id, "@dummy") == 0) { 331 if (strcmp(id, "@dummy") == 0) {
328 xs *ntid = tid(0); 332 xs *ntid = tid(0);
329 id = did = xs_fmt("%s/d/%s/%s", snac->actor, ntid, type); 333 did = xs_fmt("%s/d/%s/%s", snac->actor, ntid, type);
334
335 id = did;
330 } 336 }
331 else 337 else
332 if (strcmp(id, "@object") == 0) { 338 if (strcmp(id, "@object") == 0) {
333 if (object != NULL) 339 if (object != NULL) {
334 id = did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type); 340 did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type);
341 id = did;
342 }
335 else 343 else
336 id = NULL; 344 id = NULL;
337 } 345 }