【问题标题】:Android smack unable to get vcard for muc and loadvcard using muc idAndroid smack 无法使用 muc id 获取 muc 的 vcard 和 loadvcard
【发布时间】:2017-10-15 14:49:28
【问题描述】:

我使用的是 smack 版本 4.1.8,而服务器端我使用的是 ejjabberd:

 VCard vcard = new VCard();
 vcard =  VCardManager.getInstanceFor(XMPPService.getMundioXmppConfig().getXmpptcpConnection()).loadVCard();

以上几行提供了登录帐户的 vcard 信息,但我想获取特定 jid 的 vcard。

为此我尝试了:

vcard =  VCardManager.getInstanceFor(XMPPService.getMundioXmppConfig().getXmpptcpConnection()).loadVCard("testgroup@conference.localhost.com);

但它没有给我们电子名片。

【问题讨论】:

    标签: android smack vcf-vcard avatar multiuserchat


    【解决方案1】:

    用于获取 MUC 电子名片

    <iq to='test@conference.localhost' id='get1' type='get'> <vCard xmlns='vcard-temp'/> </iq>
    

    然后,服务器会回复这个:

    <iq from="test@conference.localhost" type="result" to="user@localhost/r" id="get1"> <vCard xmlns="vcard-temp"> <PHOTO> <TYPE>image/png</TYPE> <BINVAL> iVBORw0KGgoAAAANSUhEUgAA`</BINVAL> </PHOTO> </vCard> </iq>`
    

    For more information about MUC vcard check this URL

    【讨论】:

    • 嗨 Rakesh kalashetti 感谢您的回答,但我发现我正在使用的 smack 4.1.8 阻止了 setTo 功能。所以我修改了库,然后它就可以工作了。如果有人使用 smack 4.1.8 如果你想要这个功能,请去那里改变。 vcard.setTo(fulljabberid)。默认情况下,它们设置为 null。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-27
    • 2020-12-10
    • 1970-01-01
    • 2016-02-28
    • 2016-12-09
    • 1970-01-01
    相关资源
    最近更新 更多