Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

What is libpurple?

libpurple is intended to be the core of an IM program. When using libpurple, you'll basically be writing a UI for this core chunk of code. Pidgin is a GTK+ frontend to libpurple, Finch is an ncurses frontend, and Adium is a Cocoa frontend.

Who uses libpurple?

  • Adium - A user-friendly graphical IM program for OS X.
  • Finch - A text-based IM program that works well in Linux and other Unixes.
  • Instantbird - A graphical IM program based on Mozilla's XUL framework.
  • Meebo - (Discontinued.) Between 2006 and 2012, Meebo provided a web-based instant messaging application that allowed users to log in with their AIM, MSN, Yahoo!, XMPP, etc. accounts. This functionality was powered by libpurple running on Meebo's servers. Meebo also powered IM functionality on several social networks via "The Meebo Bar." The functionality was based on XMPP and used libpurple running on Meebo's servers.
  • Palm - Maybe used in the messenger on the Palm Pre?
  • Pidgin - A user-friendly graphical IM program for Windows, Linux and other Unixes.
  • Spectrum - Open source XMPP transport/gateway.
  • Telepathy-Haze - A connection manager for the Telepathy IM framework.

How does it work?

You write a program in C or C++ that provides all the fancy windows and dialogs and anything that the user interacts with. Your program uses our libpurple library to connect to the IM networks, manage accounts and preferences, and lots of other helpful little things.

Your program registers a bunch of callback functions, called "UI ops," with libpurple. This is done by populating the appropriate uiops structures (eg. PurpleAccountUiOps, PurpleBlistUiOps, etc.) and making them available to the libpurple core (by calling purple_account_set_ui_ops, purple_blist_set_ui_ops, etc.). These ui ops are triggered by specific events. For example, the buddylist ui ops are used to update your buddylist window when a new buddy is added, or if a buddy goes away, or becomes idle, etc. The same thing happens for conversations, logging etc.

While the uiops are sufficient for most of the ui operations, it's likely that you will want to use various libpurple signals, as well.

Can you give me some details?

Your application will first initialize the core (purple_core_init), add plugin-search paths, load the saved plugins, prefs etc. Your best bet is to check out a copy of the source code and look at finch/libfinch.c:init_libpurple().

Is it threaded?

libpurple is not threadsafe. It should only be accessed by one thread ever (that is, do not attempt to use synchronization or locks to access it from multiple threads). Plugins can use multiple threads, but they must always call libpurple functions and callbacks on the thread on which they were initialized (typically the main thread of the program).

libpurple's run loop access occurs through eventloop.c; the UI must implement the UI Ops defined there and register them in order to watch sockets for new data and call timeout functions after a specified delay. For example, Pidgin uses the glib run loop, and Adium uses the Cocoa event run loop.

Where to get it?

You can find libpurple's source in Pidgin's source package.

Last modified 9 years ago Last modified on Mar 15, 2015, 6:51:14 AM
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!