0

Guys and especially Badlop :) I need your help and have question. How can I add more argument in process_rosteritems command I have for example, such command:

ejabberdctl process_rosteritems list none out any user@jabber.com

And I need 2 simultaneous matches, e.g. user@jabber.com & user3@jabber.com Something like that:

ejabberdctl process_rosteritems list none out any user@jabber.com&user3@jabber.com

How can I modify command, that it matches 2 arg (simultaneous matches)?

saxad
  • 7
  • 3

1 Answers1

1

If you use mnesia for mod_roster, then it is possible for some arguments (SUBS, ASKS, USERS and CONTACTS). The character to separate several elements is :. With SQL storage it isn't possible... but in that case you probably can use some SQL query anyway.

For example, to get users that have as contacts user1 or user2:

$ ejabberdctl process_rosteritems list any any any user1@localhost:user2@localhost
user3@localhost user1@localhost
user1@localhost user2@localhost
user2@localhost user1@localhost

As mentioned in the command documentation:

$ ejabberdctl help process_rosteritems

  Command Name: process_rosteritems

  Arguments: action::string
             subs::string
             asks::string
             users::string
             contacts::string

  Returns: response::[ pairs::{ user::string,
                                contact::string } ]

  Tags:  roster

  Description:  List/delete rosteritems that match filter

 Explanation of each argument:
 - action: what to do with each rosteritem that matches all the filtering options
 - subs: subscription type
 - asks: pending subscription
 - users: the JIDs of the local user
 - contacts: the JIDs of the contact in the roster

 *** Mnesia: 

Allowed values in the arguments:
 ACTION = list | delete
 SUBS = SUB[:SUB]* | any
 SUB = none | from | to | both
 ASKS = ASK[:ASK]* | any
 ASK = none | out | in
 USERS = JID[:JID]* | any
 CONTACTS = JID[:JID]* | any
 JID = characters valid in a JID, and can use the globs: *, ?, ! and [...]

This example will list roster items with subscription 'none', 'from' or 'to' that have any ask property, of local users
which JID is in the virtual host 'example.org' and that the contact JID is either a bare server name (without user part)
or that has a user part and the server part contains the word 'icq':
 list none:from:to any *@example.org *:*@*icq*

 *** SQL:

Allowed values in the arguments:
 ACTION = list | delete
 SUBS = any | none | from | to | both
 ASKS = any | none | out | in
 USERS = JID
 CONTACTS = JID
 JID = characters valid in a JID, and can use the globs: _ and %

This example will list roster items with subscription 'to' that have any ask property, of local users which JID is in the
virtual host 'example.org' and that the contact JID's server part contains the word 'icq':
 list to any %@example.org %@%icq%
Badlop
  • 580
  • 3
  • 5
  • Thanks a lot! You're cool! Also a suggestion - add in next release effective captcha. Because now situation with spam is catastrophic. Seems, like now 90% xmpp msgs are spam. And captcha with numbers doen not help at all. – saxad Apr 06 '20 at 13:31
  • If the answer solves the problem, mark it as correct. – Badlop Apr 06 '20 at 18:31