Ejabberd privacy_set 没有在 mysql 中保存任何内容
Ejabberd privacy_set doesn't save anything in mysql
我希望我的用户能够互相屏蔽。所以我做了一些研究,发现可以用 privacy_set
来完成。
所以我在配置文件中添加了 mod_privacy
和 mod_blocking
。
问题是当我 运行 以下命令时 mysql 没有插入任何内容。
我从 here 复制了 xml。
ejabberdctl privacy_set userA localhost "<iq from='userA@localhost/l' type='set' id='block1'> <block xmlns='urn:xmpp:blocking'> <item jid='userB@montague.net'/> </block> </iq>"
我也绑了这个,还是不行:
复制自here
ejabberdctl privacy_set userA localhost "<iq from='userA@localhost/l' type='set' id='iq1'> <query xmlns='jabber:iq:privacy'> <list name='iq-jid-example'> <item type='jid' value='userB@localhost' action='deny' order='29'> <iq/> </item> </list> </query> </iq>"
这是我的 ejabberd yml 文件的内容:
loglevel: 5
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
watchdog_admins:
- "admin@localhost"
acl:
admin:
user:
- "admin": "localhost"
access:
configure:
admin: allow
webadmin_view:
viewers: allow
hosts:
- "localhost"
listen:
-
port: 5222
module: ejabberd_c2s
max_stanza_size: 65536
shaper: c2s_shaper
access: c2s
-
port: 5281
module: ejabberd_http
request_handlers:
## "/oauth": ejabberd_oauth
"/api": mod_http_api
web_admin: true
http_bind: true
http_poll: true
captcha: false
commands_admin_access:
- allow:
- user: "admin@localhost"
commands:
- add_commands: [send_stanza, destroy_room, connected_users_info, get_room_options, user, admin, open, status, stats, connecteo_users, get_vcard, change_password, check_account, register, create_room, create_room_with_opts, send_direct_invitation]
oauth_access: all
modules:
mod_vcard: {}
mod_ping: {}
mod_admin_extra: {}
mod_mam: {}
mod_roster: {}
mod_shared_roster: {}
mod_stats: {}
mod_offline: {}
mod_privacy:
db_type: sql
mod_blocking: {}
api_permissions:
"console commands":
from:
- ejabberd_ctl
who: all
what: "*"
"admin access":
who:
- admin
- oauth:
- scope: "ejabberd:admin"
- admin
what:
- "*"
- "!stop"
- "!start"
shaper_rules:
max_user_sessions: 10
max_user_offline_messages:
- 5000: admin
- 100
c2s_shaper:
- none: admin
- normal
s2s_shaper: fast
access_rules:
local:
- allow: local
c2s:
- deny: blocked
- allow
announce:
- allow: admin
configure:
- allow: all
register:
- allow
trusted_network:
- allow: loopback
auth_password_format: scram
auth_method: sql
default_db: sql
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "123456"
## If you want to specify the port:
sql_port: 3306
如有任何帮助,我们将不胜感激。
我在名为 Profanity
的基于控制台的 XMPP 客户端的帮助下找到了答案
这是可以做到的:
ejabberdctl send_stanza_c2s userA localhost l '<iq id="1212" type="set"><block xmlns="urn:xmpp:blocking"><item jid="userB@localhost"/></block></iq>'
我希望我的用户能够互相屏蔽。所以我做了一些研究,发现可以用 privacy_set
来完成。
所以我在配置文件中添加了 mod_privacy
和 mod_blocking
。
问题是当我 运行 以下命令时 mysql 没有插入任何内容。
我从 here 复制了 xml。
ejabberdctl privacy_set userA localhost "<iq from='userA@localhost/l' type='set' id='block1'> <block xmlns='urn:xmpp:blocking'> <item jid='userB@montague.net'/> </block> </iq>"
我也绑了这个,还是不行:
复制自here
ejabberdctl privacy_set userA localhost "<iq from='userA@localhost/l' type='set' id='iq1'> <query xmlns='jabber:iq:privacy'> <list name='iq-jid-example'> <item type='jid' value='userB@localhost' action='deny' order='29'> <iq/> </item> </list> </query> </iq>"
这是我的 ejabberd yml 文件的内容:
loglevel: 5
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
watchdog_admins:
- "admin@localhost"
acl:
admin:
user:
- "admin": "localhost"
access:
configure:
admin: allow
webadmin_view:
viewers: allow
hosts:
- "localhost"
listen:
-
port: 5222
module: ejabberd_c2s
max_stanza_size: 65536
shaper: c2s_shaper
access: c2s
-
port: 5281
module: ejabberd_http
request_handlers:
## "/oauth": ejabberd_oauth
"/api": mod_http_api
web_admin: true
http_bind: true
http_poll: true
captcha: false
commands_admin_access:
- allow:
- user: "admin@localhost"
commands:
- add_commands: [send_stanza, destroy_room, connected_users_info, get_room_options, user, admin, open, status, stats, connecteo_users, get_vcard, change_password, check_account, register, create_room, create_room_with_opts, send_direct_invitation]
oauth_access: all
modules:
mod_vcard: {}
mod_ping: {}
mod_admin_extra: {}
mod_mam: {}
mod_roster: {}
mod_shared_roster: {}
mod_stats: {}
mod_offline: {}
mod_privacy:
db_type: sql
mod_blocking: {}
api_permissions:
"console commands":
from:
- ejabberd_ctl
who: all
what: "*"
"admin access":
who:
- admin
- oauth:
- scope: "ejabberd:admin"
- admin
what:
- "*"
- "!stop"
- "!start"
shaper_rules:
max_user_sessions: 10
max_user_offline_messages:
- 5000: admin
- 100
c2s_shaper:
- none: admin
- normal
s2s_shaper: fast
access_rules:
local:
- allow: local
c2s:
- deny: blocked
- allow
announce:
- allow: admin
configure:
- allow: all
register:
- allow
trusted_network:
- allow: loopback
auth_password_format: scram
auth_method: sql
default_db: sql
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "123456"
## If you want to specify the port:
sql_port: 3306
如有任何帮助,我们将不胜感激。
我在名为 Profanity
的基于控制台的 XMPP 客户端的帮助下找到了答案这是可以做到的:
ejabberdctl send_stanza_c2s userA localhost l '<iq id="1212" type="set"><block xmlns="urn:xmpp:blocking"><item jid="userB@localhost"/></block></iq>'