Something similar to it is cross-posted here : http://stackoverflow.com/questions/6275685/problem-getting-shared-status-of-gtalk-using-xml

I am not getting replies there so posting it here again. I'm using smack 3.2

I have two queries:
1) How can we get the nick name or the name actual name of the user not the JID that is logging into chat. Suppose I log in to chat using smack api and I have email address of itsme@gmail.com and my name stored on gmail is Roger then how can I get this name "Roger" ?

2) Second question is what I had written in above post on stackoverflow, I am looking to get previous status messages from gtalk server from the method described by google on http://code.google.com/apis/talk/jep_extensions/shared_status.html but getting nothing in return. I get something like this only:

<iq id="2HyiB-4" to="itsme@gmail.com/Smack" from="itsme@gmail.com" type="result"></iq>

I am using this class to retrieve them:

class gtalksharedStatusPacket extends Packet {
     
     private String loginname;
     private String status;
     private int type;
     
     
     public gtalksharedStatusPacket (String _loginname) {
          loginname = _loginname;
     }
     
     public gtalksharedStatusPacket (String _loginname, String _status) {
          loginname = _loginname;
          status = _status;
          type = 3;
     }
     
     public void setType (int _type) {
          type = _type;
     }
     
     public void setStatus (String _status) {
          status = _status;
     }
     
     public String toXML () {
          String output = "";
          
          switch (type) {
               case 1: //client service discovery request
                    output += "<iq type='get' to='gmail.com'>";
                    output += "<query xmlns='http://jabber.org/protocol/disco#info'/>";
                    output += "</iq>";
                    break;
               
               case 2: //client request for status list
                    output += "<iq type='get' to='"+loginname+"@gmail.com'
id='"+Packet.nextID()+"' >";
                    output += "<query xmlns='google:shared-status' version='2'/>";
                    output += "</iq>";
                    break;
                    
               case 3: //update status
                    output  = "<iq type='set' to='"+loginname+"@gmail.com'
id='"+Packet.nextID()+"'>";
                    output += "<query xmlns='google:shared-status' version='2'>";
                    output += "<status>"+status+"</status>";
                    output += "<show>default</show>";
                    output += "<invisible value='false'/>";
                    output += "</query>";
                    output += "</iq>";
          }
          return output;
     }
}

And this is the same problem with all the google talk XMPP extensions described on http://code.google.com/apis/talk/jep_extensions/extensions.html

Ok, I got rid of my first problem of how to get a user's name. VCard class actually receive name from gtalk as First Name Field but shows null always. May be the function getFirstName() or the class itself has some bug. Anyways we can get the user name by calling the function getChildElementXML() of VCard which returns something like this:

<vCard xmlns='vcard-temp'><FN>Roger</FN></vCard>

There is your name, right inside <FN></FN> tags, you can get it by the help of substr method of String.