aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/service/muc_manager.vala6
-rw-r--r--main/src/ui/avatar_image.vala7
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala2
-rw-r--r--main/src/ui/chat_input/encryption_button.vala15
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala2
-rw-r--r--main/src/ui/conversation_view_controller.vala2
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala18
7 files changed, 34 insertions, 18 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 39d66213..93814625 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -11,7 +11,7 @@ public class MucManager : StreamInteractionModule, Object {
public signal void left(Account account, Jid jid);
public signal void subject_set(Account account, Jid jid, string? subject);
- public signal void room_name_set(Account account, Jid jid, string? room_name);
+ public signal void room_info_updated(Account account, Jid muc_jid);
public signal void private_room_occupant_updated(Account account, Jid room, Jid occupant);
public signal void invite_received(Account account, Jid room_jid, Jid from_jid, string? password, string? reason);
public signal void bookmarks_updated(Account account, Set<Conference> conferences);
@@ -285,8 +285,8 @@ public class MucManager : StreamInteractionModule, Object {
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).invite_received.connect( (stream, room_jid, from_jid, password, reason) => {
invite_received(account, room_jid, from_jid, password, reason);
});
- stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_name_set.connect( (stream, jid, room_name) => {
- room_name_set(account, jid, room_name);
+ stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_info_updated.connect( (stream, muc_jid) => {
+ room_info_updated(account, muc_jid);
});
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).received_occupant_jid.connect( (stream, room, occupant) => {
if (is_private_room(account, room.bare_jid)) {
diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala
index a3b386e3..ab64f5b9 100644
--- a/main/src/ui/avatar_image.vala
+++ b/main/src/ui/avatar_image.vala
@@ -83,6 +83,7 @@ public class AvatarImage : Misc {
stream_interactor.connection_manager.connection_state_changed.disconnect(on_connection_changed);
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.disconnect(on_roster_updated);
muc_manager.private_room_occupant_updated.disconnect(on_private_room_occupant_updated);
+ muc_manager.room_info_updated.disconnect(on_room_info_updated);
stream_interactor = null;
}
}
@@ -125,6 +126,11 @@ public class AvatarImage : Misc {
update_avatar_if_jid(room);
}
+ private void on_room_info_updated(Account account, Jid muc_jid) {
+ if (!account.equals(this.account)) return;
+ update_avatar_if_jid(muc_jid);
+ }
+
private bool is_self_online() {
if (connection_manager != null) {
return connection_manager.get_state(account) == ConnectionManager.ConnectionState.CONNECTED;
@@ -167,6 +173,7 @@ public class AvatarImage : Misc {
stream_interactor.connection_manager.connection_state_changed.connect(on_connection_changed);
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_roster_updated);
muc_manager.private_room_occupant_updated.connect(on_private_room_occupant_updated);
+ muc_manager.room_info_updated.connect(on_room_info_updated);
}
this.cached_surface = null;
this.conversation = conversation;
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala
index 59a2abb4..f65da1e8 100644
--- a/main/src/ui/chat_input/chat_input_controller.vala
+++ b/main/src/ui/chat_input/chat_input_controller.vala
@@ -35,8 +35,6 @@ public class ChatInputController : Object {
stream_interactor.get_module(FileManager.IDENTITY).upload_available.connect(on_upload_available);
}
-
-
public void set_conversation(Conversation conversation) {
this.conversation = conversation;
diff --git a/main/src/ui/chat_input/encryption_button.vala b/main/src/ui/chat_input/encryption_button.vala
index 3544c252..859b7baa 100644
--- a/main/src/ui/chat_input/encryption_button.vala
+++ b/main/src/ui/chat_input/encryption_button.vala
@@ -28,6 +28,12 @@ public class EncryptionButton : MenuButton {
button_unencrypted = builder.get_object("button_unencrypted") as RadioButton;
button_unencrypted.toggled.connect(encryption_button_toggled);
+ stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, muc_jid) => {
+ if (conversation != null && conversation.account.equals(account) && conversation.counterpart.equals(muc_jid)) {
+ update_visibility();
+ }
+ });
+
Application app = GLib.Application.get_default() as Application;
foreach (var e in app.plugin_registry.encryption_list_entries) {
RadioButton btn = new RadioButton.with_label(button_unencrypted.get_group(), e.name);
@@ -79,13 +85,16 @@ public class EncryptionButton : MenuButton {
set_icon(conversation.encryption == Encryption.NONE ? "changes-allow-symbolic" : "changes-prevent-symbolic");
}
+ private void update_visibility() {
+ visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
+ conversation.encryption != Encryption.NONE;
+ }
+
public new void set_conversation(Conversation conversation) {
this.conversation = conversation;
update_encryption_menu_state();
update_encryption_menu_icon();
-
- visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
- conversation.encryption != Encryption.NONE;
+ update_visibility();
}
}
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 7b017258..80257a6d 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -49,7 +49,7 @@ public class ConversationSelectorRow : ListBoxRow {
});
break;
case Conversation.Type.GROUPCHAT:
- stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => {
+ stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => {
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
update_name_label();
}
diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala
index cb5d4dce..abb8ab57 100644
--- a/main/src/ui/conversation_view_controller.vala
+++ b/main/src/ui/conversation_view_controller.vala
@@ -61,7 +61,7 @@ public class ConversationViewController : Object {
// Update conversation display name & topic
this.bind_property("conversation-display-name", titlebar, "title");
this.bind_property("conversation-topic", titlebar, "subtitle");
- stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => {
+ stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => {
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
update_conversation_display_name();
}
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index 59cb703e..263fa3d7 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -67,8 +67,8 @@ public class Module : XmppStreamModule {
public signal void received_occupant_jid(XmppStream stream, Jid jid, Jid? real_jid);
public signal void received_occupant_role(XmppStream stream, Jid jid, Role? role);
public signal void subject_set(XmppStream stream, string? subject, Jid jid);
- public signal void room_name_set(XmppStream stream, Jid jid, string? room_name);
public signal void invite_received(XmppStream stream, Jid room_jid, Jid from_jid, string? password, string? reason);
+ public signal void room_info_updated(XmppStream stream, Jid muc_jid);
public signal void self_removed_from_room(XmppStream stream, Jid jid, StatusCode code);
public signal void removed_from_room(XmppStream stream, Jid jid, StatusCode? code);
@@ -248,12 +248,14 @@ public class Module : XmppStreamModule {
StanzaNode? x_node = message.stanza.get_subnode("x", NS_URI_USER);
if (x_node != null) {
- StanzaNode? status_node = x_node.get_subnode("status", NS_URI_USER);
- if (status_node != null && status_node.get_attribute_int("code") == 104) {
- // room configuration has changed (e.g. room name)
- // https://xmpp.org/extensions/xep-0045.html#roomconfig-notify
- query_room_info(stream, message.from.bare_jid);
- }
+ Gee.List<int> status_codes = get_status_codes(x_node);
+ if (!status_codes.is_empty) {
+ if (status_codes.contains(StatusCode.CONFIG_CHANGE_NON_PRIVACY) ||
+ status_codes.contains(StatusCode.NON_ANONYMOUS) ||
+ status_codes.contains(StatusCode.SEMI_ANONYMOUS)) {
+ query_room_info(stream, message.from.bare_jid);
+ }
+ }
}
}
}
@@ -385,7 +387,6 @@ public class Module : XmppStreamModule {
foreach (ServiceDiscovery.Identity identity in query_result.identities) {
if (identity.category == "conference") {
stream.get_flag(Flag.IDENTITY).set_room_name(jid, identity.name);
- room_name_set(stream, jid, identity.name);
}
}
@@ -414,6 +415,7 @@ public class Module : XmppStreamModule {
}
}
stream.get_flag(Flag.IDENTITY).set_room_features(jid, features);
+ room_info_updated(stream, jid);
});
}