VCard (General questions)
by Varchas, Thursday, June 11, 2009, 13:29 (5643 days ago)
Hi . .I am using VC 2005. As soon as I successfully connect I am trying to get my vcard so that I show my name. But the call never returns back my vcard. What is the api I have to use so that I get my vcard details?
Below is the code I used.
IXMPPVCard mycard ;
mycard.AttachDispatch(m_XMPP.GetVCard()) ;//m_XMPP is an object of type IwodXMPPCom
Kindly let me know where i am going wrong.
Thanks and Regards
Varchas R S
Re: VCard
by woddrazen, Thursday, June 11, 2009, 15:52 (5643 days ago) @ Varchas
Hi Varchas,
First you should receive VCard from the server using XMPPVCard object Receive Method.
More help for Receive Method you can find here:
http://www.weonlydo.com/XMPP/Help/WODXMPPLib~XMPPVCard~Receive.html
Then in VCardDetails Event you can receive VCard details.
[code]debug.print Contact.VCard.NickName[/code]
You can find here list of VCard details you can receive:
http://www.weonlydo.com/XMPP/Help/WODXMPPLib~XMPPVCard.html
Let us know how it goes.
Regards,
Drazen
Re: VCard
by Varchas, Thursday, June 11, 2009, 18:04 (5643 days ago) @ woddrazen
Hello Drazen,
All those references are either in C# or in VB. I do not know the corresponding code or it doesnt seem to work.
This is what I tried
IXMPPVCard mycard ;
mycard.AttachDispatch(m_XMPP.GetVCard()) ;
mycard.Receive() ;
I am using gmail to test the application.
After calling Receive(), I do not get any VCardDetails event fired. Kindly let me know if the C++ code what I am trying is correct.
Thanks a ton for your help.
Do let me know.
Regards
Varchas R S
Hi Varchas,
First you should receive VCard from the server using XMPPVCard object Receive Method.More help for Receive Method you can find here:
http://www.weonlydo.com/XMPP/Help/WODXMPPLib~XMPPVCard~Receive.htmlThen in VCardDetails Event you can receive VCard details.
[code]debug.print Contact.VCard.NickName[/code]
You can find here list of VCard details you can receive:
http://www.weonlydo.com/XMPP/Help/WODXMPPLib~XMPPVCard.htmlLet us know how it goes.
Regards,
Drazen
Re: VCard
by wodSupport, Thursday, June 11, 2009, 21:52 (5643 days ago) @ Varchas
Hi. I used our Samples\VC\Component\MFC and I used this code to obtain first contact's VCard:[code] IXMPPContacts cnts;
cnts.AttachDispatch(m_XMPP.GetContacts(), TRUE);
VARIANT var;
var.vt = VT_I2;
var.iVal = 0;
IXMPPContact cnt;
cnt.AttachDispatch(cnts.GetItem(var), TRUE);
IXMPPVCard vcard;
vcard.AttachDispatch(cnt.GetVCard(), TRUE);
vcard.Receive();[/code]
Hope this helps!
Kreso
Re: VCard
by Varchas, Friday, June 12, 2009, 09:30 (5642 days ago) @ wodSupport
Hello Kreso,
I actually want the vcard of the currently logged in user. Say xyz@gmail.com is logged in. I want the vcard of xyz@gmail.com. The code snippet you have shown works for xyz@gmail.com's contact. But I need to know how to get my own vcard. What is wrong in my approach?
Kindly let me know.
Thanks and Regards
Varchas R S
Re: VCard
by wodDamir, Friday, June 12, 2009, 14:47 (5642 days ago) @ Varchas
Varchas,
Can you please update to latest version and use your previous code:
[code]IXMPPVCard mycard ;
mycard.AttachDispatch(m_XMPP.GetVCard()) ;
mycard.Receive() ; [/code]
Seems there was a small bug with gmail contacts, where server replied with Feature not implemented for some reason.
The latest version should resolve this problem.
Can you please update and try it out?
Regards,
Damba
Re: VCard
by Varchas, Friday, June 12, 2009, 20:41 (5642 days ago) @ wodDamir
Hello Damba,
Now after installing the latest 1.3.3 version, I do get the VCardDetails function, but this is the code I am calling inside
void CJabberVC6Dlg::XMPP_VCardDetails(LPDISPATCH Contact, BOOL Partial)
{
IXMPPContact cnt;
cnt.AttachDispatch(Contact) ;
IXMPPVCard myvcard ;
myvcard.AttachDispatch(cnt.GetVCard()) ;
AfxMessageBox(myvcard.GetJid()) ;
}
The GetJid() returns and so no information is present. Is the code in that function correct?
Thanks for the help. We are almost there :)
Regards
Varchas R S
Varchas,
Can you please update to latest version and use your previous code:
[code]IXMPPVCard mycard ;
mycard.AttachDispatch(m_XMPP.GetVCard()) ;
mycard.Receive() ; [/code]Seems there was a small bug with gmail contacts, where server replied with Feature not implemented for some reason.
The latest version should resolve this problem.
Can you please update and try it out?
Regards,
Damba
Re: VCard
by wodSupport, Saturday, June 13, 2009, 11:00 (5641 days ago) @ Varchas
Hi.
This is not a bug actually, since JID returns parser XMPPID tag that can be found in VCard. If this tag is empty, then empty string was returned.
However, I agree it makes sense for it to contain JID in all cases, so I have add the code to put JID that is known from before to JID property in case it's not provided by the server.
So, please download update and try it out.
Kind regards,
Kreso
Re: VCard
by Varchas, Saturday, June 13, 2009, 11:10 (5641 days ago) @ wodSupport
Where do i get the update from? I treid fetching the email using getemail() but that also returned . So do I have to fill in the VCard like nickname, etc etc and use the function mycard.Send() to update it onto the server and then retrieve it when ever I want?
Thanks and Regards
Varchas R S
Hi.
This is not a bug actually, since JID returns parser XMPPID tag that can be found in VCard. If this tag is empty, then empty string was returned.However, I agree it makes sense for it to contain JID in all cases, so I have add the code to put JID that is known from before to JID property in case it's not provided by the server.
So, please download update and try it out.
Kind regards,
Kreso
Re: VCard
by wodSupport, Saturday, June 13, 2009, 13:39 (5641 days ago) @ Varchas
Hi. If you're our licensed user then request update form http://www.weonlydo.com/index.asp?update=1 , otherwise just download the evaluation again.
As for other properties being empty - it's because server doesn't have that information and does not provide it to us as well. In theory, all properties could be empty.
Regards,
Kreso
Re: VCard
by Sapna, Monday, June 15, 2009, 10:59 (5639 days ago) @ wodSupport
how do i use the vcard object that is returned in the xmpp vcard event sink? i mean the GetPhoto object returned is an LDISPATCH one. so how do i use this in the code to return the picture of the contact?
Re: VCard
by wodSupport, Monday, June 15, 2009, 11:03 (5639 days ago) @ Sapna
Sapna,
hi. It contains IPictureDisp type, so you can use whatever is related to that interface. For example, I found this URL for displaying the picture:
http://www.experts-exchange.com/Programming/Languages/CPP/Q_10118014.html
you can also access PhotoData through SAFEARRAY to contain actual image bytes.
Regards,
Kreso
Re: VCard
by Sapna, Monday, June 15, 2009, 13:03 (5639 days ago) @ wodSupport
[code] void CViaClientDlg::XMPP_VCardDetails(LPDISPATCH Contact, BOOL Partial)
{
IXMPPContact cnt;
cnt.AttachDispatch(Contact);
IXMPPVCard contactVcard ;
cnt.AttachDispatch(contactVcard.GetPhoto()) ;
}[/code]
is this correct? what does it return? and where should i check for the returned value? because i don't know what to do or what variable stores the picture data. what more should i add and what should i remove?
thanks,
sapna
Re: VCard
by wodSupport, Monday, June 15, 2009, 16:16 (5639 days ago) @ Sapna
No, that's not it. It is of IPictureDisp type. If you refer to experts-exchange link I provided you can see sample there, something like [code]void CViaClientDlg::XMPP_VCardDetails(LPDISPATCH Contact, BOOL Partial)
{
IXMPPContact cnt;
cnt.AttachDispatch(Contact);
IXMPPVCard vc;
vc.AttachDispatch(Contact.GetVCard()) ;
CPictureHolder foo;
foo.SetPictureDispatch(vc.GetPhoto());
}
[/code]
I didn't test it but I don't see why this wouldn't work.
Kreso
Re: VCard
by Sapna, Monday, June 15, 2009, 17:14 (5639 days ago) @ wodSupport
do i have to use foo.Render with that? to display the picture?
Re: VCard
by wodSupport, Monday, June 15, 2009, 20:59 (5639 days ago) @ Sapna
It's up to you what you will do with it. You can use MFC's Render to display it, or you can obtain image data from PhotoData property and display it using some other library, such as CXImage which I use in Wippien.
Kreso
Re: VCard
by wodDamir, Tuesday, July 07, 2009, 09:04 (5617 days ago) @ wodSupport
Sapna,
Can you please try this:
[code]IXMPPVCard mycard;
mycard.AttachDispatch(m_XMPP.GetVCard());
mycard.Receive();[/code]
Use the above code to retrieve VCard, and use this in VCardDetails Event:
[code]IXMPPContact cnt;
cnt.AttachDispatch(Contact) ;
IXMPPVCard myvcard ;
myvcard.AttachDispatch(cnt.GetVCard()) ;
AfxMessageBox(myvcard.GetJid());[/code]
Regards,
Damba
Re: VCard
by sapna, Tuesday, July 07, 2009, 09:34 (5617 days ago) @ wodDamir
Sapna,
Can you please try this:
[code]IXMPPVCard mycard;
mycard.AttachDispatch(m_XMPP.GetVCard());
mycard.Receive();[/code]Use the above code to retrieve VCard, and use this in VCardDetails Event:
[code]IXMPPContact cnt;
cnt.AttachDispatch(Contact) ;
//contact returns null if the picture is not present in the vcard
IXMPPVCard myvcard ;
myvcard.AttachDispatch(cnt.GetVCard()) ;AfxMessageBox(myvcard.GetJid());
//this code does not return anything because the myvcard does not have anything other than the picture. myvcard.GetJid() returns null
[/code]Regards,
Damba