Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow vcards to be set for services #3428

Open
edhelas opened this issue Nov 18, 2020 · 17 comments
Open

Allow vcards to be set for services #3428

edhelas opened this issue Nov 18, 2020 · 17 comments

Comments

@edhelas
Copy link

edhelas commented Nov 18, 2020

It is currently possible to set a vcard for the general server using the vcard attribute on mod_vcard.

  mod_vcard:
    vcard:
     adr:
       -
         locality: Amsterdam
         ctry: The Netherlands
     url: "https://movim.eu"
     desc: "Movim official XMPP communication services, running on ejabberd"
     fn: Movim Communication Services

I'd like to know if it would be possible to extend that feature by allowing vcards to also be set for the related ejabberd services (pubsub, muc…).
This would let clients like Movim, that extensively uses Pubsub, to retrieve some information on those services and display them in the UI. This is also a way to explain differences between different services of the same type (privateconf.server.tld and publicconf.server.tld for example).

@badlop
Copy link
Member

badlop commented Dec 16, 2020

http_upload, muc, proxy65 and pubsub already support the vcard option, just like mod_vcard does.

This was implemented for ejabberd 19.08 in 5a97671

@badlop badlop added this to the ejabberd 19.08 milestone Dec 16, 2020
@edhelas
Copy link
Author

edhelas commented Dec 16, 2020

Wow I didn't knew that. I have to double check if the official documentation is up to date then !
Thanks for the precision :)

@edhelas
Copy link
Author

edhelas commented Dec 16, 2020

It is indeed useful, but not totally what I needed. This is configured on the module level and not on the host level.
This means that two MUC services, or Pubsub services, will return the same Vcard in the end.

@prefiks
Copy link
Member

prefiks commented Dec 17, 2020

You should be able to use host_config (or append_host_config):

host_config:
  "host1":
    modules:
      mod_pubsub:
        vcard: ...
  "host2":
    modules:
      mod_pubsub:
        vcard: ...

@edhelas
Copy link
Author

edhelas commented Dec 17, 2020

I can indeed add root hosts there but not subdomain services:

Error: "Invalid value of option host_config: 
Unexpected value: news.movim.eu. Did you mean movim.eu? Possible values are: jappix.com, movim.eu"

@badlop
Copy link
Member

badlop commented Dec 23, 2020

You may be doing something wrong, or I didn't understand your requirements. If I understood correctly your desire, it works for me:

hosts:
  - localhost
  - "example.net"
  - "example.org"

modules:
  # mod_muc:
  ...

append_host_config:
  "example.net":
    modules:
      mod_muc:
        vcard:
         desc: "This is NET conference of example.net"
  "example.org":
    modules:
      mod_muc:
        vcard:
         desc: "This is ORG conference of example.org"
<iq id='103:347163'
	xml:lang='es'
	type='get'
	to='conference.example.org'>
  <vCard xmlns='vcard-temp'/>
</iq>

<iq xml:lang='es'
	to='user1@localhost/tka1'
	from='conference.example.org'
	type='result'
	id='103:347163'>
  <vCard xmlns='vcard-temp'>
    <DESC>This is ORG conference of example.org</DESC>
  </vCard>
</iq>
<iq id='107:877346'
	xml:lang='es'
	type='get'
	to='conference.example.net'>
  <vCard xmlns='vcard-temp'/>
</iq>

<iq xml:lang='es'
	to='user1@localhost/tka1'
	from='conference.example.net'
	type='result'
	id='107:877346'>
  <vCard xmlns='vcard-temp'>
    <DESC>This is NET conference of example.net</DESC>
  </vCard>
</iq>

@edhelas
Copy link
Author

edhelas commented Jan 6, 2021

This is indeed what I needed ! Sorry for the misunderstanding :) !

@edhelas edhelas closed this as completed Jan 6, 2021
@edhelas
Copy link
Author

edhelas commented Mar 1, 2021

Ok, i'm reopening the ticket. Sorry about that. The problem is that it's not really per host, but per subdomain.
So something like that:

