Search code examples
javaxmppsmack

How to change your own name using Smack?


You can use RosterEntry to get the name of your contacts. But how I change my own name and it appears to my contacts when they do

RosterEntry entry = roster.getEntries("myuser");
entry.getName(); // It needs to show my updated name

Thanks in advance.


Solution

  • As long as the other users haven't set a custom nickname for you, I think Spark will display your first and last name, which you may be able to change with:

    VCard me = new VCard();
    me.load(conn); // load own VCard
    me.setFirstName("John");
    me.setLastName("Doe");
    me.save(conn);