mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
Added a set of smileys/emoticons that are replaced by emojis.
This commit is contained in:
parent
9aec7c9fa8
commit
e6e84ce7b8
1 changed files with 32 additions and 0 deletions
32
format.c
32
format.c
|
@ -6,6 +6,30 @@
|
|||
|
||||
#include "snac.h"
|
||||
|
||||
/* emoticons, people laughing and such */
|
||||
|
||||
struct {
|
||||
const char *key;
|
||||
const char *value;
|
||||
} smileys[] = {
|
||||
{ ":-)", "🙂" },
|
||||
{ ":-D", "😀" },
|
||||
{ "X-D", "😆" },
|
||||
{ ";-)", "😉" },
|
||||
{ "B-)", "😎" },
|
||||
{ ":-(", "😞" },
|
||||
{ ":-*", "😘" },
|
||||
{ ":-/", "😕" },
|
||||
{ "8-o", "😲" },
|
||||
{ "%-)", "🤪" },
|
||||
{ ":_(", "😢" },
|
||||
{ ":-|", "😐" },
|
||||
{ ":facepalm:", "🤦" },
|
||||
{ ":shrug:", "🤷" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
d_char *not_really_markdown(char *content, d_char **f_content)
|
||||
/* formats a content using some Markdown rules */
|
||||
{
|
||||
|
@ -110,6 +134,14 @@ d_char *not_really_markdown(char *content, d_char **f_content)
|
|||
/* some beauty fixes */
|
||||
s = xs_replace_i(s, "</blockquote><br>", "</blockquote>");
|
||||
|
||||
{
|
||||
/* traditional emoticons */
|
||||
int n;
|
||||
|
||||
for (n = 0; smileys[n].key; n++)
|
||||
s = xs_replace_i(s, smileys[n].key, smileys[n].value);
|
||||
}
|
||||
|
||||
*f_content = s;
|
||||
|
||||
return *f_content;
|
||||
|
|
Loading…
Reference in a new issue