powered by Jive Software

Haw can i change users nickname

Haw can i change users nickname with Strophe library? don’t find any unswers in other discusions in forum =(

or commands in JavaScript…

Don’t know about Strophe. Probably it should use some internal Openfire API, somehow. The only way (other than through the Admin Console) i know is with the User Service plugin. http://www.igniterealtime.org/projects/openfire/plugins/userservice/readme.html You have to install this plugin on the server. Or you can use some bot, which supports commands. http://community.igniterealtime.org/docs/DOC-1080

I was able to do it like this:

//Get the jid and the name you want to use.

$(document).trigger(‘contact_added’, {

jid: $(’#contact-jid’).val(),

name: $(’#contact-name’).val()

});

Then Call this:

// calling var iq will also allow you to rename the nickname.

$(document).bind(‘contact_added’, function (ev, data) {

var iq = $iq({type: “set”}).c(“query”, {xmlns: “jabber:iq:roster”})

.c(“item”, data);

Gab.connection.sendIQ(iq);

alert(iq);

var subscribe = $pres({to: data.jid, “type”: “subscribe”});

alert(subscribe);

Gab.connection.send(subscribe);

});