aboutsummaryrefslogtreecommitdiff
path: root/plugins/openpgp/src/manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-29 15:15:28 +0100
committerfiaxh <git@mx.ax.lt>2017-10-31 15:41:45 +0100
commit0102abeec1d2055b19dccbb7edc7f06e527642b1 (patch)
tree4018e82224c19142c4a7a6eced67d9c2550b2dd8 /plugins/openpgp/src/manager.vala
parentb9df78e4494879752e9e68dcc5d54e03fffe9467 (diff)
downloaddino-0102abeec1d2055b19dccbb7edc7f06e527642b1.tar.gz
dino-0102abeec1d2055b19dccbb7edc7f06e527642b1.zip
Fix warnings
Diffstat (limited to 'plugins/openpgp/src/manager.vala')
-rw-r--r--plugins/openpgp/src/manager.vala18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/openpgp/src/manager.vala b/plugins/openpgp/src/manager.vala
index 74f6027c..3f0fe3dd 100644
--- a/plugins/openpgp/src/manager.vala
+++ b/plugins/openpgp/src/manager.vala
@@ -30,7 +30,7 @@ public class Manager : StreamInteractionModule, Object {
stream_interactor.get_module(MessageProcessor.IDENTITY).pre_message_send.connect(check_encypt);
}
- public GPG.Key[] get_key_fprs(Conversation conversation) {
+ public GPG.Key[] get_key_fprs(Conversation conversation) throws Error {
Gee.List<string> keys = new Gee.ArrayList<string>();
keys.add(db.get_account_key(conversation.account));
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
@@ -70,13 +70,17 @@ public class Manager : StreamInteractionModule, Object {
}
private void check_encypt(Entities.Message message, Xmpp.Message.Stanza message_stanza, Conversation conversation) {
- if (message.encryption == Encryption.PGP) {
- GPG.Key[] keys = get_key_fprs(conversation);
- Core.XmppStream? stream = stream_interactor.get_stream(conversation.account);
- if (stream != null) {
- bool encrypted = stream.get_module(Module.IDENTITY).encrypt(message_stanza, keys);
- if (!encrypted) message.marked = Entities.Message.Marked.WONTSEND;
+ try {
+ if (message.encryption == Encryption.PGP) {
+ GPG.Key[] keys = get_key_fprs(conversation);
+ Core.XmppStream? stream = stream_interactor.get_stream(conversation.account);
+ if (stream != null) {
+ bool encrypted = stream.get_module(Module.IDENTITY).encrypt(message_stanza, keys);
+ if (!encrypted) message.marked = Entities.Message.Marked.WONTSEND;
+ }
}
+ } catch (Error e) {
+ message.marked = Entities.Message.Marked.WONTSEND;
}
}