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>