[ejabberd] Any way to get the Nickname of the 'from' on some Presence 'Subscribe' request?

Franky Orson franky.orson at gmail.com
Fri Apr 29 10:50:14 MSD 2011


Many thanks Badlop.

You know what, I effectively started to request (from my client) the
nickname from the inviter's vCard but I thought Ejabberd 2.1.x would
*not*support the following subscription presence form below with
<nick>some
nickname</nick> in it, since I had found that feature request as part of
EJAB-78 <https://support.process-one.net/browse/EJAB-78>, would only be
fixed in 3.x.

<presence from="user at localhost
<http://lists.jabber.ru/mailman/listinfo/ejabberd>" type="subscribe"
to="contact at localhost
<http://lists.jabber.ru/mailman/listinfo/ejabberd>">
  <nick xmlns="http://jabber.org/protocol/nick">And this is user's
nickname</nick>
</presence>

I did not bother testing it server-side because I thought it would not be
supported in 2.1.x - if it is working then this is awesome.

My problem was really to be able to send a sub presence to Ejabberd 2.1.6
like the one you mentioned (with the <nick> xml element) in it.

Again, many thanks - Am going to give it a try.

--Frank

BTW, the following fails eventough the nickname is set for that user bob - I
check via some client IQ - any idea? (using ejabberd 2.1.3)

*sudo ejabberdctl get_vcard bob myTest.com NICKNAME*

Failed RPC connection to the node 'ejabberd at myTest.com: {'EXIT',

{badarg,

[{io,

format,

[<0.30.0>,

"Problem 'error badarg' occurred executing the command.\n
Stacktrace: [{io_lib,format,[\"~s\",\"E\"]},
             {ejabberd_ctl,try_call_command,3},
             {ejabberd_ctl,process2,3},
             {ejabberd_ctl,process,1},
             {rpc,'-handle_call_call/6-fun-0-',5}]",

[]]},

{ejabberd_ctl,

process,

1},

{rpc,

'-handle_call_call/6-fun-0-',

5}]}}

On Thu, Apr 28, 2011 at 7:11 AM, Badlop <badlop at gmail.com> wrote:

> 2011/4/27 Franky Orson <franky.orson at gmail.com>:
> > Is there any way to still get the nickname of some user sending some
> > presence 'subscribe'?
> > Does anyone know of any tips on how this would be possible?
>
> Look at how other clients do that: Psi, Gajim, Tkabber, ...
>
> A user can specify his own nickname in his vCard.
> And a user specifies the desired nickname for each contact in his roster.
>
> Let's see how Psi handles this (I tested with ejabberd 2.1.6):
> When Psi shows a subscription form to the user,
> given a contact JID, Psi can retrieve that contact nick like this:
>
> <iq type='get' to='contact at localhost'>
>  <vCard xmlns='vcard-temp'/>
> </iq>
>
> <iq from='contact at localhost'
>        to='user at localhost/psi'
>        type='result'>
>  <vCard xmlns='vcard-temp'>
>    <FN>This is contact's full name</FN>
>    <NICKNAME>This is contact's nickname</NICKNAME>
>  </vCard>
> </iq>
>
> When the user Accepts the form, Psi sends this to the contact:
> <presence from="user at localhost" type="subscribe" to="contact at localhost">
>  <nick xmlns="http://jabber.org/protocol/nick">And this is user's
> nickname</nick>
> </presence>
> That is received by the contact.
> If the contact client doesn't support that <nick> element, it can get
> the user nickname
> by requesting the user vcard, just like Psi did.
>
>
> ---
> Badlop
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20110428/19a03ff6/attachment-0001.html>


More information about the ejabberd mailing list