Просмотр исходного кода

Fixed EmojiReact code to allow any emoticon in emojis.json, not only those with colon-wrapped ids.

grunfink 2 недель назад
Родитель
Сommit
748b578c96
2 измененных файлов с 3 добавлено и 5 удалено
  1. 3 3
      activitypub.c
  2. 0 2
      html.c

+ 3 - 3
activitypub.c

@@ -1607,7 +1607,7 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o)
 {
 {
     xs_dict *n_msg = msg_admiration(snac, mid, "EmojiReact");
     xs_dict *n_msg = msg_admiration(snac, mid, "EmojiReact");
 
 
-    xs *eid = xs_strip_chars_i(xs_dup(eid_o), ":");
+    xs *eid = xs_dup(eid_o);
     xs *content = NULL;
     xs *content = NULL;
     xs *tag = xs_list_new();
     xs *tag = xs_list_new();
     xs *dict = xs_dict_new();
     xs *dict = xs_dict_new();
@@ -1623,14 +1623,14 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o)
         content = xs_dup(eid);
         content = xs_dup(eid);
 
 
     else if (*eid == '%') {
     else if (*eid == '%') {
-        content = xs_url_dec_emoji(xs_dup(eid));
+        content = xs_url_dec_emoji(eid);
         if (content == NULL) {
         if (content == NULL) {
             xs_free(n_msg);
             xs_free(n_msg);
             return NULL;
             return NULL;
         }
         }
     }
     }
     else {
     else {
-        content = xs_fmt(":%s:", eid);
+        content = xs_dup(eid);
         const char *emo = xs_dict_get(emjs, content);
         const char *emo = xs_dict_get(emjs, content);
 
 
         if (emo == NULL) {
         if (emo == NULL) {

+ 0 - 2
html.c

@@ -5727,8 +5727,6 @@ int html_post_handler(const xs_dict *req, const char *q_path,
         if (strcmp(action, L("EmojiReact")) == 0) { /** **/
         if (strcmp(action, L("EmojiReact")) == 0) { /** **/
             xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
             xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
 
 
-            eid = xs_strip_chars_i(eid, ":");
-
             xs *ret = msg_emoji_init(&snac, id, eid);
             xs *ret = msg_emoji_init(&snac, id, eid);
             /* fails if either invalid or already reacted */
             /* fails if either invalid or already reacted */
             if (!ret) {
             if (!ret) {