How to set my Name in smack?

微笑、不失礼 提交于 2019-12-11 03:56:59

问题


I can use connection.getRoster(),getName to get roster names of contact. But how to set the name of current authenticated account?


回答1:


Log in with a different account? :)

Seriously, your account name is tied to your authentication, and there's no way to force the other side to use a particular nickname for you, but if both sides implement XEP-172, you can send a hint to the other side when you subscribe:

<presence from='narrator@moby-dick.lit' to='starbuck@moby-dick.lit' type='subscribe'>
  <nick xmlns='http://jabber.org/protocol/nick'>Ishmael</nick>
</presence>


来源:https://stackoverflow.com/questions/4807796/how-to-set-my-name-in-smack

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