Small fixes to MucManager

This commit is contained in:
Marvin W 2018-01-16 16:16:43 +01:00 committed by fiaxh
parent bbfac91155
commit 03a349bfaf
2 changed files with 10 additions and 5 deletions

View file

@ -105,7 +105,10 @@ 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) {
occupants.remove(own_jid);
Gee.List<Jid> occupants_ = new ArrayList<Jid>(Jid.equals_func);
occupants_.add_all(occupants);
occupants_.remove(own_jid);
return occupants_;
}
return occupants;
}
@ -309,7 +312,8 @@ public class MucManager : StreamInteractionModule, Object {
foreach (Xep.Bookmarks.Conference conference in conferences) {
if (conference.jid.equals_bare(jid) && conference.nick == nick && conference.password == password) {
if (!conference.autojoin) {
stream.get_module(Xep.Bookmarks.Module.IDENTITY).replace_conference(stream, conference, changed);
conference.autojoin = true;
stream.get_module(Xep.Bookmarks.Module.IDENTITY).set_conferences(stream, conferences);
}
return;
}
@ -324,8 +328,9 @@ public class MucManager : StreamInteractionModule, Object {
foreach (Xep.Bookmarks.Conference conference in conferences) {
if (conference.jid.equals_bare(jid)) {
if (conference.autojoin) {
Xep.Bookmarks.Conference change = new Xep.Bookmarks.Conference(conference.jid) { nick=conference.nick, password=conference.password, autojoin=false };
stream.get_module(Xep.Bookmarks.Module.IDENTITY).replace_conference(stream, conference, change);
conference.autojoin = false;
stream.get_module(Xep.Bookmarks.Module.IDENTITY).set_conferences(stream, conferences);
return;
}
}
}

View file

@ -14,7 +14,7 @@ public class Conference : Object {
public bool autojoin {
get {
string? attr = stanza_node.get_attribute(ATTRIBUTE_AUTOJOIN);
return attr == "true" || attr == "1"; // "1" isn't standard, but it's used
return attr == "true" || attr == "1";
}
set { stanza_node.set_attribute(ATTRIBUTE_AUTOJOIN, value.to_string()); }
}