diff options
author | Marvin W <git@larma.de> | 2017-03-12 13:19:04 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-12 14:09:32 +0100 |
commit | e8f11178ecc1a333976ba713f532fcae11931b16 (patch) | |
tree | 71ef4de63e27203780f3d5bfaa1662d97faaca16 /libdino/src/service/avatar_manager.vala | |
parent | a9ea0e9f87e71c60bc570066525d3e3634fbdcc0 (diff) | |
download | dino-e8f11178ecc1a333976ba713f532fcae11931b16.tar.gz dino-e8f11178ecc1a333976ba713f532fcae11931b16.zip |
Move storage into user directory and fix plugin search path
Diffstat (limited to 'libdino/src/service/avatar_manager.vala')
-rw-r--r-- | libdino/src/service/avatar_manager.vala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala index 69e5580e..032bd576 100644 --- a/libdino/src/service/avatar_manager.vala +++ b/libdino/src/service/avatar_manager.vala @@ -20,7 +20,7 @@ public class AvatarManager : StreamInteractionModule, Object { private Database db; private HashMap<Jid, string> user_avatars = new HashMap<Jid, string>(Jid.hash_func, Jid.equals_func); private HashMap<Jid, string> vcard_avatars = new HashMap<Jid, string>(Jid.hash_func, Jid.equals_func); - private AvatarStorage avatar_storage = new AvatarStorage("./"); // TODO ihh + private AvatarStorage avatar_storage = new AvatarStorage(get_storage_dir()); private const int MAX_PIXEL = 192; public static void start(StreamInteractor stream_interactor, Database db) { @@ -28,10 +28,20 @@ public class AvatarManager : StreamInteractionModule, Object { stream_interactor.add_module(m); } + public static string get_storage_dir() { + return Path.build_filename(Application.get_storage_dir(), "avatars"); + } + private AvatarManager(StreamInteractor stream_interactor, Database db) { this.stream_interactor = stream_interactor; this.db = db; stream_interactor.account_added.connect(on_account_added); + stream_interactor.module_manager.initialize_account_modules.connect(initialize_avatar_modules); + } + + private void initialize_avatar_modules(Account account, ArrayList<Core.XmppStreamModule> modules) { + modules.add(new Xep.UserAvatars.Module(avatar_storage)); + modules.add(new Xep.VCard.Module(avatar_storage)); } public Pixbuf? get_avatar(Account account, Jid jid) { |