how to add new buddy in roster in xmpp

喜欢而已 提交于 2019-11-27 15:19:52

问题


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


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/3880073/how-to-add-new-buddy-in-roster-in-xmpp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!