diff options
| -rw-r--r-- | libdino/src/service/avatar_manager.vala | 87 | ||||
| -rw-r--r-- | plugins/http-files/meson.build | 1 | ||||
| -rw-r--r-- | plugins/http-files/src/file_provider.vala | 1 | ||||
| -rw-r--r-- | plugins/ice/meson.build | 2 | ||||
| -rw-r--r-- | plugins/notification-sound/meson.build | 1 | ||||
| -rw-r--r-- | xmpp-vala/meson.build | 2 | ||||
| -rw-r--r-- | xmpp-vala/src/module/xep/pixbuf_storage.vala | 9 |
7 files changed, 1 insertions, 102 deletions
diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala index 192d5c9d..927b108d 100644 --- a/libdino/src/service/avatar_manager.vala +++ b/libdino/src/service/avatar_manager.vala @@ -24,8 +24,6 @@ public class AvatarManager : StreamInteractionModule, Object { private string folder = null; 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 HashMap<string, Pixbuf> cached_pixbuf = new HashMap<string, Pixbuf>(); - private HashMap<string, Gee.List<SourceFuncWrapper>> pending_pixbuf = new HashMap<string, Gee.List<SourceFuncWrapper>>(); private HashSet<string> pending_fetch = new HashSet<string>(); private const int MAX_PIXEL = 192; @@ -104,72 +102,10 @@ public class AvatarManager : StreamInteractionModule, Object { } } - [Version (deprecated = true)] - public bool has_avatar_cached(Account account, Jid jid) { - string? hash = get_avatar_hash(account, jid); - return hash != null && cached_pixbuf.has_key(hash); - } - public bool has_avatar(Account account, Jid jid) { return get_avatar_hash(account, jid) != null; } - [Version (deprecated = true)] - public Pixbuf? get_cached_avatar(Account account, Jid jid_) { - string? hash = get_avatar_hash(account, jid_); - if (hash == null) return null; - if (cached_pixbuf.has_key(hash)) return cached_pixbuf[hash]; - return null; - } - - [Version (deprecated = true)] - public async Pixbuf? get_avatar(Account account, Jid jid_) { - Jid jid = jid_; - if (!stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid_, account)) { - jid = jid_.bare_jid; - } - - int source = -1; - string? hash = null; - if (user_avatars.has_key(jid)) { - hash = user_avatars[jid]; - source = 1; - } else if (vcard_avatars.has_key(jid)) { - hash = vcard_avatars[jid]; - source = 2; - } - - if (hash == null) return null; - - if (cached_pixbuf.has_key(hash)) { - return cached_pixbuf[hash]; - } - - XmppStream? stream = stream_interactor.get_stream(account); - if (stream == null || !stream.negotiation_complete) return null; - - if (pending_pixbuf.has_key(hash)) { - pending_pixbuf[hash].add(new SourceFuncWrapper(get_avatar.callback)); - yield; - return cached_pixbuf[hash]; - } - - pending_pixbuf[hash] = new ArrayList<SourceFuncWrapper>(); - Pixbuf? image = yield get_image(hash); - if (image != null) { - cached_pixbuf[hash] = image; - } else { - if (yield fetch_and_store(stream, account, jid, source, hash)) { - image = yield get_image(hash); - } - cached_pixbuf[hash] = image; - } - foreach (SourceFuncWrapper sfw in pending_pixbuf[hash]) { - sfw.sfun(); - } - return image; - } - public void publish(Account account, string file) { try { Pixbuf pixbuf = new Pixbuf.from_file(file); @@ -329,29 +265,6 @@ public class AvatarManager : StreamInteractionModule, Object { File file = File.new_for_path(Path.build_filename(folder, id)); return file.query_exists(); } - - public async Pixbuf? get_image(string id) { - try { - File file = File.new_for_path(Path.build_filename(folder, id)); - FileInputStream stream = yield file.read_async(Priority.LOW); - - uint8 fbuf[1024]; - size_t size; - - Checksum checksum = new Checksum (ChecksumType.SHA1); - while ((size = yield stream.read_async(fbuf, Priority.LOW)) > 0) { - checksum.update(fbuf, size); - } - - if (checksum.get_string() != id) { - FileUtils.remove(file.get_path()); - } - stream.seek(0, SeekType.SET); - return yield new Pixbuf.from_stream_async(stream, null); - } catch (Error e) { - return null; - } - } } } diff --git a/plugins/http-files/meson.build b/plugins/http-files/meson.build index 7208b1e8..7ab97014 100644 --- a/plugins/http-files/meson.build +++ b/plugins/http-files/meson.build @@ -3,7 +3,6 @@ dependencies = [ dep_gee, dep_glib, dep_gmodule, - dep_gtk4, dep_libsoup, dep_qlite, dep_xmpp_vala, diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index 420e041d..3a6c9e49 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -1,5 +1,4 @@ using Gee; -using Gtk; using Dino.Entities; using Xmpp; diff --git a/plugins/ice/meson.build b/plugins/ice/meson.build index 0f51c1ef..8743a48c 100644 --- a/plugins/ice/meson.build +++ b/plugins/ice/meson.build @@ -1,8 +1,8 @@ dependencies = [ dep_crypto_vala, dep_dino, - dep_gdk_pixbuf, dep_gee, + dep_gio, dep_glib, dep_gmodule, dep_gnutls, diff --git a/plugins/notification-sound/meson.build b/plugins/notification-sound/meson.build index 1ac44af8..e8b56c66 100644 --- a/plugins/notification-sound/meson.build +++ b/plugins/notification-sound/meson.build @@ -1,6 +1,5 @@ dependencies = [ dep_dino, - dep_gdk_pixbuf, dep_gee, dep_glib, dep_gmodule, diff --git a/xmpp-vala/meson.build b/xmpp-vala/meson.build index 0fdfb65c..16912f05 100644 --- a/xmpp-vala/meson.build +++ b/xmpp-vala/meson.build @@ -1,5 +1,4 @@ dependencies = [ - dep_gdk_pixbuf, dep_gee, dep_gio, dep_glib, @@ -130,7 +129,6 @@ sources = files( 'src/module/xep/0447_stateless_file_sharing.vala', 'src/module/xep/0461_replies.vala', 'src/module/xep/0482_call_invites.vala', - 'src/module/xep/pixbuf_storage.vala', 'src/util.vala', ) c_args = [ diff --git a/xmpp-vala/src/module/xep/pixbuf_storage.vala b/xmpp-vala/src/module/xep/pixbuf_storage.vala deleted file mode 100644 index 550290cf..00000000 --- a/xmpp-vala/src/module/xep/pixbuf_storage.vala +++ /dev/null @@ -1,9 +0,0 @@ -using Gdk; - -namespace Xmpp.Xep { -public interface PixbufStorage : Object { - public abstract void store(string id, Bytes data); - public abstract bool has_image(string id); - public abstract async Pixbuf? get_image(string id); -} -} |
