parent
0102abeec1
commit
d82194af58
|
@ -42,6 +42,9 @@ public interface Dino.Application : GLib.Application {
|
||||||
stream_interactor.connection_manager.log_options = print_xmpp;
|
stream_interactor.connection_manager.log_options = print_xmpp;
|
||||||
restore();
|
restore();
|
||||||
});
|
});
|
||||||
|
shutdown.connect(() => {
|
||||||
|
stream_interactor.connection_manager.make_offline_all();
|
||||||
|
});
|
||||||
open.connect((files, hint) => {
|
open.connect((files, hint) => {
|
||||||
if (files.length != 1) {
|
if (files.length != 1) {
|
||||||
warning("Can't handle more than one URI at once.");
|
warning("Can't handle more than one URI at once.");
|
||||||
|
|
|
@ -130,14 +130,29 @@ public class ConnectionManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect(Account account) {
|
public void make_offline_all() {
|
||||||
|
foreach (Account account in connection_todo) {
|
||||||
|
make_offline(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void make_offline(Account account) {
|
||||||
|
Xmpp.Presence.Stanza presence = new Xmpp.Presence.Stanza();
|
||||||
|
presence.type_ = Xmpp.Presence.Stanza.TYPE_UNAVAILABLE;
|
||||||
change_connection_state(account, ConnectionState.DISCONNECTED);
|
change_connection_state(account, ConnectionState.DISCONNECTED);
|
||||||
connection_todo.remove(account);
|
try {
|
||||||
if (connections.has_key(account)) {
|
connections[account].stream.get_module(Presence.Module.IDENTITY).send_presence(connections[account].stream, presence);
|
||||||
|
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disconnect(Account account) {
|
||||||
|
make_offline(account);
|
||||||
try {
|
try {
|
||||||
connections[account].stream.disconnect();
|
connections[account].stream.disconnect();
|
||||||
|
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
|
||||||
|
connection_todo.remove(account);
|
||||||
|
if (connections.has_key(account)) {
|
||||||
connections.unset(account);
|
connections.unset(account);
|
||||||
} catch (Error e) { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class OutFileProcessor : OutgoingFileProcessor, Object {
|
||||||
uint8[] enc_content = GPGHelper.encrypt_file(uri, keys, GPG.EncryptFlags.ALWAYS_TRUST);
|
uint8[] enc_content = GPGHelper.encrypt_file(uri, keys, GPG.EncryptFlags.ALWAYS_TRUST);
|
||||||
file_transfer.input_stream = new MemoryInputStream.from_data(enc_content, GLib.free);
|
file_transfer.input_stream = new MemoryInputStream.from_data(enc_content, GLib.free);
|
||||||
file_transfer.encryption = Encryption.PGP;
|
file_transfer.encryption = Encryption.PGP;
|
||||||
file_transfer.server_file_name = file_transfer.server_file_name + ".pgp";
|
file_transfer.server_file_name = Xmpp.random_uuid() + ".pgp";
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
file_transfer.state = FileTransfer.State.FAILED;
|
file_transfer.state = FileTransfer.State.FAILED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue