From dd9f395c8a0e956d77b7862abf0ccccc9e4d7166 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Tue, 6 Jun 2017 20:21:01 +0200 Subject: [PATCH] device: keep track of capabilities when saving/loading from cache --- src/mconnect/device.vala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mconnect/device.vala b/src/mconnect/device.vala index b0d2341..918c579 100644 --- a/src/mconnect/device.vala +++ b/src/mconnect/device.vala @@ -81,8 +81,10 @@ class Device : Object { this.device_type = disc.device_type; this.protocol_version = disc.protocol_version; this.tcp_port = disc.tcp_port; - this.outgoing_capabilities = new ArrayList.wrap(disc.outgoing_capabilities); - this.incoming_capabilities = new ArrayList.wrap(disc.incoming_capabilities); + this.outgoing_capabilities = new ArrayList.wrap( + disc.outgoing_capabilities); + this.incoming_capabilities = new ArrayList.wrap( + disc.incoming_capabilities); debug("new device: %s", this.to_string()); } @@ -109,6 +111,12 @@ class Device : Object { dev.allowed = cache.get_boolean(name, "allowed"); dev.is_paired = cache.get_boolean(name, "paired"); dev.public_key = cache.get_string(name, "public_key"); + dev.outgoing_capabilities = new ArrayList.wrap( + cache.get_string_list(name, + "outgoing_capabilities")); + dev.incoming_capabilities = new ArrayList.wrap( + cache.get_string_list(name, + "incoming_capabilities")); var host = new InetAddress.from_string(last_ip_str); if (host == null) { @@ -157,6 +165,10 @@ class Device : Object { cache.set_boolean(name, "allowed", this.allowed); cache.set_boolean(name, "paired", this.is_paired); cache.set_string(name, "public_key", this.public_key); + cache.set_string_list(name, "outgoing_capabilities", + array_list_to_list(this.outgoing_capabilities)); + cache.set_string_list(name, "incoming_capabilities", + array_list_to_list(this.incoming_capabilities)); } private async void greet() {