Add MSRPC client and fix server code
[moonshot-ui.git] / src / msrpc-client.vala
1 using Rpc;
2 using MoonshotRpcInterface;
3
4 void main () {
5     Rpc.client_bind (ref MoonshotRpcInterface.binding_handle, "/org/janet/Moonshot");
6
7     int pong = ping ("Hello from Vala");
8     stdout.printf ("%d\n", pong);
9
10     Identity *id = null;
11     Rpc.AsyncCall call = Rpc.AsyncCall();
12     get_identity (call, "identity", "username", "pass", &id);
13
14     call.complete ();
15
16     if (id == null)
17         /* FIXME: this is happening when moonshot crashes instead
18          * of returning a result - surely RpcAsyncCompleteCall should
19          * *tell* us that the call failed !
20          */
21         error ("Call failed but error was not raised\n");
22     else
23         stdout.printf ("%s %s %s\n", id->identity, id->password, id->service);
24
25     Rpc.client_unbind (ref MoonshotRpcInterface.binding_handle);
26 }
27