Browse Source

share: add support for sharing URLs

bboozzoo/self-announce
Maciek Borzecki 7 years ago
parent
commit
3412ea716f
1 changed files with 21 additions and 15 deletions
  1. +21
    -15
      src/mconnect/share.vala

+ 21
- 15
src/mconnect/share.vala View File

@ -66,21 +66,27 @@ class ShareHandler : Object, PacketHandlerInterface {
return;
}
if (pkt.payload == null) {
warning("missing payload info");
return;
}
string name = pkt.body.get_string_member("filename");
debug("file: %s size: %s", name, format_size(pkt.payload.size));
var t = new DownloadTransfer(
dev,
new InetSocketAddress(dev.host,
(uint16) pkt.payload.port),
pkt.payload.size,
make_downloads_path(name));
if (pkt.body.has_member("filename")) {
if (pkt.payload == null) {
warning("missing payload info");
return;
}
t.start_async.begin();
string name = pkt.body.get_string_member("filename");
debug("file: %s size: %s", name, format_size(pkt.payload.size));
var t = new DownloadTransfer(
dev,
new InetSocketAddress(dev.host,
(uint16) pkt.payload.port),
pkt.payload.size,
make_downloads_path(name));
t.start_async.begin();
} else if (pkt.body.has_member("url")) {
var url = pkt.body.get_string_member("url");
debug("got URL: %s, launching...", url);
AppInfo.launch_default_for_uri(url, null);
}
}
}

Loading…
Cancel
Save