The Chat Core code used by Instantbird and Thunderbird has some abstractions to deal with the differences between protocols (e.g. IRC vs. XMPP).

Protocol Interfaces

Protocols are implemented in the chat core using XPCOM (in any of the languages that supports: C++, JavaScript, etc.). For new implementations, we recommend using JavaScript. Instantbird can also use libpurple protocol plugins that are recompiled for Instantbird (it is API compatible, but not ABI compatible).

Protocols added by extensions or distributed with chat core are treated identically. They must implement the proper interfaces and be registered with the category manager in order to be found. Protocols need to implement the prplI* interfaces (this can mostly be done using jsProtoHelper). The minimum set of interfaces to implement are:

Useful Code

Example Implementations

The code for the JavaScript protocols we ship by default is here.

Example protocol add-ons

Useful Code Snippets

Using Services.core.getProtocols() to list all protocols

This lists the protocol plugins that the core service knows about. You can copy the code (as it is), paste it in the error console (linebreaks will automatically be ignored) and press "Enter" to run it.

Components.utils.import("resource:///modules/imServices.jsm");
var x = Services.core.getProtocols();
var result = "";
while (x.hasMoreElements()) {
  var y = x.getNext().QueryInterface(Components.interfaces.prplIProtocol);
  result += y.name + "\t\t" +y.id + "\n";
}
Services.console.logStringMessage(result);