diff options
author | fiaxh <git@mx.ax.lt> | 2018-03-07 17:24:57 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-03-10 20:01:22 +0100 |
commit | 81310dff2e712cf7ddbce7c4717cd5a77170c79a (patch) | |
tree | a7d441a97856f3d0db192a2bebbda15a88bc87ee /main/src/ui/avatar_image.vala | |
parent | 0968da1ff76e7443c2590f4182087bb501d9c8f5 (diff) | |
download | dino-81310dff2e712cf7ddbce7c4717cd5a77170c79a.tar.gz dino-81310dff2e712cf7ddbce7c4717cd5a77170c79a.zip |
Handle multiple chat state notifications per bare jid
fixes #117
Diffstat (limited to 'main/src/ui/avatar_image.vala')
-rw-r--r-- | main/src/ui/avatar_image.vala | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala index 98460a57..baee12c7 100644 --- a/main/src/ui/avatar_image.vala +++ b/main/src/ui/avatar_image.vala @@ -184,7 +184,7 @@ public class AvatarImage : Misc { jid = jid_; if (occupants == null || occupants.size == 0) { if (force_update || current_jids.length != 1 || !current_jids[0].equals(jid_) || gray != (allow_gray && (occupants == null || !is_self_online()))) { - set_jids(new Jid[] {jid_}, false, occupants == null || !is_self_online()); + set_jids_(new Jid[] {jid_}, false, occupants == null || !is_self_online()); } } else if (occupants.size > 4) { bool requires_update = force_update; @@ -195,7 +195,7 @@ public class AvatarImage : Misc { } } if (requires_update) { - set_jids(occupants.slice(0, 3).to_array(), true); + set_jids_(occupants.slice(0, 3).to_array(), true); } } else { // 1 <= occupants.size <= 4 bool requires_update = force_update; @@ -207,18 +207,24 @@ public class AvatarImage : Misc { } } if (requires_update) { - set_jids(occupants.to_array(), false); + set_jids_(occupants.to_array(), false); } } } else { // Single user this.jid = jid_; if (force_update || current_jids.length != 1 || !current_jids[0].equals(jid) || gray != (allow_gray && (!is_counterpart_online(jid) || !is_self_online()))) { - set_jids(new Jid[] { jid }, false, !is_counterpart_online(jid) || !is_self_online()); + set_jids_(new Jid[] { jid }, false, !is_counterpart_online(jid) || !is_self_online()); } } } + public void set_jids(StreamInteractor stream_interactor, Jid[] jids, Account account, bool gray = false) { + this.stream_interactor = stream_interactor; + this.account = account; + set_jids_(jids.length > 3 ? jids[0:3] : jids, jids.length > 3, gray); + } + private void on_show_received(Show show, Jid jid, Account account) { if (!account.equals(this.account)) return; if (jid.equals_bare(this.jid)) { @@ -266,7 +272,7 @@ public class AvatarImage : Misc { return stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(counterpart, account) != null; } - public void set_jids(Jid[] jids, bool with_plus = false, bool gray = false) { + public void set_jids_(Jid[] jids, bool with_plus = false, bool gray = false) { assert(jids.length > 0); assert(jids.length < 5); assert(!with_plus || jids.length == 3); |