summary refs log tree commit diff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-05-23 01:00:35 +0200
committerGitHub <noreply@github.com>2020-05-23 01:00:35 +0200
commit33ba81a2e60bc958f155aeb1f7e3a7242d1abe30 (patch)
tree3064221b74ba459cb5aca8b7130065dca46673d6 /src/Utils.cpp
parentadd a bit of additional logging to image paste (diff)
parentAdded an optional feature to show bigger emoji-only messages with 3 or less e... (diff)
downloadnheko-33ba81a2e60bc958f155aeb1f7e3a7242d1abe30.tar.xz
Merge pull request #204 from lkito/master
Added an optional feature to show bigger emoji-only messages with 3 or less emoji
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp

index 7f11a8cd..d539eac5 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp
@@ -51,6 +51,14 @@ utils::localUser() return QString::fromStdString(http::client()->user_id().to_string()); } +bool +utils::codepointIsEmoji(uint code) +{ + // TODO: Be more precise here. + return (code >= 0x2600 && code <= 0x27bf) || (code >= 0x1f300 && code <= 0x1f3ff) || + (code >= 0x1f000 && code <= 0x1faff); +} + QString utils::replaceEmoji(const QString &body) { @@ -63,9 +71,7 @@ utils::replaceEmoji(const QString &body) bool insideFontBlock = false; for (auto &code : utf32_string) { - // TODO: Be more precise here. - if ((code >= 0x2600 && code <= 0x27bf) || (code >= 0x1f300 && code <= 0x1f3ff) || - (code >= 0x1f000 && code <= 0x1faff)) { + if (utils::codepointIsEmoji(code)) { if (!insideFontBlock) { fmtBody += QString("<font face=\"" + userFontFamily + "\">"); insideFontBlock = true;