I need to get the XMPP-User Groups from all Users inside a MUC and the user itself ("me"). I'd like to use them to set some permissions inside the candy xmpp client.
There is no plugin for this issue. Inside candy.min.js I found this function:
Candy.Core.Contact.prototype.getGroups = function() {
return this.data.groups; };
I didn't found any notes about it in the docs nor any correlation inside the other code/plugins. So maybe, this function does not even work.
I tried to write my own plugin. But I'm not that deep in JS. Calling the getGroups() function did not work for me.
I am able to read the user groups data by using the REST API from openfire (xmpp server). So there is no issue with permissions or data. It's generally possible to get the user groups data in this configuration. But I'd really like to get a cleaner solution inside of a candy chat plugin.
There are some core functions in Candy, which allows to send queries via strophe.js. I don't get it, yet. But I think, there is a way to use these to get the userGroups. They look like this example to SET a user password.:
var pwChangeRequest = $iq({
type: 'set',
to: 'shakespeare.lit'
})
.c('query', {xmlns: 'jabber:iq:register'})
.c('username').t('bill').up()
.c('password').t('newpass');
Candy.Core.getConnection().sendIQ(
pwChangeRequest,
function () {
console.log("Password change was successful.")
},
function (responseStanza) {
console.log("Password change failed.");
console.log(responseStanza);
}
);
So, how do I need to change this snippet to request the XMPP user groups?
I'd also like to RTFM :) but i found nothing explaining for the CANDY <-> Candy Plugin <-> prototype / strophe /stanza <-> XMPP (openfire) communications. Got something to read for me?