aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0084_user_avatars.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-06-13 18:14:59 +0200
committerfiaxh <git@mx.ax.lt>2017-06-13 20:12:40 +0200
commit7bbbb738fdb233f4ad91ffdd7d9247b28849d715 (patch)
tree649ac26e3feef6bae614442a7f3d6ee1057336e0 /xmpp-vala/src/module/xep/0084_user_avatars.vala
parentdabc2a8b1d2a7bf2019e5f913c736d80f11ceb53 (diff)
downloaddino-7bbbb738fdb233f4ad91ffdd7d9247b28849d715.tar.gz
dino-7bbbb738fdb233f4ad91ffdd7d9247b28849d715.zip
Get rid of manual storage objects for delegates
Diffstat (limited to 'xmpp-vala/src/module/xep/0084_user_avatars.vala')
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala10
1 files changed, 4 insertions, 6 deletions
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index f9bf057f..3648a88b 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -35,20 +35,19 @@ 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, storage);
+ stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_pupsub_event);
}
public override void detach(XmppStream stream) { }
- public static void on_event_result(XmppStream stream, string jid, string id, StanzaNode node, Object? obj) {
- PixbufStorage? storage = obj as PixbufStorage;
+ public void on_pupsub_event(XmppStream stream, string jid, string id, StanzaNode? node) {
StanzaNode? info_node = node.get_subnode("info", NS_URI_METADATA);
if (info_node == null || info_node.get_attribute("type") != "image/png") return;
if (storage.has_image(id)) {
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
} else {
- stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, NS_URI_DATA, on_pubsub_data_response, storage);
+ stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, NS_URI_DATA, on_pubsub_data_response);
}
}
@@ -59,9 +58,8 @@ namespace Xmpp.Xep.UserAvatars {
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private static void on_pubsub_data_response(XmppStream stream, string jid, string? id, StanzaNode? node, Object? o) {
+ private void on_pubsub_data_response(XmppStream stream, string jid, string? id, StanzaNode? node) {
if (node == null) return;
- PixbufStorage storage = o as PixbufStorage;
storage.store(id, Base64.decode(node.get_string_content()));
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
}