This script is a demo to show a possible use case for SWIGforEDS bindings. It uses, and re-distributes for the sake of convenience the jabber4r and jabber-rpc libraries authored by Richard Kilmer and Massimiliano Mirra.
Apart from the SWIGforEDS bindings in ruby and ruby itself, you will need WEBrick and YAML ruby libraries (they are probably already included if you installed ruby)
The script is a simple proxy that uses jabber to obtain calendars. It consists of two separate programs (although they are both executed by the same command). The first is a jabber bot that serves the calendars we specify to authorized jabber clients via jabber-rpc (which is xmlrpc over a jabber transport). It has a simple interface:
string get_calendar(string uid_calendar)
This function simply checks if the caller is authorized to get the calendar from e-d-s and dumps it in ical format.
The second program is a http-jabber bridge. It expects GET requests with the following URL form: http://localhost:2000/calendar/user@server/calendar_uid. This access will trigger a jabber client that will try to execute a jabber-rpc request "get_calendar" to user@server passing the calendar_uid part of the URL as the parameter. Upon success it will return this to the originator of the GET request wich will make it seem like an ordinary http request. This makes this part of the script compatible with different clients. For example you can point a Mozilla Calendar client to it and it should read the jabber-rpc calendar just fine.
There is really no installation procedure. You only have to remember to run it from it's own directory and to have the SWIG ruby bindings installed.
To make it work well you first have to condigure ir properly. The first step is to set user and password for our jabber account (this will be stored under ~/.edsbotrc):
$ ruby calendar-share.rb -u firstname.lastname@example.org -p
This will prompt for a password and store it. And that's it. You can now start it with:
$ ruby calendar-share.rb start
or stop it with:
$ ruby calendar-share.rb stop
Pointing any webcal capable client to a URL of the above form will give us the resulting calendar, provided that:
- The remote user is currently running calendar-share.
- The remote user has granted us access to the calendar.
How to share a local calendar
If we want we can share our evo calendar via jabber. To do so we must first see what calendar are available for sharing on our computer:
$ ruby calendar-share.rb -L
Thi will return a list of available calendars and their corresponding uid
Next we have to specify what users have access (as for now read access is the only meaningful thing) and what kind of access they are granted with. This is done with
$ ruby calendar-share.rb -a email@example.com/edsbotcli,calendaruid,read
Note that we have to specify the resource (edsbotcli by default) of the jabber client we want to grant acess. This will probably change in the future. The "-a" stands for allow and is an alias for "--allow". We can now make sure we have given correct access with:
$ ruby calendar-share.rb -l
The above will list our shared calendars together with the users and their permissions. Revoking permissions is straightforward enough:
$ ruby calendar-share.rb -d firstname.lastname@example.org/edsbotcli,calendaruid,read
The "-d" stands for deny wich can also be specified as "--deny".
This code is under the GPL license. See LICENSE.TXT in the distributed package for more details.
- Bug fixes and testing
- Allow to specify aliases instead of calendar uid in the URL
- Allow to specify user JID's without resources when granting access
- Check for correct functioning of configure
- Add many more autodiscovery stuff
- Better cli UI
- Add GUI
- More random enhancements
In no particular order (if you feel you ought to be in the list mail me) :
- Richard Kilmer (author of the jabber4r library)
- Massimiliano Mirra (author of the jabber-rpc library)
- Tom Copeland
- Hackers at #evolution
- E-D-S for developers: http://www.gnome.org/projects/evolution/developer.shtml
- SWIG homepage: http://www.swig.org
- SWIGForEDS wiki page: http://www.go-evolution.org/SWIGforEDS
- Jabber: http://www.jabber.org
- JabberRPC specification: http://www.jabber.org/jeps/jep-0009.html
- Jabber4r: http://jabber4r.rubyforge.org/
- Jabber-rpc: http://jabber-rpc.rubyforge.org/wiki/wiki.pl