diff options
| author | 2022-12-14 04:55:47 +0100 | |
|---|---|---|
| committer | 2022-12-14 04:55:47 +0100 | |
| commit | 645e7ec43e24600c8a3ecab3e43b07a6dbc91eb4 (patch) | |
| tree | c964f5950b6519d37d932fb059972c1b5fd56ee0 /activitypub.c | |
| parent | Updated TODO. (diff) | |
| download | snac2-645e7ec43e24600c8a3ecab3e43b07a6dbc91eb4.tar.gz snac2-645e7ec43e24600c8a3ecab3e43b07a6dbc91eb4.tar.xz snac2-645e7ec43e24600c8a3ecab3e43b07a6dbc91eb4.zip | |
Some code reordering to placate scan-build's wrath.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 20 |
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 | } |