DEV Community

Gary Kramlich
Gary Kramlich

Posted on • Originally published at patreon.com

Pidgin's Architecture

This article was originally posted on Patreon and has been brought over here to get all of the Pidgin Development/History posts into one single place.

We get asked the question all the time of "Why don't you write Pidgin in the UI Toolkit I prefer?" and the simple answer to this is that Pidgin is just a user interface. If you want a chat client in the UI Tookit you prefer you can use libpurple to make this happen.

This is the point where I lose everyone and a big reason for this is that people don't understand how libpurple works with Pidgin, Finch, Adium, bitlbee, spectrum2, telepathy-haze, and maybe others I'm not aware of or forgetting. So that's what we're going to try and tackle today.

At a high level, libpurple not only creates an abstract interface for chat networks, but it does the same for chat user interfaces. Lets look at a quick diagram.

Image description

On the left side we have a selection of chat networks that have been implemented to work with libpurple. They implement their chosen network via the abstraction layer in libpurple that makes them available to all of the user interfaces on the right.

Like wise, the user interfaces just implement the user interface abstractions in libpurple using the toolkit of their choice or in some cases a completely different interface.

The traditional chat clients are implemented to work on specific platforms. Adium provides a Cocoa (macOS) interface to libpurple. It's a bit more complicated than that, but lets just go with that for simplicity. Finch provides a console based interface using libgnt (which we also provide) which is built on top of ncurses. Pidgin is built on top of GTK which is where this all started way back in 1998.

Not to be forgotten are the gateway "user interfaces" of BitlBee and Spectrum 2. These clients allow you to talk to multiple networks by the use of libpurple by instead using an IRC client in the case of BitlBee, or an Slack/XMPP client in the case of Spectrum 2.

All of this works because of the user interface abstraction layer in libpurple. It allows an implementer to focus on their interface and not worry about the details of chat networks at all. This is precisely why I always say, Pidgin is just a UI!

I know this post barely scratched the surface, but as libpurple3 and Pidgin3 get closer to a release, I am planning on writing a series of blog posts or even videos on how build your own custom user interface on top of libpurple. Maybe I'll even build the chat bot framework on top of libpurple I've been hoping someone will write for a very long time.

I hope you're enjoying these posts! Remember they go live for patrons at 9AM CST on Mondays and go public at 12AM CST on Thursdays! If there's something specific you'd like to see me cover here, please comment below!

Top comments (2)

Collapse
 
nedbog profile image
Bogdan Nedelcu

Those series of blog posts will be really interesting.

Collapse
 
grim profile image
Gary Kramlich

Thanks, I'm still reposting stuff from my Patreon, but new content will be coming soon.