msgpack-rpc: Always use arrays when sending events or calls

This is required by the msgpack-RPC specification. Also, the
send_call/send_event functions were refactored to accept a variable number of
arguments
This commit is contained in:
Thiago de Arruda
2014-08-28 17:01:58 -03:00
parent aa23d2f835
commit a66d2d1538
6 changed files with 72 additions and 44 deletions

View File

@@ -5232,7 +5232,8 @@ static void get_clipboard(int name)
struct yankreg *reg = &y_regs[CLIP_REGISTER];
free_register(reg);
Object result = provider_call("clipboard_get", NIL);
Array args = ARRAY_DICT_INIT;
Object result = provider_call("clipboard_get", args);
if (result.type != kObjectTypeArray) {
goto err;
@@ -5278,12 +5279,15 @@ static void set_clipboard(int name)
copy_register(reg, &y_regs[0]);
}
Array lines = {0, 0, 0};
Array lines = ARRAY_DICT_INIT;
for (int i = 0; i < reg->y_size; i++) {
ADD(lines, STRING_OBJ(cstr_to_string((char *)reg->y_array[i])));
}
Object result = provider_call("clipboard_set", ARRAY_OBJ(lines));
Array args = ARRAY_DICT_INIT;
ADD(args, ARRAY_OBJ(lines));
Object result = provider_call("clipboard_set", args);
msgpack_rpc_free_object(result);
}