libpurple + dbus - pidgin
mark at kingant.net
Mon Apr 14 05:00:00 EDT 2008
On Sun, 13 Apr 2008 12:26:14 -0700, Anil Gupta wrote
> We have a fairly big userbase of mobile IM users and I am trying to use
> libpurple instead of other opensource projects we used before. Kudos
> for all who maintained and developed Pidgin to this stage.
> Our server uses java and I understand that libpurple can be used in
> conjunction with dbus support. Since this is a server component and
> we run on production boxes, we do not install xwin or gnome
> environs. My questions to the community
> a) Is there any work done using pidgin, dbus and java before?
Not to my knowledge, but it's certainly possible. It looks like Java is able
to access dbus: http://dbus.freedesktop.org/doc/dbus-java/
> b) Can I use dbus with only libpurple without pidgin ui? I used
> --disable-gtkui to skip pidgin as I was interested only in
> libpurple. But I wasnt sure how pidgin can be used for events
> generation. The howto explains that pidgin when loading uses the
> dbus address to listen and send events.
Yes, you should be able to use dbus with only libpurple without pidgin ui. I
know you can access a lot of libpurple's functionality using dbus, but I have
doubts that you'll be able to access everything.
It might help to think of libpurple as the core of an instant messaging
program rather than as a library with functions that you call. The programs
"main" method is a part of the ui (either Pidgin or Finch), but libpurple is
responsible for saving your preferences and accounts and what not. It is not
possible to use libpurple standalone because there is no "main" method in
So you would need to at least write a "ui" to bootstrap the libpurple process.
See libpurple/example/nullclient.c for a very basic example. But using Java
and dbus to write the user interface code for libpurple seems awkward to me.
Why not just use C?
> c) How scalable in pidgin? We have over 15k users who would like to get
> connected. We do not mind scaling by adding boxes but does pidgin support
> scaling vertically? Any tips on this would be appreciated.
> d) I hear that pidgin is a single thread approach for the main. What
> happens if the thread dies? Is there a recovery mechanism? Any
> scripts to restart pidgin to the previous state if it disconnects
> with be handy.
Hmm, why would the thread die? That seems akin to a single-threaded process
crashing (ie something that should not happen). No, there is no recovery
mechanism short of restarting Pidgin and reconnecting. Pidgin should connect
automatically when you start it, and accounts should return to their previous
state (assuming Pidgin is able to write the previous state to $HOME/.purple/*.xml)
> d) Any scalability tips in using dbus?
I don't have very much experience with dbus, sorry.
> e) Can I add accounts on fly using dbus?
I believe that is possible, yes.
> f) We used RMI to run different plugins (especially yahoo and aim)
> on other boxes as one culprit will not get the entire server down.
> It was also important for load distribution. Is there any similar
> work on this?
Not to my knowledge, no.
> g) For load distrbution, I think I should be able to use multiple instances
> of pidgin tied to different dbus addresses and let the main server manage
> the distribution of connection to various pidgin instances. Can multiple
> instances of pidgin run on the same box? Is the approach correct?
That sounds like it would work. Yes, multiple instances of Pidgin can run on
the same box. That approach seems reasonable to me.
More information about the Devel