Commit cb520e28 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

More optimization work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3747 b35dd754-fafc-0310-a699-88a17e54d16e
parent fbb9b66c
...@@ -18,6 +18,8 @@ import org.jivesoftware.wildfire.SharedGroupException; ...@@ -18,6 +18,8 @@ import org.jivesoftware.wildfire.SharedGroupException;
import org.jivesoftware.wildfire.group.Group; import org.jivesoftware.wildfire.group.Group;
import org.jivesoftware.wildfire.group.GroupManager; import org.jivesoftware.wildfire.group.GroupManager;
import org.jivesoftware.wildfire.group.GroupNotFoundException; import org.jivesoftware.wildfire.group.GroupNotFoundException;
import org.jivesoftware.wildfire.user.UserNameManager;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import java.util.*; import java.util.*;
...@@ -220,6 +222,15 @@ public class RosterItem implements Cacheable { ...@@ -220,6 +222,15 @@ public class RosterItem implements Cacheable {
* @param subStatus The subscription status of the item * @param subStatus The subscription status of the item
*/ */
public void setSubStatus(SubType subStatus) { public void setSubStatus(SubType subStatus) {
// Optimization: Load user only if we need to set the nickname of the roster item
if ("".equals(nickname) && (subStatus == SUB_BOTH || subStatus == SUB_TO)) {
try {
nickname = UserNameManager.getUserName(jid);
}
catch (UserNotFoundException e) {
// Do nothing
}
}
this.subStatus = subStatus; this.subStatus = subStatus;
} }
......
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