Update live whether encryption is possible in MUC (lock icon visible)
This commit is contained in:
parent
f099def5b6
commit
ed6eda129e
|
@ -11,7 +11,7 @@ public class MucManager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
public signal void left(Account account, Jid jid);
|
public signal void left(Account account, Jid jid);
|
||||||
public signal void subject_set(Account account, Jid jid, string? subject);
|
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 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 invite_received(Account account, Jid room_jid, Jid from_jid, string? password, string? reason);
|
||||||
public signal void bookmarks_updated(Account account, Set<Conference> conferences);
|
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) => {
|
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);
|
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) => {
|
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_info_updated.connect( (stream, muc_jid) => {
|
||||||
room_name_set(account, jid, room_name);
|
room_info_updated(account, muc_jid);
|
||||||
});
|
});
|
||||||
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).received_occupant_jid.connect( (stream, room, occupant) => {
|
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)) {
|
if (is_private_room(account, room.bare_jid)) {
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class AvatarImage : Misc {
|
||||||
stream_interactor.connection_manager.connection_state_changed.disconnect(on_connection_changed);
|
stream_interactor.connection_manager.connection_state_changed.disconnect(on_connection_changed);
|
||||||
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.disconnect(on_roster_updated);
|
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.private_room_occupant_updated.disconnect(on_private_room_occupant_updated);
|
||||||
|
muc_manager.room_info_updated.disconnect(on_room_info_updated);
|
||||||
stream_interactor = null;
|
stream_interactor = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +126,11 @@ public class AvatarImage : Misc {
|
||||||
update_avatar_if_jid(room);
|
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() {
|
private bool is_self_online() {
|
||||||
if (connection_manager != null) {
|
if (connection_manager != null) {
|
||||||
return connection_manager.get_state(account) == ConnectionManager.ConnectionState.CONNECTED;
|
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.connection_manager.connection_state_changed.connect(on_connection_changed);
|
||||||
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_roster_updated);
|
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.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.cached_surface = null;
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
|
|
|
@ -35,8 +35,6 @@ public class ChatInputController : Object {
|
||||||
stream_interactor.get_module(FileManager.IDENTITY).upload_available.connect(on_upload_available);
|
stream_interactor.get_module(FileManager.IDENTITY).upload_available.connect(on_upload_available);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void set_conversation(Conversation conversation) {
|
public void set_conversation(Conversation conversation) {
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,12 @@ public class EncryptionButton : MenuButton {
|
||||||
button_unencrypted = builder.get_object("button_unencrypted") as RadioButton;
|
button_unencrypted = builder.get_object("button_unencrypted") as RadioButton;
|
||||||
button_unencrypted.toggled.connect(encryption_button_toggled);
|
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;
|
Application app = GLib.Application.get_default() as Application;
|
||||||
foreach (var e in app.plugin_registry.encryption_list_entries) {
|
foreach (var e in app.plugin_registry.encryption_list_entries) {
|
||||||
RadioButton btn = new RadioButton.with_label(button_unencrypted.get_group(), e.name);
|
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");
|
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) {
|
public new void set_conversation(Conversation conversation) {
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
update_encryption_menu_state();
|
update_encryption_menu_state();
|
||||||
update_encryption_menu_icon();
|
update_encryption_menu_icon();
|
||||||
|
update_visibility();
|
||||||
visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
|
|
||||||
conversation.encryption != Encryption.NONE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ConversationSelectorRow : ListBoxRow {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Conversation.Type.GROUPCHAT:
|
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)) {
|
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
|
||||||
update_name_label();
|
update_name_label();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ConversationViewController : Object {
|
||||||
// Update conversation display name & topic
|
// Update conversation display name & topic
|
||||||
this.bind_property("conversation-display-name", titlebar, "title");
|
this.bind_property("conversation-display-name", titlebar, "title");
|
||||||
this.bind_property("conversation-topic", titlebar, "subtitle");
|
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)) {
|
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
|
||||||
update_conversation_display_name();
|
update_conversation_display_name();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_jid(XmppStream stream, Jid jid, Jid? real_jid);
|
||||||
public signal void received_occupant_role(XmppStream stream, Jid jid, Role? role);
|
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 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 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 self_removed_from_room(XmppStream stream, Jid jid, StatusCode code);
|
||||||
public signal void 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);
|
StanzaNode? x_node = message.stanza.get_subnode("x", NS_URI_USER);
|
||||||
if (x_node != null) {
|
if (x_node != null) {
|
||||||
StanzaNode? status_node = x_node.get_subnode("status", NS_URI_USER);
|
Gee.List<int> status_codes = get_status_codes(x_node);
|
||||||
if (status_node != null && status_node.get_attribute_int("code") == 104) {
|
if (!status_codes.is_empty) {
|
||||||
// room configuration has changed (e.g. room name)
|
if (status_codes.contains(StatusCode.CONFIG_CHANGE_NON_PRIVACY) ||
|
||||||
// https://xmpp.org/extensions/xep-0045.html#roomconfig-notify
|
status_codes.contains(StatusCode.NON_ANONYMOUS) ||
|
||||||
query_room_info(stream, message.from.bare_jid);
|
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) {
|
foreach (ServiceDiscovery.Identity identity in query_result.identities) {
|
||||||
if (identity.category == "conference") {
|
if (identity.category == "conference") {
|
||||||
stream.get_flag(Flag.IDENTITY).set_room_name(jid, identity.name);
|
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);
|
stream.get_flag(Flag.IDENTITY).set_room_features(jid, features);
|
||||||
|
room_info_updated(stream, jid);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue