summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c2
-rw-r--r--data.c6
-rw-r--r--format.c3
-rw-r--r--mastoapi.c13
4 files changed, 13 insertions, 11 deletions
diff --git a/activitypub.c b/activitypub.c
index 120b4a1..c06d8df 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -903,7 +903,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag)
903 if (*v == '#') { 903 if (*v == '#') {
904 /* hashtag */ 904 /* hashtag */
905 xs *d = xs_dict_new(); 905 xs *d = xs_dict_new();
906 xs *n = xs_tolower_i(xs_dup(v)); 906 xs *n = xs_utf8_to_lower(xs_dup(v));
907 xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1); 907 xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1);
908 xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v); 908 xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v);
909 909
diff --git a/data.c b/data.c
index f9d27f9..631a68b 100644
--- a/data.c
+++ b/data.c
@@ -2217,7 +2217,7 @@ void tag_index(const char *id, const xs_dict *obj)
2217 if (*name == '\0') 2217 if (*name == '\0')
2218 continue; 2218 continue;
2219 2219
2220 name = xs_tolower_i((xs_str *)name); 2220 name = xs_utf8_to_lower((xs_str *)name);
2221 2221
2222 xs *md5_tag = xs_md5_hex(name, strlen(name)); 2222 xs *md5_tag = xs_md5_hex(name, strlen(name));
2223 xs *tag_dir = xs_fmt("%s/%c%c", g_tag_dir, md5_tag[0], md5_tag[1]); 2223 xs *tag_dir = xs_fmt("%s/%c%c", g_tag_dir, md5_tag[0], md5_tag[1]);
@@ -2247,7 +2247,7 @@ xs_str *tag_fn(const char *tag)
2247 if (*tag == '#') 2247 if (*tag == '#')
2248 tag++; 2248 tag++;
2249 2249
2250 xs *lw_tag = xs_tolower_i(xs_dup(tag)); 2250 xs *lw_tag = xs_utf8_to_lower(xs_dup(tag));
2251 xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag)); 2251 xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag));
2252 2252
2253 return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5); 2253 return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5);
@@ -2834,7 +2834,7 @@ int content_match(const char *file, const xs_dict *msg)
2834 /* massage content (strip HTML tags, etc.) */ 2834 /* massage content (strip HTML tags, etc.) */
2835 xs *c = xs_regex_replace(v, "<[^>]+>", " "); 2835 xs *c = xs_regex_replace(v, "<[^>]+>", " ");
2836 c = xs_regex_replace_i(c, " {2,}", " "); 2836 c = xs_regex_replace_i(c, " {2,}", " ");
2837 c = xs_tolower_i(c); 2837 c = xs_utf8_to_lower(c);
2838 2838
2839 while (!r && !feof(f)) { 2839 while (!r && !feof(f)) {
2840 xs *rx = xs_strip_i(xs_readline(f)); 2840 xs *rx = xs_strip_i(xs_readline(f));
diff --git a/format.c b/format.c
index 2f30a0d..0f844cd 100644
--- a/format.c
+++ b/format.c
@@ -8,6 +8,7 @@
8#include "xs_json.h" 8#include "xs_json.h"
9#include "xs_time.h" 9#include "xs_time.h"
10#include "xs_match.h" 10#include "xs_match.h"
11#include "xs_unicode.h"
11 12
12#include "snac.h" 13#include "snac.h"
13 14
@@ -443,7 +444,7 @@ xs_str *sanitize(const char *content)
443 if (n & 0x1) { 444 if (n & 0x1) {
444 xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1)); 445 xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1));
445 xs *l1 = xs_split_n(s1, " ", 1); 446 xs *l1 = xs_split_n(s1, " ", 1);
446 xs *tag = xs_tolower_i(xs_dup(xs_list_get(l1, 0))); 447 xs *tag = xs_utf8_to_lower(xs_dup(xs_list_get(l1, 0)));
447 xs *s2 = NULL; 448 xs *s2 = NULL;
448 int i; 449 int i;
449 450
diff --git a/mastoapi.c b/mastoapi.c
index a7d9c34..c46a971 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -15,6 +15,7 @@
15#include "xs_url.h" 15#include "xs_url.h"
16#include "xs_mime.h" 16#include "xs_mime.h"
17#include "xs_match.h" 17#include "xs_match.h"
18#include "xs_unicode.h"
18 19
19#include "snac.h" 20#include "snac.h"
20 21
@@ -381,7 +382,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
381 } 382 }
382 } 383 }
383 384
384 /* no code? 385 /* no code?
385 I'm not sure of the impacts of this right now, but Subway Tooter does not 386 I'm not sure of the impacts of this right now, but Subway Tooter does not
386 provide a code so one must be generated */ 387 provide a code so one must be generated */
387 if (xs_is_null(code)){ 388 if (xs_is_null(code)){
@@ -1637,7 +1638,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1637 const char *aq = xs_dict_get(args, "q"); 1638 const char *aq = xs_dict_get(args, "q");
1638 1639
1639 if (!xs_is_null(aq)) { 1640 if (!xs_is_null(aq)) {
1640 xs *q = xs_tolower_i(xs_dup(aq)); 1641 xs *q = xs_utf8_to_lower(xs_dup(aq));
1641 out = xs_list_new(); 1642 out = xs_list_new();
1642 xs *wing = following_list(&snac1); 1643 xs *wing = following_list(&snac1);
1643 xs *wers = follower_list(&snac1); 1644 xs *wers = follower_list(&snac1);
@@ -1780,7 +1781,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1780 } 1781 }
1781 else 1782 else
1782 if (strcmp(opt, "statuses") == 0) { 1783 if (strcmp(opt, "statuses") == 0) {
1783 /* we don't serve statuses of others; return the empty list */ 1784 /* we don't serve statuses of others; return the empty list */
1784 out = xs_list_new(); 1785 out = xs_list_new();
1785 } 1786 }
1786 else 1787 else
@@ -1999,7 +2000,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1999 } 2000 }
2000 else 2001 else
2001 if (strcmp(cmd, "/v2/filters") == 0) { /** **/ 2002 if (strcmp(cmd, "/v2/filters") == 0) { /** **/
2002 /* snac will never have filters 2003 /* snac will never have filters
2003 * but still, without a v2 endpoint a short delay is introduced 2004 * but still, without a v2 endpoint a short delay is introduced
2004 * in some apps */ 2005 * in some apps */
2005 *body = xs_dup("[]"); 2006 *body = xs_dup("[]");
@@ -2459,7 +2460,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2459 if (logged_in) { 2460 if (logged_in) {
2460 const xs_list *timeline = xs_dict_get(args, "timeline[]"); 2461 const xs_list *timeline = xs_dict_get(args, "timeline[]");
2461 xs_str *json = NULL; 2462 xs_str *json = NULL;
2462 if (!xs_is_null(timeline)) 2463 if (!xs_is_null(timeline))
2463 json = xs_json_dumps(markers_get(&snac1, timeline), 4); 2464 json = xs_json_dumps(markers_get(&snac1, timeline), 4);
2464 2465
2465 if (!xs_is_null(json)) 2466 if (!xs_is_null(json))
@@ -3227,7 +3228,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
3227 if (!xs_is_null(home)) 3228 if (!xs_is_null(home))
3228 home_marker = xs_dict_get(home, "last_read_id"); 3229 home_marker = xs_dict_get(home, "last_read_id");
3229 } 3230 }
3230 3231
3231 const xs_str *notify_marker = xs_dict_get(args, "notifications[last_read_id]"); 3232 const xs_str *notify_marker = xs_dict_get(args, "notifications[last_read_id]");
3232 if (xs_is_null(notify_marker)) { 3233 if (xs_is_null(notify_marker)) {
3233 const xs_dict *notify = xs_dict_get(args, "notifications"); 3234 const xs_dict *notify = xs_dict_get(args, "notifications");