aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_details.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/conversation_details.vala')
-rw-r--r--main/src/ui/conversation_details.vala32
1 files changed, 24 insertions, 8 deletions
diff --git a/main/src/ui/conversation_details.vala b/main/src/ui/conversation_details.vala
index 1c82f105..4c6a0481 100644
--- a/main/src/ui/conversation_details.vala
+++ b/main/src/ui/conversation_details.vala
@@ -10,6 +10,7 @@ namespace Dino.Ui.ConversationDetails {
model.conversation = conversation;
model.display_name = stream_interactor.get_module(ContactModels.IDENTITY).get_display_name_model(conversation);
model.blocked = stream_interactor.get_module(BlockingManager.IDENTITY).is_blocked(model.conversation.account, model.conversation.counterpart);
+ model.domain_blocked = stream_interactor.get_module(BlockingManager.IDENTITY).is_blocked(model.conversation.account, model.conversation.counterpart.domain_jid);
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
stream_interactor.get_module(MucManager.IDENTITY).get_config_form.begin(conversation.account, conversation.counterpart, (_, res) => {
@@ -24,6 +25,14 @@ namespace Dino.Ui.ConversationDetails {
view_model.avatar = new ViewModel.CompatAvatarPictureModel(stream_interactor).set_conversation(model.conversation);
view_model.show_blocked = model.conversation.type_ == Conversation.Type.CHAT && stream_interactor.get_module(BlockingManager.IDENTITY).is_supported(model.conversation.account);
+ if (model.domain_blocked) {
+ view_model.blocked = DOMAIN;
+ } else if (model.blocked) {
+ view_model.blocked = USER;
+ } else {
+ view_model.blocked = UNBLOCK;
+ }
+
model.display_name.bind_property("display-name", view_model, "name", BindingFlags.SYNC_CREATE);
model.conversation.bind_property("notify-setting", view_model, "notification", BindingFlags.SYNC_CREATE, (_, from, ref to) => {
switch (model.conversation.get_notification_setting(stream_interactor)) {
@@ -57,7 +66,6 @@ namespace Dino.Ui.ConversationDetails {
to = ty == Conversation.Type.GROUPCHAT ? ViewModel.ConversationDetails.NotificationOptions.ON_HIGHLIGHT_OFF : ViewModel.ConversationDetails.NotificationOptions.ON_OFF;
return true;
});
- model.bind_property("blocked", view_model, "blocked", BindingFlags.SYNC_CREATE);
model.bind_property("data-form", view_model, "room-configuration-rows", BindingFlags.SYNC_CREATE, (_, from, ref to) => {
var data_form = (DataForms.DataForm) from;
if (data_form == null) return true;
@@ -77,13 +85,21 @@ namespace Dino.Ui.ConversationDetails {
view_model.pin_changed.connect(() => {
model.conversation.pinned = model.conversation.pinned == 1 ? 0 : 1;
});
- view_model.block_changed.connect(() => {
- if (view_model.blocked) {
- stream_interactor.get_module(BlockingManager.IDENTITY).unblock(model.conversation.account, model.conversation.counterpart);
- } else {
- stream_interactor.get_module(BlockingManager.IDENTITY).block(model.conversation.account, model.conversation.counterpart);
+ view_model.block_changed.connect((action) => {
+ switch (action) {
+ case USER:
+ stream_interactor.get_module(BlockingManager.IDENTITY).block(model.conversation.account, model.conversation.counterpart);
+ stream_interactor.get_module(BlockingManager.IDENTITY).unblock(model.conversation.account, model.conversation.counterpart.domain_jid);
+ break;
+ case DOMAIN:
+ stream_interactor.get_module(BlockingManager.IDENTITY).block(model.conversation.account, model.conversation.counterpart.domain_jid);
+ break;
+ case UNBLOCK:
+ stream_interactor.get_module(BlockingManager.IDENTITY).unblock(model.conversation.account, model.conversation.counterpart);
+ stream_interactor.get_module(BlockingManager.IDENTITY).unblock(model.conversation.account, model.conversation.counterpart.domain_jid);
+ break;
}
- view_model.blocked = !view_model.blocked;
+ view_model.blocked = action;
});
view_model.notification_changed.connect((setting) => {
switch (setting) {
@@ -189,4 +205,4 @@ namespace Dino.Ui.ConversationDetails {
break;
}
}
-} \ No newline at end of file
+}