Merge branch 'master' into omemo-muc
This commit is contained in:
commit
ed3b36d0de
|
@ -98,7 +98,14 @@ public class MucManager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
public Gee.List<Jid>? get_occupants(Jid jid, Account account) {
|
public Gee.List<Jid>? get_occupants(Jid jid, Account account) {
|
||||||
if (is_groupchat(jid, 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +114,7 @@ public class MucManager : StreamInteractionModule, Object {
|
||||||
Gee.List<Jid>? occupants = get_occupants(jid, account);
|
Gee.List<Jid>? occupants = get_occupants(jid, account);
|
||||||
Jid? own_jid = get_own_jid(jid, account);
|
Jid? own_jid = get_own_jid(jid, account);
|
||||||
if (occupants != null && own_jid != null) {
|
if (occupants != null && own_jid != null) {
|
||||||
Gee.List<Jid> occupants_ = new ArrayList<Jid>(Jid.equals_func);
|
occupants.remove(own_jid);
|
||||||
occupants_.add_all(occupants);
|
|
||||||
occupants_.remove(own_jid);
|
|
||||||
return occupants_;
|
|
||||||
}
|
}
|
||||||
return occupants;
|
return occupants;
|
||||||
}
|
}
|
||||||
|
@ -207,6 +211,11 @@ public class MucManager : StreamInteractionModule, Object {
|
||||||
return null;
|
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) {
|
private Xep.Muc.Flag? get_muc_flag(Account account) {
|
||||||
XmppStream? stream = stream_interactor.get_stream(account);
|
XmppStream? stream = stream_interactor.get_stream(account);
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
|
|
|
@ -178,8 +178,8 @@ public class AvatarImage : Misc {
|
||||||
stream_interactor.connection_manager.connection_state_changed.connect(on_connection_changed);
|
stream_interactor.connection_manager.connection_state_changed.connect(on_connection_changed);
|
||||||
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_roster_updated);
|
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_roster_updated);
|
||||||
}
|
}
|
||||||
if (muc_manager.is_groupchat(jid_, account)) {
|
if (muc_manager.is_groupchat(jid_, account) && !muc_manager.has_avatar(jid_, account)) {
|
||||||
// Groupchat
|
// Groupchat without avatar
|
||||||
Gee.List<Jid>? occupants = muc_manager.get_other_occupants(jid_, account);
|
Gee.List<Jid>? occupants = muc_manager.get_other_occupants(jid_, account);
|
||||||
jid = jid_;
|
jid = jid_;
|
||||||
if (occupants == null || occupants.size == 0) {
|
if (occupants == null || occupants.size == 0) {
|
||||||
|
@ -211,7 +211,7 @@ public class AvatarImage : Misc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Single user
|
// Single user or MUC with vcard avatar
|
||||||
this.jid = jid_;
|
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()))) {
|
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());
|
||||||
|
|
Loading…
Reference in a new issue