Pidgin's Architecture
Tags: architecture, opensource, pidgin, repost
Published: 2023-05-09 14:00:00

> This article was originally posted on [Patreon](https://www.patreon.com/posts/pidgins-77306473) 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](https://en.wikipedia.org/wiki/Adium), [bitlbee](https://en.wikipedia.org/wiki/BitlBee), [spectrum2](https://spectrum.im/), [telepathy-haze](https://telepathy.freedesktop.org/components/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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ven98btz5wtpj6irjcq6.png)

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](https://en.wikipedia.org/wiki/Cocoa_(API)) (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](https://keep.imfreedom.org/libgnt/libgnt) (which we also provide) which is built on top of [ncurses](https://en.wikipedia.org/wiki/Ncurses). Pidgin is built on top of [GTK](https://www.gtk.org/) 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!