Supporting unicode <-> slackcode emoji conversions on message text #185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When someone types a unicode emoji in a message, slack will convert that into a slackcode
eg someone types 🦕 and slack's message text contains
:sauropod:
instead of 🦕, even though unicode was perfectly capable of representing the emoji as-is. I'm assuming they do this to better support clients on platforms using outdated unicode standards which have not defined some emoji.The downside is that this does not currently display nicely in libpurple client apps like pidgin.
The second minor issue is that slack-libpurple sends the raw unicode sequences, rather than slackcodes. IIUC, slack server converts the emoji when it sees them, but it is better if slack-libpurple sent the slackcodes directly.
So these patches add support for the unicode <-> slackcode emoji conversions on incoming and outgoing messages.
It is fairly simple based on a pair of lookup tables, populated from a json doc that is built into the binary using GResource. The actual JSON data comes from Weechat's slack plugin repo as-is.
This does not support user defined emoji, which would require downloading images from the slack server. That could potentially be added at a later date by extending this basic unicode emoji functionality.