How to set my Name in smack?

2019-07-17 13:23发布

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

标签: java xmpp smack
1条回答
劳资没心,怎么记你
2楼-- · 2019-07-17 13:44

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>
查看更多
登录 后发表回答