how to add new buddy in roster in xmpp

SPB picture SPB · Oct 7, 2010 · Viewed 13.5k times · Source

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

Answer

Martín Schonaker picture Martín Schonaker · Oct 9, 2010

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);