namespace Skype { [DBus (name = "com.Skype.API")] public interface SkypeAPI : GLib.Object { public abstract string Invoke (string command) throws IOError; } [DBus (name = "com.Skype.API.Client")] public class SkypeListener : GLib.Object { public void Notify (string command) { this.notified(command); } [DBus (visible = false)] public signal void notified (string command); } public class DBusWrapper : GLib.Object { SkypeListener listener; SkypeAPI proxy; public signal void connected (); public signal void disconnected (); public signal void notified (string command); public string? send (string command) { try { return this.proxy.Invoke(command); } catch (IOError e) { return null; } } public DBusWrapper () { this.listener = new SkypeListener (); this.listener.notified.connect((s) => this.notified(s)); try { Bus.get_sync (BusType.SESSION).register_object ("/com/Skype/Client", this.listener); Bus.watch_name (BusType.SESSION, "com.Skype.API", BusNameWatcherFlags.NONE, (conn, name, owner) => { try { this.proxy = Bus.get_proxy_sync(BusType.SESSION, name, "/com/Skype"); } catch (IOError e) { } this.connected(); }, (conn, name) => { this.proxy = null; this.disconnected(); }); } catch (IOError e) { } } } }