Fix runtime criticals
This commit is contained in:
parent
6d947c42b5
commit
9575b192e4
|
@ -105,9 +105,12 @@ public class Conversation : Object {
|
||||||
Xmpp.XmppStream? stream = stream_interactor.get_stream(account);
|
Xmpp.XmppStream? stream = stream_interactor.get_stream(account);
|
||||||
if (!Application.get_default().settings.notifications) return NotifySetting.OFF;
|
if (!Application.get_default().settings.notifications) return NotifySetting.OFF;
|
||||||
if (type_ == Type.GROUPCHAT) {
|
if (type_ == Type.GROUPCHAT) {
|
||||||
bool members_only = stream.get_flag(Xmpp.Xep.Muc.Flag.IDENTITY).has_room_feature(counterpart.bare_jid, Xmpp.Xep.Muc.Feature.MEMBERS_ONLY);
|
Xmpp.Xep.Muc.Flag flag = stream.get_flag(Xmpp.Xep.Muc.Flag.IDENTITY);
|
||||||
|
if (flag != null) {
|
||||||
|
bool members_only = flag.has_room_feature(counterpart.bare_jid, Xmpp.Xep.Muc.Feature.MEMBERS_ONLY);
|
||||||
return members_only ? NotifySetting.ON : NotifySetting.HIGHLIGHT;
|
return members_only ? NotifySetting.ON : NotifySetting.HIGHLIGHT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NotifySetting.ON;
|
return NotifySetting.ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class ConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void make_offline_all() {
|
public void make_offline_all() {
|
||||||
foreach (Account account in connection_todo) {
|
foreach (Account account in connections.keys) {
|
||||||
make_offline(account);
|
make_offline(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,15 +134,19 @@ public class ConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect(Account account) {
|
public void disconnect(Account account) {
|
||||||
|
if (connections.has_key(account)) {
|
||||||
make_offline(account);
|
make_offline(account);
|
||||||
try {
|
try {
|
||||||
connections[account].stream.disconnect();
|
connections[account].stream.disconnect();
|
||||||
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
|
} catch (Error e) {
|
||||||
|
warning(@"Error disconnecting stream $(e.message)\n");
|
||||||
|
}
|
||||||
connection_todo.remove(account);
|
connection_todo.remove(account);
|
||||||
if (connections.has_key(account)) {
|
if (connections.has_key(account)) {
|
||||||
connections.unset(account);
|
connections.unset(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private XmppStream? connect_(Account account, string? resource = null) {
|
private XmppStream? connect_(Account account, string? resource = null) {
|
||||||
if (connections.has_key(account)) connections[account].stream.detach_modules();
|
if (connections.has_key(account)) connections[account].stream.detach_modules();
|
||||||
|
@ -283,7 +287,9 @@ public class ConnectionManager {
|
||||||
try {
|
try {
|
||||||
make_offline(account);
|
make_offline(account);
|
||||||
connections[account].stream.disconnect();
|
connections[account].stream.disconnect();
|
||||||
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
|
} catch (Error e) {
|
||||||
|
warning(@"Error disconnecting stream $(e.message)\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("Device un-suspend\n");
|
print("Device un-suspend\n");
|
||||||
|
|
Loading…
Reference in a new issue