DEV Community

Gary Kramlich
Gary Kramlich

Posted on

Random Thoughts on Implementing Reactions

I was randomly thinking of how we'd integrate stuff like Mastodon, Twitter, Facebook posts, YouTube videos, and so on into Pidgin 3. Now I'm not saying I'm planning on implementing these, but thinking about these helps determine how the interface should work to make them possible while still supporting traditional chat applications.

Replies/comments will be easy as they'll be built into libpurple. The protocol would just treat each post or whatever has a channel or group direct message and then everything else is business as usual.

However reactions might get weird because some of these only allow a few different reactions. For Mastodon and Twitter this is star/like, YouTube is thumbs up and thumbs down, and Facebook has it's normal 6 or whatever reactions.

Reactions are something we need to have and it's a topic I haven't actually spent much time thinking about it, but it's going to be coming up soon (tm), so I've been slowly working the problem.

In traditional chat applications you can usually react with anything from the Unicode Emoji list which would have made this whole thing easy if that were the only thing you could react with.

However, other chat networks have custom emoji that can be used as reactions too. Discord in particular makes this kind of funky because some servers won't allow custom emojis and other servers only let you use their custom emojis on their server.

With that background now, it becomes obvious that the only real way to determine what reactions are available for a given message is to ask the protocol plugin itself on a per message basis.

This means that we will have to add additional API to do this. This is anything major, and protocols that have a static list of elements, like Mastodon, Twitter, YouTube, etc will just have a simple function that can return the available reactions, where as something like Discord can go and ask the server what's available if need be.

Now that the UI knows what reactions the user can use, it can then pass it on to the protocol which will actually pass it on to the server doing what it needs to do.

We still need to figure out the exact representation reactions, which will probably just be an id,icon-name, anddescription`, but since most reactions are repurposed emoji, we'll probably have to wait until those are sorted out before moving forward.

At any rate we now have some ideas on how to move forward here which is always a good place to be :)

Top comments (0)