summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authorGravatar default2022-10-07 19:02:29 +0200
committerGravatar default2022-10-07 19:02:29 +0200
commite6e84ce7b8b4f34dd2e7df2f38610749f612ad6b (patch)
tree6fd94dd55cce75bdea0731468787d2cd2ba4713a /format.c
parentMoved message formatting to format.c. (diff)
downloadsnac2-e6e84ce7b8b4f34dd2e7df2f38610749f612ad6b.tar.gz
snac2-e6e84ce7b8b4f34dd2e7df2f38610749f612ad6b.tar.xz
snac2-e6e84ce7b8b4f34dd2e7df2f38610749f612ad6b.zip
Added a set of smileys/emoticons that are replaced by emojis.
Diffstat (limited to 'format.c')
-rw-r--r--format.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/format.c b/format.c
index b5d4cf7..abf9b03 100644
--- a/format.c
+++ b/format.c
@@ -6,6 +6,30 @@
6 6
7#include "snac.h" 7#include "snac.h"
8 8
9/* emoticons, people laughing and such */
10
11struct {
12 const char *key;
13 const char *value;
14} smileys[] = {
15 { ":-)", "🙂" },
16 { ":-D", "😀" },
17 { "X-D", "😆" },
18 { ";-)", "😉" },
19 { "B-)", "😎" },
20 { ":-(", "😞" },
21 { ":-*", "😘" },
22 { ":-/", "😕" },
23 { "8-o", "😲" },
24 { "%-)", "🤪" },
25 { ":_(", "😢" },
26 { ":-|", "😐" },
27 { ":facepalm:", "🤦" },
28 { ":shrug:", "🤷" },
29 { NULL, NULL }
30};
31
32
9d_char *not_really_markdown(char *content, d_char **f_content) 33d_char *not_really_markdown(char *content, d_char **f_content)
10/* formats a content using some Markdown rules */ 34/* formats a content using some Markdown rules */
11{ 35{
@@ -110,6 +134,14 @@ d_char *not_really_markdown(char *content, d_char **f_content)
110 /* some beauty fixes */ 134 /* some beauty fixes */
111 s = xs_replace_i(s, "</blockquote><br>", "</blockquote>"); 135 s = xs_replace_i(s, "</blockquote><br>", "</blockquote>");
112 136
137 {
138 /* traditional emoticons */
139 int n;
140
141 for (n = 0; smileys[n].key; n++)
142 s = xs_replace_i(s, smileys[n].key, smileys[n].value);
143 }
144
113 *f_content = s; 145 *f_content = s;
114 146
115 return *f_content; 147 return *f_content;