Regex get replies based on href

Before we used the results after, but it wasn't as efficient

FossilOrigin-Name: 1b014f011eaaffe7a29f7fdb4c86fa91cd43f386c9f69241b5b822ec171a4690
This commit is contained in:
me@ow.nekobit.net 2022-03-18 15:01:14 +00:00
parent 000948e0a1
commit 5813c25e1d

View file

@ -45,7 +45,13 @@ char* construct_post_box(char* reply_id,
return reply_html;
}
#define REGEX_REPLY "<a .*?href=\"https:\\/\\/(.*?)\\/.*?\".*?>@<span>(.*?)<\\/span>"
/* Some comments:
* - Misskey does not return <span>, but we still regex to make sure it's a highlight
* - The order of parameters in a tag can be changed (mastodon does this),
* so we just grep for regex href
* - Misskey/Mastodon adds an @ symbol in the href param, while pleroma adds /users
*/
#define REGEX_REPLY "<a .*?href=\"https:\\/\\/(.*?)\\/(?:@|users/)?(.*?)?\".*?>@(?:<span>)?.*?(?:<\\/span>)?"
#define REGEX_RESULTS_LEN 9
char* reply_status(char* id, struct mstdnt_status* status)