Browse Source

device: keep track of capabilities when saving/loading from cache

bboozzoo/pairing-fixes
Maciek Borzecki 8 years ago
parent
commit
dd9f395c8a
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      src/mconnect/device.vala

+ 14
- 2
src/mconnect/device.vala View File

@ -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<string>.wrap(disc.outgoing_capabilities);
this.incoming_capabilities = new ArrayList<string>.wrap(disc.incoming_capabilities);
this.outgoing_capabilities = new ArrayList<string>.wrap(
disc.outgoing_capabilities);
this.incoming_capabilities = new ArrayList<string>.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<string>.wrap(
cache.get_string_list(name,
"outgoing_capabilities"));
dev.incoming_capabilities = new ArrayList<string>.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() {


Loading…
Cancel
Save