XEP-0191: Blocking Command (#42)
Bartosz Małkowski opened 4 years ago
Bartosz Małkowski commented 4 years ago

Also implemented, together with issue #42

Artur Hefczyc commented 4 years ago

Please provide code examples for the following:

  • Retrieve list of all blocked JIDs
  • Add JID to blocked list

@andrzej.wojcik if I block a JID, on one resource will I get a notification about this new blocked JID on other connected resources?

Andrzej Wójcik (Tigase) commented 4 years ago

@kobit As stated in XEP-0191:

The server MUST also send an IQ-set to all of the user's resources that have requested the blocklist, containing the blocked item(s):

<iq to='juliet@capulet.com/chamber' type='set' id='push1'>
  <block xmlns='urn:xmpp:blocking'>
    <item jid='romeo@montague.net'/>
  </block>
</iq>

This means that you will get notified.

Artur Hefczyc commented 4 years ago

Great!, this is what I need.

@bmalkow, please provide requested code examples.

Bartosz Małkowski commented 4 years ago
halcyon.getModule<BlockingCommandModule>(BlockingCommandModule.TYPE)
	.block("spammer@server.com".toBareJID(), Reason.Spam, "It is SPAMMER!!!")
	.response {
		it.onSuccess { println("Done") }
		it.onFailure { println("Oops!") }
	}.send()

You can also may listen for information about updates of blocked list:

halcyon.eventBus.register<BlockingCommandEvent>(BlockingCommandEvent.TYPE) { event ->
	when (event) {
		is BlockingCommandEvent.Blocked -> println("$event")
		is BlockingCommandEvent.Unblocked -> println("$event")
		is BlockingCommandEvent.UnblockedAll -> println("All blocked contacts are unblocked now!")
	}
}

But those events will be fired only when client previously retrieve list of blocked contacts (in other case, server do not push information):

halcyon.getModule<BlockingCommandModule>(BlockingCommandModule.TYPE).retrieveList().response {
	it.onSuccess {
		println("Blocked: $it")
	}
	it.onFailure { println("Oops!") }
}.send()

Artur Hefczyc commented 4 years ago

Sevan will be taking over client implementation, so we need to have it documented in one place. @bmalkow please add this to our documentation for the Kangaroo project in the Kangaroo github repo.

Bartosz Małkowski commented 4 years ago

Documentation to module is here: https://github.com/tigase/halcyon/blob/master/src/docs/asciidoc/text/modules/BlockingCommandModule.asciidoc Should I also add it to Kangaroo GitHub repo? If yes, then where exactly?

Artur Hefczyc commented 4 years ago

Again assigned back to Sevan.

@sevan.evans please review both documents and let us know if something is not clear yet. We can also talk about this during our Zoom session.

Sevan Evans commented 4 years ago

When using the Block button on a contact, the client will be prompted with a dialog asking if they would like to report the JID for spam. If Yes is clicked, the offender will be reported with the Report.Spam tag

The client will be prompted after that the user has been blocked.

You can find blocked users in the contacts menu, or in the dedicated Blocked Contacts list. The reason that blocked JID's are not hidden from the client in the contact menu, is incase a blocked user is added into a chat that the client is also added into, therefore giving a reason that they are not able to see their chat messages.

Unblocking works as expected (image after unblocking all contacts):

issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Spent time
4h
Issue Votes (0)
Watchers (0)
Reference
tigase/_libraries/halcyon#42
Please wait...
Page is in error, reload to recover