aboutsummaryrefslogtreecommitdiff
path: root/plugins/openpgp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/openpgp')
-rw-r--r--plugins/openpgp/src/database.vala1
-rw-r--r--plugins/openpgp/src/encryption_list_entry.vala1
-rw-r--r--plugins/openpgp/src/manager.vala8
-rw-r--r--plugins/openpgp/src/plugin.vala2
-rw-r--r--plugins/openpgp/src/stream_flag.vala8
-rw-r--r--plugins/openpgp/src/stream_module.vala21
6 files changed, 21 insertions, 20 deletions
diff --git a/plugins/openpgp/src/database.vala b/plugins/openpgp/src/database.vala
index 0e4bf74c..52005651 100644
--- a/plugins/openpgp/src/database.vala
+++ b/plugins/openpgp/src/database.vala
@@ -1,6 +1,7 @@
using Qlite;
using Dino.Entities;
+using Xmpp;
namespace Dino.Plugins.OpenPgp {
diff --git a/plugins/openpgp/src/encryption_list_entry.vala b/plugins/openpgp/src/encryption_list_entry.vala
index d2cbd13f..7ccd9f73 100644
--- a/plugins/openpgp/src/encryption_list_entry.vala
+++ b/plugins/openpgp/src/encryption_list_entry.vala
@@ -1,6 +1,7 @@
using Gee;
using Dino.Entities;
+using Xmpp;
namespace Dino.Plugins.OpenPgp {
diff --git a/plugins/openpgp/src/manager.vala b/plugins/openpgp/src/manager.vala
index 3f0fe3dd..79e832ff 100644
--- a/plugins/openpgp/src/manager.vala
+++ b/plugins/openpgp/src/manager.vala
@@ -63,17 +63,17 @@ public class Manager : StreamInteractionModule, Object {
return gpgkeys;
}
- private void on_pre_message_received(Entities.Message message, Xmpp.Message.Stanza message_stanza, Conversation conversation) {
+ private void on_pre_message_received(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
if (MessageFlag.get_flag(message_stanza) != null && MessageFlag.get_flag(message_stanza).decrypted) {
message.encryption = Encryption.PGP;
}
}
- private void check_encypt(Entities.Message message, Xmpp.Message.Stanza message_stanza, Conversation conversation) {
+ private void check_encypt(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
try {
if (message.encryption == Encryption.PGP) {
GPG.Key[] keys = get_key_fprs(conversation);
- Core.XmppStream? stream = stream_interactor.get_stream(conversation.account);
+ 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;
@@ -91,7 +91,7 @@ public class Manager : StreamInteractionModule, Object {
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Module.IDENTITY).received_jid_key_id.connect((stream, jid, key_id) => {
- on_jid_key_received(account, new Jid(jid), key_id);
+ on_jid_key_received(account, jid, key_id);
});
}
diff --git a/plugins/openpgp/src/plugin.vala b/plugins/openpgp/src/plugin.vala
index 7ec6c357..adf2ecc7 100644
--- a/plugins/openpgp/src/plugin.vala
+++ b/plugins/openpgp/src/plugin.vala
@@ -37,7 +37,7 @@ public class Plugin : Plugins.RootInterface, Object {
public void shutdown() { }
- private void on_initialize_account_modules(Account account, ArrayList<Xmpp.Core.XmppStreamModule> modules) {
+ private void on_initialize_account_modules(Account account, ArrayList<Xmpp.XmppStreamModule> modules) {
Module module = new Module(db.get_account_key(account));
this.modules[account] = module;
modules.add(module);
diff --git a/plugins/openpgp/src/stream_flag.vala b/plugins/openpgp/src/stream_flag.vala
index 165327b9..8593fa9d 100644
--- a/plugins/openpgp/src/stream_flag.vala
+++ b/plugins/openpgp/src/stream_flag.vala
@@ -1,18 +1,18 @@
using Gee;
using Xmpp;
-using Xmpp.Core;
+using Xmpp;
namespace Dino.Plugins.OpenPgp {
public class Flag : XmppStreamFlag {
public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "pgp");
- public HashMap<string, string> key_ids = new HashMap<string, string>();
+ public HashMap<Jid, string> key_ids = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
- public string? get_key_id(string jid) { return key_ids[get_bare_jid(jid)]; }
+ public string? get_key_id(Jid jid) { return key_ids[jid]; }
- public void set_key_id(string jid, string key) { key_ids[get_bare_jid(jid)] = key; }
+ public void set_key_id(Jid jid, string key) { key_ids[jid] = key; }
public override string get_ns() { return NS_URI; }
diff --git a/plugins/openpgp/src/stream_module.vala b/plugins/openpgp/src/stream_module.vala
index a2b48dd9..a8b821de 100644
--- a/plugins/openpgp/src/stream_module.vala
+++ b/plugins/openpgp/src/stream_module.vala
@@ -1,7 +1,6 @@
using GPG;
using Xmpp;
-using Xmpp.Core;
namespace Dino.Plugins.OpenPgp {
private const string NS_URI = "jabber:x";
@@ -9,9 +8,9 @@ namespace Dino.Plugins.OpenPgp {
private const string NS_URI_SIGNED = NS_URI + ":signed";
public class Module : XmppStreamModule {
- public static Core.ModuleIdentity<Module> IDENTITY = new Core.ModuleIdentity<Module>(NS_URI, "0027_current_pgp_usage");
+ public static Xmpp.ModuleIdentity<Module> IDENTITY = new Xmpp.ModuleIdentity<Module>(NS_URI, "0027_current_pgp_usage");
- public signal void received_jid_key_id(XmppStream stream, string jid, string key_id);
+ public signal void received_jid_key_id(XmppStream stream, Jid jid, string key_id);
private string? signed_status = null;
private Key? own_key = null;
@@ -33,7 +32,7 @@ namespace Dino.Plugins.OpenPgp {
}
}
- public bool encrypt(Message.Stanza message, GPG.Key[] keys) {
+ public bool encrypt(MessageStanza message, GPG.Key[] keys) {
string? enc_body = gpg_encrypt(message.body, keys);
if (enc_body != null) {
message.stanza.put_node(new StanzaNode.build("x", NS_URI_ENCRYPTED).add_self_xmlns().put_node(new StanzaNode.text(enc_body)));
@@ -46,14 +45,14 @@ namespace Dino.Plugins.OpenPgp {
public override void attach(XmppStream stream) {
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.connect(on_pre_send_presence_stanza);
- stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_decrypt_listener);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_decrypt_listener);
stream.add_flag(new Flag());
}
public override void detach(XmppStream stream) {
stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence);
stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza);
- stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_decrypt_listener);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.disconnect(received_pipeline_decrypt_listener);
}
public static void require(XmppStream stream) {
@@ -121,12 +120,12 @@ namespace Dino.Plugins.OpenPgp {
}
}
- public class MessageFlag : Message.MessageFlag {
+ public class MessageFlag : Xmpp.MessageFlag {
public const string id = "pgp";
public bool decrypted = false;
- public static MessageFlag? get_flag(Message.Stanza message) {
+ public static MessageFlag? get_flag(MessageStanza message) {
return (MessageFlag) message.get_flag(NS_URI, id);
}
@@ -134,14 +133,14 @@ namespace Dino.Plugins.OpenPgp {
public override string get_id() { return id; }
}
-public class ReceivedPipelineDecryptListener : StanzaListener<Message.Stanza> {
+public class ReceivedPipelineDecryptListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {"MODIFY_BODY"};
public override string action_group { get { return "ENCRYPT_BODY"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
string? encrypted = get_cyphertext(message);
if (encrypted != null) {
MessageFlag flag = new MessageFlag();
@@ -171,7 +170,7 @@ public class ReceivedPipelineDecryptListener : StanzaListener<Message.Stanza> {
return res;
}
- private string? get_cyphertext(Message.Stanza message) {
+ private string? get_cyphertext(MessageStanza message) {
StanzaNode? x_node = message.stanza.get_subnode("x", NS_URI_ENCRYPTED);
return x_node == null ? null : x_node.get_string_content();
}