[ejabberd] Adding custom field to mod_vcard

Abhishek Ranjan abhishek at blacklightsw.com
Thu Apr 27 12:24:44 MSK 2017


Thank you for the reply.

After asking this question on this forum I kind of started with the first method which you suggested Badlop. I just wanted to ask that out of the three methods which would have been the best possible one if you also had the same objective(adding more attributes to vcard). And what can be the shortcomings of the first method i.e.

> 
>      you have to add new fields, which implies
>     modifying source code and table schema, and then update the table you
>     already have (either some SQL sentence, or writting code for mnesia).
> 

since I already started with this.

I am a newbie so any kind of comment will surely help.

Regards,

Abhishek Ranjan

> 
>     On April 27, 2017 at 1:05 PM Badlop <badlop at gmail.com> wrote:
> 
>     After quick thinking how to add new fields to the vcard, I see three ideas.
> 
>        1. As you probably found, you have to add new fields, which implies
>           modifying source code and table schema, and then update the table you
>           already have (either some SQL sentence, or writting code for mnesia).
> 
>        2. Reinterpret existing fields: some that you don't consider relevant,
>           rename them from the point of view of the users. This requires
>           changing the clients, and/or few source code changes (only the
>           labels), no table schema changes.
> 
>        3. Use the existing DESC field to add your custom fields in a
>           plaintext format. Example:
> 
>           <iq to='user1 at localhost/tka1' from='user1 at localhost' type='result' id='18:655344'>
>           <vCard xmlns='vcard-temp'>
>           <FN>my fullname</FN>
>           <NICKNAME>my nick</NICKNAME>
>           <DESC>FIELD1: hoho
>           FIELD2: haha</DESC>
>           </vCard>
>           </iq>
> 
>     ---
>     Badlop
>     ProcessOne
> 
>     On 25 April 2017 at 13:49, Abhishek Ranjan <abhishek at blacklightsw.com> wrote:
> 
>         > > 
> >         Hi,
> > 
> >         I have been dealing with the vcards of a user while building the chat
> >         application using ejabberd as server. Now I wanted to add custom attributes
> >         to the vcard say employee blood group,hobbies etc. I have been told that
> >         whenever I am trying to add anything custom to the ejabberd. I should use
> >         either iq handlers or hooks. But since vcard values are present in the form
> >         of records defined in mod_vcard.hrl, how can a I add only few attributes
> >         like given above to an existing lot already present in vcard and If i will
> >         create the complete new record won't there be a clash between the new vcard
> >         values and the older ones.
> > 
> >         Since I want the new attributes to get stored inside the existing tables(sql
> >         and mnesia) only, can anyone suggest me how to go about it.
> > 
> >         Regards,
> > 
> >         Abhishek Ranjan
> > 
> >         _______________________________________________
> >         ejabberd mailing list
> >         ejabberd at jabber.ru
> >         http://lists.jabber.ru/mailman/listinfo/ejabberd
> > 
> >     > 

Cheers!!
Abhishek

Checkout my awesome apps on Google Play Store https://play.google.com/store/apps/dev?id=7448460448507458941  and iOS http://bit.ly/bsw_iOS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20170427/17c3d19f/attachment.html>


More information about the ejabberd mailing list