views:

144

answers:

1

I am using google appengine for my gtalk agent , I want to get the username of the gtalk user how can I get it ?

for your reference, check this

XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    //STEP 2
    Message msg = xmpp.parseMessage(req);
    JID fromJid = msg.getFromJid();

I am using the above things in the beginning .....

A: 

The JID is composed of user@domain/resource. The resource is optional, and provides more information about how the user is communicating (e.g. desktop or client app).

EDIT: See the Java JID class

Matthew Flaschen
from that how can I extract Username ??? eg. if a user [email protected] chats , that user name should be extracted from the message received by servelet.. I want to put that in a string :) How can I do it ?
srivigneshwar
Hey Matthew , I got it. I can get the user ID like this String userid = fromJid.getId();Thanks for your reply :)
srivigneshwar
You'll probably also want to strip out the resource.
Jason Hall