ORG.FREEDESKTOP.IM (OFI) interface description by Marcin Krzyzanowski Igor Popik HomePage: http://ofi.hakore.com INTRODUCTION This is a proposition of communication interface between IM application and other applications. The main goal of this interface is to give opportunity to share informations about IM contacts wherever information about such contact is stored. With this interface various applications may handle IM protocols based only on installed and registered IM applications. As a platform for communication D-BUS message bus is used, which developed as a part of freedesktop.org project. This is still unstable tool with unresolved problems but seems to be a good choice for desktop solutions in future. D-BUS has easy progremming interface and a lot of bindings with various languages and evironments used with desktop applications. BASE CONCEPT In situation when applications (source) wants to gather information about contacts from registered IM application (destination) it needs to find apriopriate service. Registered services names start with "org.freedesktop.im" eg. "org.freedekstop.im.Gossip". Source application can search for a specific service with using wildcards eg. "org.freedesktop.im.*" receiving complete list of registered IM services. This list must processed until source application finds apriopriate service. Processing is based on invoking methods described below at object "/org/freedesktop/im". The path to openChat method may be "org.freedesktop.org.OpenChat" with interface "org.freedesktop.im.Gossip" for example. This give unified interface for different objects. Methods should return boolean value FALSE in a case of failure, when invocation of method cannot be processed for some reason, or other values defined below in case of success. Each application should install .service file to provide information about possibe usage if necessary by other applications (it needs our patch for dbus-0.22). POSSIBLE SOLUTION I can imagine using this solution connected to various desktop application giving comfortable and efficient tools using only D-BUS as communication interface without any other dependancies of unecessary libraries. PROOF OF CONCEPT We developed package of software and patches to various applications giving proof of this concept. - With our packacge there is possibility to use URL for IM services with GNOME web browser. Anytime user clicks on it, IM application is launched and give possibility to start chatting with choosen contact - easy as clicking. You can also choose you favorite IM application using ofi-properties-manager tool (unfortunately is does not exist yet). CODE We provide header file OFI.h and dbus-im-*-wrapper with implemented OFI interface. Anyone is authorized to use parts of those files in applications to simplify implementation process. It's recommended to copy those files or parts of it into you application rather than link against libofi.so library, however if it is not a problem linking again another one library you get benefits using our updated implementation. libofi library provides client side functions to applications, like: ofi_getServices(DBusConnection *bus) giving you suitable table with names of services you can use. Right now it's enought, everything else can be done by you application. AND THE BEST IS The best is that : - using OFI interface you need only D-BUS working, everything else you can easly implement in you application with a few lines. - It's as simple as possible. - It took me 30 minutes to implement it with Gossip and I assume you don't need much more to implement basic functionality in you application. - You don't have to install additional library and link you application against it. - Is as multiplatform as D-BUS interface is. - You _can_ but you don't have to use libofi library. SAMPLE IMPLEMENTATION Because we are involved in GNU Gadu Project http://www.gnugadu.org/ you can assume that DBUS plugin for GNU Gadu will be propably the first implementation of client with this interface. However we are working on patches and extensions to other applications like Gossip, Kopete, Gaim, Evolution, Mozilla, Firefox, GConf, etc... Currently it is possible to handle im protocols with browsers like Mozilla, Firefox and GNOME Web Browsers like Epiphany. To handle protocols in pure mozilla outside GNOME you should use provided ofi.xpi extension, which you don't need if you have GNOME installed with GConf in you system. Small programm called "ofi-openchat-wrapper" is used to communicate via D-BUS and IM applications. - Protocol handlers: ------------------------- Protocol | URI ------------------------- Tlen.pl | tlen: Gadu-Gadu | gg: Jabber | xmpp: AIM | aim: ICQ | icq: Yahoo | yim: Groupwise | nim: MSN | msn: ##### interface org.freedesktop.im ##### [org.freedesktop.im.getProtocols()] RETURN: DBUS_TYPE_STRING's with supported protocols list example: gg: jabber: icq: OR (DBUS_TYPE_BOOLEAN result) = FALSE [org.freedesktop.im.getPresence( contactURI )] example: xmpp:krzak@jabberpl.org RETURN: (DBUS_TYPE_BOOLEAN success = TRUE, DBUS_TYPE_STRING ofiPresence, DBUS_TYPE_STRING description, DBUS_TYPE_STRING icon_path) OR (DBUS_TYPE_BOOLEAN result) = FALSE Standarized ofiPresence strings: "Unknown","Online","Away","Offline","Hidden" *description - additional string with this status, may be empty string "" [not NULL] *icon_path - path to icon of this presence (optional, may be empty string "" [not NULL]) - here, it can be more than one chunk of this tripe send, when every next chunk is to describe more detailed presence. ex: "Online","I'm online","/image/online.png","Hidden","","" which means : Online but hidden with description "I'm online" and image /image/online.png [org.freedesktop.im.openChat( contactURI )] RETURN: (DBUS_TYPE_BOOLEAN result)