I wanted a way to get the list of usernames from OpenFire so I could compare it with our Active Directory since our OpenFire instance is in the cloud and our AD is private, I can't have OpenFire access it directly. It occured to me if I could modified the userservice plugin to accept another option to get the list of usernames on the server, my goal could be achieved.
I added the following code to UserServicePlugin.java
public String getAllUsers()
{
String userNames = "";
Collection<String> usernamesCol = userManager.getUsernames();
for(Iterator i = usernamesCol.iterator(); i.hasNext();) {
userNames += "<username>" + i.next() + "</username>";
}
return userNames;
}
and then modified/added this to the UserServiceServlet.java
if ((username == null) && (!"getallusers".equals(type))){
replyError("IllegalArgumentException",response, out);
return;
}
else if ("getallusers".equals(type)) {
String allUsers = plugin.getAllUsers();
replyMessage(allUsers,response,out);
}
The end result is if I use the userservice with a request type of getallusers, I get a result, in the format:
<result>
<username>myuser1</username>
<username>myuser2</username>
...etc...
</result>
which I can then consume/parse in my sync script. I don't want to branch the code for this plugin. What is the correct way to request that this feature be added to the plugin officially?
Thanks,
Steve