Version 3 (modified by 14 years ago) (diff) | ,
---|
Who's working?
This exciting project is done by gillux and mentored by elb.
What's this?
Story
Let's start with a little story. You're at home on your desktop and you have Pidgin running. Then you do a little break, and you go to your bed with your laptop, which is also running Pidgin to keep chatting with your friends. Then it's time to go to work, and you go to your office, where you keep chatting discreetly using Finch.
You have 3 clients running, and each have a separate account or handle. Wouldn't it be great if all of these clients were syncronized using the same connections, displayed you the same buddy list and chat logs? Well, that's what detachable sessions allows you to get :)
The idea
The goal of detachable libpurple sessions is to allow a user to have several running libpurple based applications simultaneously, all sharing the same the same data and connections. This involves having libpurple acting as a deamon and clients like Pidgin and Finch connecting to it. All the connected clients will access and display the buddy list, conversations, and chats. Existing ongoing conversations' history will be visible in Pidgin or Finch when they connect to the daemon.
Goals
This project will be managed in two steps. A cool thing would be to allow the clients to be running on different machines rather than on the same, but this requires to "networkify" all the UI <-> libpurple communication. Such a thing is not simple to do and that's why I will first make it to work with clients on the same machine. This is a minimal goal called minimal version, and having clients on separate machines is an extra goal called remote version. I'll do it if I get the time to. Note that the previous story is still possible with the minimal version if you run the client remotly, using ssh or an export display.
Details of the hack
Current state of this work can be followed in the im.pidgin.soc.2010.detachablepurple branch. Here is an outline of how I think to manage this project.
Drawing
+------------------+ +---------------------------+ IM servers<-->[libpurple] Daemon |<--DBus-->/ libpurple in \ | +------------------+ \detachable mode/ UI Client | +---------------------------+
For the minimal version
- Deamon wrapper Create a deamon program that basically runs libpurple which activates the configured accounts, connect to servers… This daemon also listens for incoming clients connexions.
- Detached mode Current standalone mode of clients is kept as a default. Add an option in them to run in detachable mode. The aim is to have to change the libpurple API (and hence the clients) as less as we can. Ideally, they would only have to tell libpurple they want to use the detached mode, and then use it as usual. And all these libpurple calls and events are transparently routed from/to the daemon.
- Attaching and detaching Modify the daemon to handle the attaching of a client. It means sending to the client all it needs to be in the current state of the daemon. This includes things like active accounts, buddy list and chat logs. Detaching is much easier but has to be handled aswell.
- Clients syncronisation Modify the daemon's libpurple to get a full synchronisation of events coming in and out of all the clients. For example, one client call would appears as an event for the others clients.
For the remote version
Identify then adapt each part of libpurple which aren't remote-friendly, such as audio and video streams or file transfers. For instance in the latter case, files must be transfered to/from the daemon while it sends/receives them.
Communication
DBus will be used to make the daemon<->UI client communication. I needed something that support bidirectionnal calls and over multiple peers. For remote communications there is a TCP layer implemented. However there are some drawbacks in this TCP layer: the lack of authentication and encryption. I plan to overcome those using a custom tunnel as described in this drawing.