Four more prpls


It suddenly occurred to me that I never posted about the new prpls that I’ve written since the Hangouts prpl. Today we shall fix that.

Rocket.Chat

The first plugin since Hangouts was one for Rocket.Chat, an open-source team communications platform (read: Slack-clone) that uses the Meteor DDP protocol (ugh, RAS syndrome!) for syncing data over websockets.

What’s most interesting about this prpl is its use of Markdown for rich-text formatting, rather than HTML; a first for a protocol for me. After hunting around for a few C or C++ libraries for converting Markdown into HTML so that it can be rendered in libpurple, I ended up settling on libdiscount2 and a home-grown parser for HTML to Markdown using GMarkupParser.

Unfortunately Rocket.Chat doesn’t have a very stable API, so some calls will have parameters in different order’s depending on what version of the Rocket.Chat server the plugin is connected to. Also annoying was that the demo server has different API’s and responses than a normal Rocket.Chat server would, so getting the plugin working against the demo server then didn’t work against a regular server that I also tested with.

I managed to get most features implemented, including IM’s and group chats, as well as a pseudo-buddy list based on people you’ve messaged (with an ‘auto add’ account setting)

Battle.net v2

aka Blizzard Client, not to be confused with Battle.net Classic. Battle.net is a protobuf-based protocol with a unique RPC mechanism. Kudos to the HearthSim for figuring it all out 🙂

What’s interesting about this protocol is that it sends “Player X is in game Y” information as a numeric code rather than as a string, in order for the client to handle translations without the protocol having to worry about it. Also interesting is that two games can share the same numeric code to mean two totally different user statuses. What’s also unique about this protocol is that the ‘Away’ presence is set as a flag, similar to AIM so technically a user can say they’re Online, Away and Busy all at the same time (although the UI prevents this in practice). libpurple has support for statuses as flags, but the Pidgin GUI won’t let you set a status that way, so there’s a bit of hackery to be able to set a status as if it weren’t a flag, but receive a status as if it were a flag.

I’ve only added support for IM’s and not chats at this stage, but so far there hasn’t been any demand for group chats. Maybe in the future?

Discord

Discord is like “Slack for Gamers”. It’s a hosted team collaboration focused at the gaming market. It’s API is primarily Websocket-based with HTTP/REST API calls to compliment.

There’s been a Discord plugin for bitlbee around for over a year now, and I’ve had requests to bring that to Pidgin. Initially I tried porting the plugin to libpurple with a crazy bunch of #define’s in order not to not need to rewrite it to use libpurple functions instead of bitlbee functions, but that didn’t really work out. I did experiment with making a plugin loader for libpurple that would let it load in bitlbee plugins, but after copying over most of bitlbee’s code to be able to achieve this, it seemed like a maintenance nightmare and was quickly abandoned too 🙂 Instead, I started a new plugin based on the Rocket.Chat plugin (which was in-turn based on the FunYahoo++ plugin *puke*).

The quirk in this protocol is the ability to connect to multiple Servers (aka Guilds) from one account. While Slack or Rocket.Chat let you do something similar, you need to set up separate accounts with each server to be able to do so; not an all-in-one-family-feedbag like Discord does. So there’s a bit of extra code needed to be able to translate a room onto a server and vice versa.

This is still a work-in-progress (I only started work on it a couple of weeks ago), but already it’s got pretty solid group chat, buddy list, and direct message integration. This one might even be the first prpl from me that gets WebRTC-based audio integration into libpurple (after a failed attempt in the Hangouts plugin). We shall see!

Mattermost

The latest plugin I’ve been writing is one for Mattermost, an open-source Slack alternative (similar to Rocket.Chat). The protocol is primarily REST-based with a Websocket used for live events such as messages or presence info.

Mattermost is similar to Discord in that one account can connect to multiple Teams, which can be on one server – so we’re using a similar lookup table for mapping group chat “channels” to the corresponding team. It’s also similar to Rocket.chat in that it uses Markdown in its protocol for rich-text.

What’s really great about working with Mattermost is that the API is consistent, with sensible deprecation policies (contrast with Rocket.Chat’s “fast and loose” strategy when it comes to changing API parameters). What’s a little scary is that the API major version seems to get a bump every year, and there might need to be frequent changes in the plugin to adapt with the newer server API versions – but it might also be nothing to worry about 🙂

This is another work-in-progress plugin that I only started on a few days ago, and I’ve been working with the Mattermost developers to come up with a great plugin. They’ve also been really helpful in building documentation for installing and using the plugin.

Go get ’em!

The easiest way to find the new plugins is via the Pidgin ThirdPartyPlugins wiki page which will also give you links to lots of other tasty libpurple and Pidgin plugins 🙂

Comments are closed.