1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-19 17:17:57 +01:00
Smack/documentation/extensions/blockingcommand.md

77 lines
1.2 KiB
Markdown
Raw Normal View History

Blocking Command
================
[Back](index.md)
2018-04-01 15:59:27 +02:00
Allows one to manage communications blocking.
* Check push notifications support
* Get blocking list
* Block contact
* Unblock contact
* Unblock all
* Check if a message has a blocked error
**XEP related:** [XEP-0191](http://xmpp.org/extensions/xep-0191.html)
Get an instance of Blocking Command Manager
-------------------------------------------
```
BlockingCommandManager blockingCommandManager = BlockingCommandManager.getInstanceFor(connection);
```
Check blocking command support
------------------------------
```
boolean isSupported = blockingCommandManager.isSupportedByServer();
```
Get block list
--------------
```
List<Jid> blockList = blockingCommandManager.getBlockList();
```
Block contact
-------------
```
2018-04-01 15:59:27 +02:00
blockingCommandManager.blockContacts(jids);
```
2018-04-01 15:59:27 +02:00
*jids* is a `java.util.List<Jid>`
Unblock contact
---------------
```
2018-04-01 15:59:27 +02:00
blockingCommandManager.unblockContacts(jids);
```
2018-04-01 15:59:27 +02:00
*jids* is a `java.util.List<Jid>`
Unblock all
-----------
```
blockingCommandManager.unblockAll();
```
Check if a message has a blocked error
--------------------------------------
```
BlockedErrorExtension.isInside(message));
```
*message* is a `Message`