aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/entity/conversation.vala7
-rw-r--r--libdino/src/service/connection_manager.vala22
2 files changed, 19 insertions, 10 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala
index 9026e33f..585db07e 100644
--- a/libdino/src/entity/conversation.vala
+++ b/libdino/src/entity/conversation.vala
@@ -105,8 +105,11 @@ public class Conversation : Object {
Xmpp.XmppStream? stream = stream_interactor.get_stream(account);
if (!Application.get_default().settings.notifications) return NotifySetting.OFF;
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);
- return members_only ? NotifySetting.ON : NotifySetting.HIGHLIGHT;
+ 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 NotifySetting.ON;
}
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index b73cd117..2abbc9cb 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -121,7 +121,7 @@ public class ConnectionManager {
}
public void make_offline_all() {
- foreach (Account account in connection_todo) {
+ foreach (Account account in connections.keys) {
make_offline(account);
}
}
@@ -134,13 +134,17 @@ public class ConnectionManager {
}
public void disconnect(Account account) {
- make_offline(account);
- try {
- connections[account].stream.disconnect();
- } catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
- connection_todo.remove(account);
if (connections.has_key(account)) {
- connections.unset(account);
+ make_offline(account);
+ try {
+ connections[account].stream.disconnect();
+ } catch (Error e) {
+ warning(@"Error disconnecting stream $(e.message)\n");
+ }
+ connection_todo.remove(account);
+ if (connections.has_key(account)) {
+ connections.unset(account);
+ }
}
}
@@ -283,7 +287,9 @@ public class ConnectionManager {
try {
make_offline(account);
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 {
print("Device un-suspend\n");