Ejabberd privacy_set doesn't save anything in mysql

I want my users to be able to block each other. So I did some research and figured out that it can be done with privacy_set.
So I added mod_privacy and mod_blocking in config file.

The problem is when I run the following command nothing is getting inserted in mysql.

I copied xml from here.

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>"

I also tied this one, still no luck:

Copied from 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>"

This is the content of my ejabberd yml file:

    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

Any help would be appreciated.

Oh, the code in mod_privacy

Oh, the code in mod_privacy in recent versions changed, and now that command cannot work, neither in SQL or Mnesia. I'll check if I can make it to work again in the next days.

Try to see if this patch

Try to see if this patch works:

diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl
index 472e9fb..165b6fd 100644
--- a/src/mod_admin_extra.erl
+++ b/src/mod_admin_extra.erl
@@ -1490,11 +1490,9 @@ privacy_set(Username, Host, QueryS) ->
     QueryEl = fxml_stream:parse_element(QueryS),
     SubEl = xmpp:decode(QueryEl),
     IQ = #iq{type = set, id = <<"push">>, sub_els = [SubEl],
-	     from = From, to = To},
-    ejabberd_hooks:run_fold(privacy_iq_set,
-			    Host,
-			    {error, xmpp:err_feature_not_implemented()},
-			    [IQ, #userlist{}]),
+	     from = From, to = From},
+    RR = mod_privacy:process_iq(IQ),
+    ?DEBUG("privacy_set result: ~n~p", [RR]),
     ok.
 
 %%%

Then , in the call, use XEP-0016 queries, and provide only the query part, for example:

 ejabberdctl privacy_set user1 localhost "<query xmlns='jabber:iq:privacy'><active name='i-am-visible-list'/></query>"
Syndicate content