Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
javanesevn #1
Member since Apr 2008 · 74 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: vcard can not update
Dear all,

I had a problem when I update VCard. What is it wrong in my code? This code below did not force any error but I can not update data to server side.

Here is my code:

     public void publishVCard(RosterItem item)
    {
            Log("Publish VCard from "+ SBMManager.MyJid); // Give a result JID
            VcardIq viq = new VcardIq(IqType.set, SBMManager.MyJid);           

    viq.Vcard.Url       = item.Url ;
    viq.Vcard.Title     = item.Title ;
    viq.Vcard.Birthday  = item.Birthday ;
        viq.Vcard.AddEmailAddress( new Email( EmailType.INTERNET, item.EmailPreferred, true ) ) ;
    viq.Vcard.Role      = item.Role ;
    viq.Vcard.Description = item.Description ;
    viq.Vcard.Fullname  = item.FullName ;
    viq.Vcard.Nickname  = item.NickName ;
    viq.Vcard.Organization = new Organization( item.Organization, String.Empty ) ;
    if ( !string.IsNullOrEmpty( item.ImageFileName ) )
    {
        SetAvatar( item.ImageFileName, viq.Vcard) ;
    }
        Log("\nDump data :" + viq.ToString());
            xmppClientConn.Send(viq);
            //xmppClientConn.IqGrabber.SendIq(viq);
        }

And iq data:

<iq xmlns="jabber:client" id="agsXMPP_11" type="set" to="openfile1@fedoracore8/home">
<vCard xmlns="vcard-temp">
    <EMAIL><INTERNET /><PREF /><USERID>test@abc.com</USERID></EMAIL>
    <URL>www.abc.com</URL>
    <TITLE>Title</TITLE>
    <BDAY>0001-01-01</BDAY>
    <ROLE>Role</ROLE>
    <DESC>Desc</DESC>
    <FN>Fullname</FN>
    <NICKNAME>Nick Name</NICKNAME>
    <ORG><ORGNAME>Org</ORGNAME><ORGUNIT /></ORG>
    <PHOTO><TYPE>image/png</TYPE><BINVAL>AAA....AAA</BINVAL></PHOTO>
</vCard>
</iq>

Best regards,

Le
Avatar
Jabberer #2
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
<iq xmlns="jabber:client" id="agsXMPP_11" type="set" to="openfile1@fedoracore8/home">

The Jid is wrong. It must be a Bare Jid (without Resource). The server should reply with error in this case.
And keep in mind that you can update only your own vcard, so you must be logged in as openfile1@fedoracore8 when sending this packet.
Software Developer
AG-Software
Avatar
javanesevn #3
Member since Apr 2008 · 74 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Thank you very much.

And this is also work for me:

VcardIq viq = new VcardIq(IqType.set, new Jid(XmppCon.Server));

In VcardIq API document I could not see any VcardIq() constructor like VcardIq(IqType, string).


Best day.

Le
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by javanesevn:
In VcardIq API document I could not see any VcardIq() constructor like VcardIq(IqType, string).

Why do you need such a constructor. Can you please elaborate?

Alex
Alexander Gnauck
AG-Software
Avatar
javanesevn #5
Member since Apr 2008 · 74 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
So sorry, that is my mistake in my look. Yesterday I saw something wrong when IDE display in context menu.

Thanks.

Le
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS