diff options
author | Marvin W <git@larma.de> | 2017-03-12 21:20:56 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-12 21:24:47 +0100 |
commit | bd1f116b3a57b803e2be4dc92474937f1f824fe4 (patch) | |
tree | 908c8eb00b762c10cfa920ca89de9d834b50bc0a | |
parent | 13cef27d46bb8c3c6a274983fc8569752fb69b5d (diff) | |
download | dino-bd1f116b3a57b803e2be4dc92474937f1f824fe4.tar.gz dino-bd1f116b3a57b803e2be4dc92474937f1f824fe4.zip |
Fix delegate copying issue
-rw-r--r-- | plugins/omemo/src/stream_module.vala | 9 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0060_pubsub.vala | 7 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0084_user_avatars.vala | 5 |
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/omemo/src/stream_module.vala b/plugins/omemo/src/stream_module.vala index 546da102..86a9225d 100644 --- a/plugins/omemo/src/stream_module.vala +++ b/plugins/omemo/src/stream_module.vala @@ -109,18 +109,19 @@ public class StreamModule : XmppStreamModule { } public override void attach(XmppStream stream) { - if (Plugin.context == null) return; Message.Module.require(stream); Pubsub.Module.require(stream); - stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(on_pre_received_message); - stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, on_devicelist, this); + if (Plugin.context == null) return; + this.store = Plugin.context.create_store(); store_created(store); + stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(on_pre_received_message); + stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, (stream, jid, id, node, obj) => (obj as StreamModule).on_devicelist(stream, jid, id, node), this); } private void on_pre_received_message(XmppStream stream, Message.Stanza message) { StanzaNode? encrypted = message.stanza.get_subnode("encrypted", NS_URI); - if (encrypted == null) return; + if (encrypted == null || MessageFlag.get_flag(message) != null) return; MessageFlag flag = new MessageFlag(); message.add_flag(flag); StanzaNode? header = encrypted.get_subnode("header"); diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala index 2c06843e..9c2f4ebf 100644 --- a/xmpp-vala/src/module/xep/0060_pubsub.vala +++ b/xmpp-vala/src/module/xep/0060_pubsub.vala @@ -60,7 +60,7 @@ namespace Xmpp.Xep.Pubsub { string node = items_node.get_attribute("node", NS_URI_EVENT); string id = item_node.get_attribute("id", NS_URI_EVENT); if (event_listeners.has_key(node)) { - event_listeners[node].on_result(stream, message.from, id, item_node.sub_nodes[0]); + event_listeners[node].on_result(stream, message.from, id, item_node.sub_nodes[0], event_listeners[node].reference); } } @@ -76,9 +76,10 @@ namespace Xmpp.Xep.Pubsub { } public class EventListenerDelegate { - public delegate void ResultFunc(XmppStream stream, string jid, string id, StanzaNode node); + [CCode (has_target = false)] + public delegate void ResultFunc(XmppStream stream, string jid, string id, StanzaNode node, Object? object); public ResultFunc on_result { get; private set; } - private Object reference; + public Object? reference { get; private set; } public EventListenerDelegate(ResultFunc on_result, Object? reference = null) { this.on_result = on_result; diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala index a98d8538..248620fa 100644 --- a/xmpp-vala/src/module/xep/0084_user_avatars.vala +++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala @@ -36,13 +36,14 @@ namespace Xmpp.Xep.UserAvatars { public override void attach(XmppStream stream) { Pubsub.Module.require(stream); - stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_event_result, this); + stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_event_result, storage); } public override void detach(XmppStream stream) { } - public void on_event_result(XmppStream stream, string jid, string id, StanzaNode node) { + public static void on_event_result(XmppStream stream, string jid, string id, StanzaNode node, Object? obj) { + PixbufStorage? storage = obj as PixbufStorage; StanzaNode info_node = node.get_subnode("info", NS_URI_METADATA); if (info_node.get_attribute("type") != "image/png") return; if (storage.has_image(id)) { |