2016-08-29 15:43:05 +02:00
|
|
|
Blocking Command
|
|
|
|
================
|
|
|
|
|
2018-03-12 15:34:23 +01:00
|
|
|
[Back](index.md)
|
|
|
|
|
2016-08-29 15:43:05 +02:00
|
|
|
Allows to manage communications blocking.
|
|
|
|
|
|
|
|
* Check push notifications support
|
|
|
|
* Get blocking list
|
|
|
|
* Block contact
|
|
|
|
* Unblock contact
|
|
|
|
* Unblock all
|
2017-01-02 15:10:27 +01:00
|
|
|
* Check if a message has a blocked error
|
2016-08-29 15:43:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
**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
|
|
|
|
-------------
|
|
|
|
|
|
|
|
```
|
|
|
|
blockingCommandManager.blockContact(jid);
|
|
|
|
```
|
|
|
|
*jid* is a `Jid`
|
|
|
|
|
|
|
|
|
|
|
|
Unblock contact
|
|
|
|
---------------
|
|
|
|
|
|
|
|
```
|
|
|
|
blockingCommandManager.unblockContact(jid);
|
|
|
|
```
|
|
|
|
*jid* is a `Jid`
|
|
|
|
|
|
|
|
|
|
|
|
Unblock all
|
|
|
|
-----------
|
|
|
|
|
|
|
|
```
|
|
|
|
blockingCommandManager.unblockAll();
|
|
|
|
```
|
2017-01-02 15:10:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
Check if a message has a blocked error
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
```
|
|
|
|
BlockedErrorExtension.isInside(message));
|
|
|
|
```
|
|
|
|
*message* is a `Message`
|
|
|
|
|