Search code examples
xmppejabberdvcf-vcard

How to get muc room vcard trough ejabberd admin API?


so as the tittle suggests I cannot seem to get vcard info from muc rooms when using ejabberd's admin api as available here: https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#get-vcard .

Neither get_vcard (as well as get_vcard2) nor set_vcard work when I try those on a MUC room.

I am doing, for instance: ejabberdctl get_vcard my-room.jid conference.myhostname.com NICKNAME

and getting the errors:

** exception error: {module_not_loaded,mod_vcard,
                                     <<"conference.myhostname.com">>}
   in function  gen_mod:get_module_opts/2 (src/gen_mod.erl, line 338)
   in call from gen_mod:get_module_opt/3 (src/gen_mod.erl, line 318)
   in call from gen_mod:db_mod/3 (src/gen_mod.erl, line 352)
   in call from mod_vcard:get_vcard/2 (src/mod_vcard.erl, line 311)
   in call from mod_admin_extra:get_vcard_content/3 (src/mod_admin_extra.erl, line 1153)
   in call from mod_admin_extra:get_vcard/3 (src/mod_admin_extra.erl, line 1132)
   in call from ejabberd_ctl:call_command/4 (src/ejabberd_ctl.erl, line 315)
   in call from ejabberd_ctl:try_call_command/4 (src/ejabberd_ctl.erl, line 280)

I have all the same requests successfully working on normal users.

Is this feature simply not supported for MUC rooms?

EDIT: btw I am using ejabberd 20.4.0.

Thanks in advance!


Solution

  • There is no mention to vcards in XEP-0045, and no mention to MUC rooms in XEP-0054, so I wonder if this is an unexpected "feature".

    In ejabberd, the MUC room vcard is not stored using mod_vcard, instead it's stored in the room own configuration. For that reason, the get_vcard commands do not work, as they use mod_vcard, and mod_vcard knows nothing about MUC or MUC room vcards.

    I've now implemented support for MUC room vcard in the get_vcard commands, see: https://github.com/processone/ejabberd/commit/19019bbe32be2074e3b78ac13fdfc30c260fff5e

    Regarding setting a MUC room vcard, right now the only way would be using change_room_option, and setting the whole room vcard.