Opened at 2015-04-12T18:57:00Z
#1203 new enhancement
RPC interface to write protocol plugins in a different language
Reported by: | wilmer | Owned by: | wilmer |
---|---|---|---|
Priority: | wishlist | Milestone: | |
Component: | BitlBee | Version: | devel |
Keywords: | rpc python | Cc: | |
IRC client+version: | Client-independent | Operating System: | Public server |
OS version/distro: |
Description
I'm working on this and have a bunch of code written already by now, but let's file a "tracking bug".
Writing IM plugins in C is not all that fun. The idea came up sometimes to add Python bindings, but integrating Python code into the BitlBee event loop is not all that easy either.
So instead, write an RPC layer that lets BitlBee talk, using JSON-RPC (version 1.0, which I've chosen because libs are available for tons of languages, and more importantly because it supports bidirectional calls on a channel which is essential here), to external IM plugins.
I have just under 1000 lines of C code written by now and might have enough written to let someone write an IM plugin, but that now needs to be tried. :-)
At the same time I'm writing a "framework" (or well, I intend to, the 100-line .py file I have now does not deserve that name for sure) for writing such plugins. The same could be done in other languages should someone want to do this.
The API should be mostly a copy of BitlBee's. Most imcb* calls from nogaim.h and bee.h are available from the IM plugin, and the IM plugin can export all functions that a normal plugin can.
One thing did occur to me: This is not going to be all that easy to maintain. The RPC server needs to be running before BitlBee starts, which means more hassle at startup time. Maybe something better should be invented here (possibly just replace Unix domain sockets with a socket connected to a subprocess spawned by BitlBee itself).