Is it possible to modify the srg_create command (provided by mod_admin_extra module) to make the name, description and display optional? So for ex.
# ejabberdctl srg_create 'group1' 'example.net' 'Group1' '' ''
should create a shared roster 'group1' on virtual host 'example.net' with name 'Group1' and an empty description and no displayed groups.
I have observed that the arguments are being passed to "srg_create(Group, Host, Name, Description, Display)" function in mod_admin_extra.erl. Is it possible to modify this function so that it checks if any of the given parameters are empty and if so does not add them to the Opts variable (I am assuming that mod_shared_roster:create_group function ignores those parameters which are not passed).
Try to apply this patch to
Try to apply this patch to ejabberd:
Now you can do things like:
If you don't find any problem with that patch, it will be applied to ejabberd.
Though the patch did not
Though the patch did not apply perfectly, the code seems to be working flawlessly. Also I have observed that trailing backslashes should not be used to leave the fields empty. So the correct commands would be:
$ ejabberdctl srg_create noname localhost "" mydesc mydisp
$ ejabberdctl srg_create nodisplay localhost myname mydesc ""
Using single quotes as below also worked:
$ ejabberdctl srg_create noname localhost '' mydesc mydisp
$ ejabberdctl srg_create nodisplay localhost myname mydesc ''
My apologies. The patch
My apologies. The patch actually doesn't do what is required. It seems to create empty lists. The below output should make this clear:
$ ejabberdctl srg_create group1 example.net "" "" ""
$ ejabberdctl srg_get_info group1 example.net
name []
displayed_groups [[]]
description []
where as the expected output should be:
$ ejabberdctl srg_get_info group1 example.net
name ""
displayed_groups []
description ""
I think this is only a minor problem. Could it be fixed?
In Erlang, "" is another way
In Erlang, "" is another way to represent the same that []. So that isn't a problem.
The real problem is [[]]. This patch solves it, please verify before I commit them:
Committed
This patch solves it, please verify before I commit them
I've committed the patch to SVN.
Patch committed
If you don't find any problem with that patch, it will be applied to ejabberd.
I've committed the patch to ejabberd SVN 2.1.x branch and trunk.