伙计们,特别是 Badlop :) 我需要你们的帮助,我有个问题。我如何在 process_rosteritems 命令中添加更多参数,例如,这样的命令:
ejabberdctl process_rosteritems list none out any [email protected]
我需要同时进行 2 场比赛,例如[电子邮件保护]&[电子邮件保护] 类似这样的:
ejabberdctl process_rosteritems list none out any [email protected]&[email protected]
我如何修改命令,使其匹配 2 个参数(同时匹配)?
答案1
如果您使用 mnesia 进行 mod_roster 操作,则可以使用某些参数(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%