Commit be24e54a authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

[CS-4302] Create and show chat room for projects and social groups. Reviewer: Armando Jagucki.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10256 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6d42c2aa
......@@ -14,12 +14,14 @@ import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Node;
import org.jivesoftware.openfire.XMPPServer;
import static org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET;
import static org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.PUT;
import org.jivesoftware.openfire.lockout.LockOutFlag;
import org.jivesoftware.openfire.lockout.LockOutProvider;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.Log;
import org.xmpp.packet.JID;
import java.util.List;
......@@ -194,6 +196,14 @@ public class ClearspaceLockOutProvider implements LockOutProvider {
* @throws UserNotFoundException The user was not found in the Clearspace database or there was an error.
*/
private Element getUserByUsername(String username) throws UserNotFoundException {
// Checks if the user is local
if (username.contains("@")) {
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
username = username.substring(0, username.lastIndexOf("@"));
}
try {
// Requests the user
String path = USER_URL_PREFIX + "users/" + username;
......
......@@ -51,13 +51,6 @@ public class ClearspaceUserProvider implements UserProvider {
* @throws UserNotFoundException if the user could not be found
*/
public User loadUser(String username) throws UserNotFoundException {
// Checks if the user is local
if (username.contains("@")) {
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
username = username.substring(0, username.lastIndexOf("@"));
}
// Translate the response
return translate(getUserByUsername(username));
......@@ -564,6 +557,14 @@ public class ClearspaceUserProvider implements UserProvider {
* @throws UserNotFoundException The user was not found in the Clearspace database or there was an error.
*/
private Element getUserByUsername(String username) throws UserNotFoundException {
// Checks if the user is local
if (username.contains("@")) {
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
username = username.substring(0, username.lastIndexOf("@"));
}
try {
// Requests the user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment