Parse offline member info from MUC presence

Fixes OMEMO only encrypting to new member after restart and private MUC name only updating after restart
This commit is contained in:
fiaxh 2019-11-14 16:19:10 +01:00
parent c6bdb1a4bc
commit a2f63a7789
3 changed files with 7 additions and 3 deletions

View file

@ -71,7 +71,7 @@ public class List : Box {
} }
private void on_show_received(Show show, Jid jid, Account account) { private void on_show_received(Show show, Jid jid, Account account) {
if (conversation != null && conversation.counterpart.equals_bare(jid)) { if (conversation != null && conversation.counterpart.equals_bare(jid) && jid.is_full()) {
if (show.as == Show.OFFLINE && rows.has_key(jid)) { if (show.as == Show.OFFLINE && rows.has_key(jid)) {
remove_occupant(jid); remove_occupant(jid);
} else if (show.as != Show.OFFLINE && !rows.has_key(jid)) { } else if (show.as != Show.OFFLINE && !rows.has_key(jid)) {

View file

@ -72,7 +72,7 @@ public class Flag : XmppStreamFlag {
internal void set_real_jid(Jid full_jid, Jid real_jid) { occupant_real_jids[full_jid] = real_jid; } internal void set_real_jid(Jid full_jid, Jid real_jid) { occupant_real_jids[full_jid] = real_jid; }
internal void set_offline_member(Jid muc_jid, Jid real_jid, Affiliation affiliation) { internal void set_offline_member(Jid muc_jid, Jid real_jid, Affiliation affiliation) {
set_affiliation(muc_jid.bare_jid, real_jid, affiliation); set_affiliation(muc_jid.bare_jid, real_jid.bare_jid, affiliation);
} }
internal void set_affiliation(Jid muc_jid, Jid full_jid, Affiliation affiliation) { internal void set_affiliation(Jid muc_jid, Jid full_jid, Affiliation affiliation) {

View file

@ -282,8 +282,9 @@ public class Module : XmppStreamModule {
} }
} }
string? affiliation_str = x_node.get_deep_attribute("item", "affiliation"); string? affiliation_str = x_node.get_deep_attribute("item", "affiliation");
Affiliation? affiliation = null;
if (affiliation_str != null) { if (affiliation_str != null) {
Affiliation affiliation = parse_affiliation(affiliation_str); affiliation = parse_affiliation(affiliation_str);
flag.set_affiliation(presence.from.bare_jid, presence.from, affiliation); flag.set_affiliation(presence.from.bare_jid, presence.from, affiliation);
received_occupant_affiliation(stream, presence.from, affiliation); received_occupant_affiliation(stream, presence.from, affiliation);
} }
@ -291,6 +292,9 @@ public class Module : XmppStreamModule {
if (jid_ != null) { if (jid_ != null) {
Jid? jid = Jid.parse(jid_); Jid? jid = Jid.parse(jid_);
flag.set_real_jid(presence.from, jid); flag.set_real_jid(presence.from, jid);
if (affiliation != null) {
stream.get_flag(Flag.IDENTITY).set_offline_member(presence.from, jid, affiliation);
}
received_occupant_jid(stream, presence.from, jid); received_occupant_jid(stream, presence.from, jid);
} }
string? role_str = x_node.get_deep_attribute("item", "role"); string? role_str = x_node.get_deep_attribute("item", "role");