diff options
| author | 2023-08-17 18:20:16 +0200 | |
|---|---|---|
| committer | 2023-08-17 18:20:16 +0200 | |
| commit | 8b176292d60975f498a5a1564ab66393a9f4fd5b (patch) | |
| tree | d7329a149cc22fcee7c8b7751c1b69513955c480 /format.c | |
| parent | mastoapi: in instance, return the list of supported mime types from the inter... (diff) | |
| download | penes-snac2-8b176292d60975f498a5a1564ab66393a9f4fd5b.tar.gz penes-snac2-8b176292d60975f498a5a1564ab66393a9f4fd5b.tar.xz penes-snac2-8b176292d60975f498a5a1564ab66393a9f4fd5b.zip | |
Simplified smiley processing.
Diffstat (limited to 'format.c')
| -rw-r--r-- | format.c | 60 |
1 files changed, 29 insertions, 31 deletions
| @@ -8,34 +8,30 @@ | |||
| 8 | #include "snac.h" | 8 | #include "snac.h" |
| 9 | 9 | ||
| 10 | /* emoticons, people laughing and such */ | 10 | /* emoticons, people laughing and such */ |
| 11 | 11 | const char *smileys[] = { | |
| 12 | struct { | 12 | ":-)", "🙂", |
| 13 | const char *key; | 13 | ":-D", "😀", |
| 14 | const char *value; | 14 | "X-D", "😆", |
| 15 | } smileys[] = { | 15 | ";-)", "😉", |
| 16 | { ":-)", "🙂" }, | 16 | "B-)", "😎", |
| 17 | { ":-D", "😀" }, | 17 | ">:-(", "😡", |
| 18 | { "X-D", "😆" }, | 18 | ":-(", "😞", |
| 19 | { ";-)", "😉" }, | 19 | ":-*", "😘", |
| 20 | { "B-)", "😎" }, | 20 | ":-/", "😕", |
| 21 | { ">:-(", "😡" }, | 21 | "8-o", "😲", |
| 22 | { ":-(", "😞" }, | 22 | "%-)", "🤪", |
| 23 | { ":-*", "😘" }, | 23 | ":_(", "😢", |
| 24 | { ":-/", "😕" }, | 24 | ":-|", "😐", |
| 25 | { "8-o", "😲" }, | 25 | "<3", "💓", |
| 26 | { "%-)", "🤪" }, | 26 | ":facepalm:", "🤦", |
| 27 | { ":_(", "😢" }, | 27 | ":shrug:", "🤷", |
| 28 | { ":-|", "😐" }, | 28 | ":shrug2:", "¯\\_(ツ)_/¯", |
| 29 | { "<3", "💓" }, | 29 | ":eyeroll:", "🙄", |
| 30 | { ":facepalm:", "🤦" }, | 30 | ":beer:", "🍺", |
| 31 | { ":shrug:", "🤷" }, | 31 | ":beers:", "🍻", |
| 32 | { ":shrug2:", "¯\\_(ツ)_/¯" }, | 32 | ":munch:", "😱", |
| 33 | { ":eyeroll:", "🙄" }, | 33 | ":thumb:", "👍", |
| 34 | { ":beer:", "🍺" }, | 34 | NULL, NULL |
| 35 | { ":beers:", "🍻" }, | ||
| 36 | { ":munch:", "😱" }, | ||
| 37 | { ":thumb:", "👍" }, | ||
| 38 | { NULL, NULL } | ||
| 39 | }; | 35 | }; |
| 40 | 36 | ||
| 41 | 37 | ||
| @@ -193,10 +189,12 @@ xs_str *not_really_markdown(const char *content, xs_list **attach) | |||
| 193 | 189 | ||
| 194 | { | 190 | { |
| 195 | /* traditional emoticons */ | 191 | /* traditional emoticons */ |
| 196 | int n; | 192 | const char **emo = smileys; |
| 197 | 193 | ||
| 198 | for (n = 0; smileys[n].key; n++) | 194 | while (*emo) { |
| 199 | s = xs_replace_i(s, smileys[n].key, smileys[n].value); | 195 | s = xs_replace_i(s, emo[0], emo[1]); |
| 196 | emo += 2; | ||
| 197 | } | ||
| 200 | } | 198 | } |
| 201 | 199 | ||
| 202 | return s; | 200 | return s; |