When a room admin grants membership to a user (http://xmpp.org/extensions/xep-0045.html#grantmember), the provided nickname (nick attribute) is not stored.
In my case, the room is memebers-only and only permits occupants to enter the room with the registered nickname. The problem is that the room admin can't set a nickname for a room member when granting membership, it is not stored in the LocalMUCRoom nor the database ('nickname' column in table 'ofMucMember').
In the sourcecode of org.jivesoftware.openfire.muc.spi.IQAdminHandler, I found that the variable nick is only set if i don't pass a JID in the item tag (so hasJID becomes false). However, I have to pass a JID because the user is not a member of the room yet (so Openfire can't get the user's JID from its nickname in the room).
The problem would be solved when variable nick is also set when hasJID is true.
This is de relevant code in org.jivesoftware.openfire.muc.spi.IQAdminHandler (lines 250 - 299):
String nick;
...
if (hasJID) {
jids.add(new JID(item.attributeValue("jid")));
nick = null;
} else {
// Get the JID based on the requested nick
nick = item.attributeValue("nick");
for (MUCRole role : room.getOccupantsByNickname(nick)) {
if (!jids.contains(role.getUserAddress())) {
jids.add(role.getUserAddress());
}
}
}
...
} elseif ("member".equals(target)) {
// Add the user as a member of the room based on the bare JID
boolean hadAffiliation = room.getAffiliation(jid) != MUCRole.Affiliation.none;
presences.addAll(room.addMember(jid, nick, senderRole));
I hope this is clear, sorry for my bad English.