Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add new buddy in roster in xmpp

Tags:

xmpp

smack

Hi i am using smack.jar.I am able to connect with gtalk using it.Using Roster.getentries() i can get my buddy list.But how can i add new friends to my buddyList.Is there any API smack exposes to add new users??

Thanks

like image 466
SPB Avatar asked Oct 07 '10 08:10

SPB


2 Answers

I've been using this to create new contacts in a standard XMPP server (can't tell about gtalk):

  Roster roster = xmppConnection.getRoster();
  // jid: String, user: String, groups: String[]
  roster.createEntry(jid, user, groups);
like image 180
Martín Schonaker Avatar answered Oct 03 '22 23:10

Martín Schonaker


In XMPP, adding is adding to your roster + subscribing to the user. Updating is just adding the user to your roster. Keep in mind the minutiae.

like image 38
Tim Avatar answered Oct 03 '22 22:10

Tim