aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/blocking_manager.vala
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-10-08 17:45:16 +0200
committerMiquel Lionel <lionel@les-miquelots.net>2024-06-22 00:29:45 +0200
commit01a547ef18a52064cc85d1050c60f37bb50bd028 (patch)
treeece37e86cdefe6a149277f9a5e0c37625231520d /libdino/src/service/blocking_manager.vala
parent8b15417e0f6e90ef510ee70df7d32dbb7ce79393 (diff)
downloaddino-01a547ef18a52064cc85d1050c60f37bb50bd028.tar.gz
dino-01a547ef18a52064cc85d1050c60f37bb50bd028.zip
Allow blocking entire domain from conversation detailsallow-blocking-entire-domain
- the block domain option is in a drop down of the block button - when blocking the domain, the "Blocked domain" button appears and block button disappears and vice versa.
Diffstat (limited to 'libdino/src/service/blocking_manager.vala')
-rw-r--r--libdino/src/service/blocking_manager.vala15
1 files changed, 9 insertions, 6 deletions
diff --git a/libdino/src/service/blocking_manager.vala b/libdino/src/service/blocking_manager.vala
index aa07f990..1c125aac 100644
--- a/libdino/src/service/blocking_manager.vala
+++ b/libdino/src/service/blocking_manager.vala
@@ -20,19 +20,22 @@ public class BlockingManager : StreamInteractionModule, Object {
this.stream_interactor = stream_interactor;
}
- public bool is_blocked(Account account, Jid jid) {
+ public bool is_blocked(Account account, Jid jid, bool domainblock = false) {
XmppStream stream = stream_interactor.get_stream(account);
- return stream != null && stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).is_blocked(stream, jid.to_string());
+ string jid_str = domainblock ? jid.domainpart.to_string () : jid.to_string();
+ return stream != null && stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).is_blocked(stream, jid_str);
}
- public void block(Account account, Jid jid) {
+ public void block(Account account, Jid jid, bool domainblock = false) {
XmppStream stream = stream_interactor.get_stream(account);
- stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, { jid.to_string() });
+ string jid_str = domainblock ? jid.domainpart.to_string () : jid.to_string();
+ stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, { jid_str });
}
- public void unblock(Account account, Jid jid) {
+ public void unblock(Account account, Jid jid, bool domainblock = false) {
XmppStream stream = stream_interactor.get_stream(account);
- stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, { jid.to_string() });
+ string jid_str = domainblock ? jid.domainpart.to_string () : jid.to_string();
+ stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, { jid_str });
}
public bool is_supported(Account account) {