Ejabberd

ejabberdctl process_rosteritems 命令中的多個參數

  • April 6, 2020

伙計們,尤其是 Badlop :) 我需要你的幫助並有疑問。如何在我擁有的 process_rosteritems 命令中添加更多參數,例如,這樣的命令:

ejabberdctl process_rosteritems list none out any user@jabber.com

我需要 2 個同時匹配,例如 user@jabber.comuser3@jabber.com 類似的東西:

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

如何修改命令,使其匹配 2 個 arg(同時匹配)?

如果您對 mod_roster 使用 mnesia,則可以使用某些參數(SUBS、ASKS、USERS 和 CONTACTS)。分隔幾個元素的字元是**:**。使用 SQL 儲存是不可能的……但在這種情況下,您可能仍然可以使用一些 SQL 查詢。

例如,要獲取具有聯繫人 user1 或 user2 的使用者:

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

如命令文件中所述:

$ 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%

引用自:https://serverfault.com/questions/1010775