append_host_config:
  "news.example.net":
    modules:
      mod_pubsub:
        vcard:
         desc: "The pubsub news of example.net"
  "comics.example.net":
    modules:
      mod_pubsub:
        vcard:
         desc: "The pubsub comics of example.net"

@edhelas edhelas reopened this Mar 1, 2021
@badlop
Copy link
Member

badlop commented Mar 1, 2021

With that configuration all works correctly for me: the host news.example.net has a Pubsub service running at pubsub.news.example.net which vcard correctly says "The pubsub news of example.net". And the comics.example.net host has a Pubsub service running at pubsub.comics.example.net which vcard says "The pusub comics og example.net".

What behaviour do you get, and what did you expect?

@edhelas
Copy link
Author

edhelas commented Mar 2, 2021

2021-03-02 12:22:59.101 [error] <0.14205.30>@ejabberd_config:reload:116 Configuration reload aborted: Invalid value of option append_host_config: Unexpected value: news.movim.eu. Did you mean movim.eu? Possible values are: jappix.com, movim.eu

I can't actually append config to a subdomain because it needs to be registered as a host. And if I try to add it to hosts I got:

2021-03-02 12:23:46.392 [error] <0.11235.30>@ejabberd_config:reload:116 Configuration reload aborted: Invalid value of option modules->mod_pubsub->hosts->4: Failed to reuse route 'news.movim.eu' because it's already registered on a virtual host

@badlop
Copy link
Member

badlop commented Mar 2, 2021

Tell what ejabberd version are you using, how did you install it, and what configuration do you have set, specially all regarding hosts

@edhelas
Copy link
Author

edhelas commented Mar 2, 2021

ejabberd/now 20.12-0 amd64 [installed,local]
  ${msg(ejabberd.desc)}

Using the official ProcessOne DEB

@badlop
Copy link
Member

badlop commented Mar 2, 2021

Ok, that's a very recent version and I don't remember any recent bug related to this. As I was able to configure it, all indicates you messed the configuration, so I'll repeat again:

what configuration do you have set, specially all regarding hosts

@edhelas
Copy link
Author

edhelas commented Mar 2, 2021

So after having a quick talk with @weiss , it seems that there was a misunderstanding. I'll try to resume and clarify things.

On my ejabberd instance, I have two hosts defined : movim.eu and jappix.com.

hosts:
  - "movim.eu"
  - "jappix.com"

Under each of those hosts I'm using mod_pubsub with several hosts bellow them.

append_host_config:
  "movim.eu":
    modules:
      mod_pubsub:
        hosts:
          - "alt.@HOST@"
          - "blabla.@HOST@"
...
          - "comments.@HOST@"
   "jappix.eu":
    modules:
      mod_pubsub:
        hosts:
          - "pubsub.@HOST@"
...
          - "comments.@HOST@"

In Movim each of those subdomains (blabla.movim.eu, comments.movim.eu, pubsub.jappix.com…) I'd like to define a custom vcard to be able to display it in the Movim UI. Those subdomains are currently displayed this way in Movim

Capture d’écran_2021-03-02_23-07-33

I'd like to add a proper description, avatar and more (so what can be found in a proper vcard).

So what i'm looking for is basically a way to be able to define a custom vcard, not by host, not by host module, but actually by host module subdomain (so for each of those mod_pubsub hosts for example).

@weiss is telling me that this feature is actually non existent in ejabberd but could be implemented.

@badlop badlop removed this from the ejabberd 19.08 milestone Apr 8, 2021
@Neustradamus
Copy link

@badlop, @prefiks: What do you think about last @edhelas comment?

@mremond
Copy link
Member

mremond commented Apr 15, 2021

Let me try to propose another approach.

Possibly, it should be dynamic and not in the configuration file.

I guess, an admin could be able to set a vcard for any service name and it would override the default vcard served for that module.

That vcard would be stored in the database.

@edhelas
Copy link
Author

edhelas commented Apr 15, 2021

That sounds good to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants