yura
yura

Reputation: 14655

How to send invitation to gtalk contact with smack java library?

How to send invitation to gtalk contact with smack java library?

Upvotes: 2

Views: 1780

Answers (3)

Z. Mei
Z. Mei

Reputation: 31

You can achieve Gtalk contact as follows:

GoogleTalkConnection con = new GoogleTalkConnection();
con.login(”joesmith”, “password”);
con.createChat(”[email protected]”).sendMessage(”Howdy!”);
con.close();

Upvotes: 0

Kevin Chen
Kevin Chen

Reputation: 1

Using the code below, you can construct the contact with gtalk.

ConnectionConfiguration conf = new ConnectionConfiguration(  
        "talk.google.com",  
        5222,  
        "gmail.com");  
conf.setSASLAuthenticationEnabled(false);
XMPPConnection con = new XMPPConnection(conf);  
con.connect();  
/* 
 * username : [email protected]

 * password : 
 */  
con.login("username", "password");  

Upvotes: 0

GaDo
GaDo

Reputation: 146

//Setting up connection
ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
        connection = new XMPPConnection(config);
        connection.connect();
//login
        connection.login(userName, password);
//get your roster   
    Roster roster = connection.getRoster();
//add a new roster entry aka SEND INVITATION

roster.createEntry(address, name, groups);

For further details look this page: http://www.igniterealtime.org/builds/smack/docs/3.1.0/javadoc/org/jivesoftware/smack/Roster.html

Upvotes: 4

Related Questions