diff options
author | fiaxh <git@mx.ax.lt> | 2018-07-31 17:49:10 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-07-31 17:49:10 +0200 |
commit | a19f988301332680e23fd81031935eb1312d3173 (patch) | |
tree | 25457cc9a40cb71dd28f8561bf7b296e660dcbbb /libdino/src | |
parent | 2e5977df966779c0ae7247b8ad5343425bea1690 (diff) | |
download | dino-a19f988301332680e23fd81031935eb1312d3173.tar.gz dino-a19f988301332680e23fd81031935eb1312d3173.zip |
Support MUC avatars
Diffstat (limited to 'libdino/src')
-rw-r--r-- | libdino/src/service/muc_manager.vala | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index cd4ff852..e9ad1b81 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -98,7 +98,14 @@ public class MucManager : StreamInteractionModule, Object { public Gee.List<Jid>? get_occupants(Jid jid, Account account) { if (is_groupchat(jid, account)) { - return stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(jid, account); + Gee.List<Jid> ret = new ArrayList<Jid>(Jid.equals_func); + Gee.List<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(jid, account); + if (full_jids != null) { + ret.add_all(full_jids); + // Remove eventual presence from bare jid + ret.remove(jid); + } + return ret; } return null; } @@ -107,10 +114,7 @@ public class MucManager : StreamInteractionModule, Object { Gee.List<Jid>? occupants = get_occupants(jid, account); Jid? own_jid = get_own_jid(jid, account); if (occupants != null && own_jid != null) { - Gee.List<Jid> occupants_ = new ArrayList<Jid>(Jid.equals_func); - occupants_.add_all(occupants); - occupants_.remove(own_jid); - return occupants_; + occupants.remove(own_jid); } return occupants; } @@ -207,6 +211,11 @@ public class MucManager : StreamInteractionModule, Object { return null; } + public bool has_avatar(Jid muc_jid, Account account) { + Gee.List<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(muc_jid, account); + return full_jids != null && full_jids.contains(muc_jid); + } + private Xep.Muc.Flag? get_muc_flag(Account account) { XmppStream? stream = stream_interactor.get_stream(account); if (stream != null) { |