Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

soprefactor
Justin Clark-Casey (justincc) 2010-06-04 20:44:01 +01:00
commit f319d2ef5e
9 changed files with 60 additions and 36 deletions

View File

@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected IGridService GridService protected IGridService GridService
{ {
get get { return m_Scenes[0].GridService; }
{ }
return m_Scenes[0].GridService;
} public IUserAccountService UserAccountService
{
get { return m_Scenes[0].UserAccountService; }
} }
public IScene Scene public IScene Scene
@ -220,33 +222,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnLogout += OnLogout; client.OnLogout += OnLogout;
if (m_Friends.ContainsKey(client.AgentId)) lock (m_Friends)
{ {
m_Friends[client.AgentId].Refcount++; if (m_Friends.ContainsKey(client.AgentId))
return; {
m_Friends[client.AgentId].Refcount++;
return;
}
UserFriendData newFriends = new UserFriendData();
newFriends.PrincipalID = client.AgentId;
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
newFriends.Refcount = 1;
newFriends.RegionID = UUID.Zero;
m_Friends.Add(client.AgentId, newFriends);
} }
UserFriendData newFriends = new UserFriendData();
newFriends.PrincipalID = client.AgentId;
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
newFriends.Refcount = 1;
newFriends.RegionID = UUID.Zero;
m_Friends.Add(client.AgentId, newFriends);
//StatusChange(client.AgentId, true); //StatusChange(client.AgentId, true);
} }
private void OnClientClosed(UUID agentID, Scene scene) private void OnClientClosed(UUID agentID, Scene scene)
{ {
if (m_Friends.ContainsKey(agentID)) lock (m_Friends)
{ if (m_Friends.ContainsKey(agentID))
if (m_Friends[agentID].Refcount == 1) {
m_Friends.Remove(agentID); if (m_Friends[agentID].Refcount == 1)
else m_Friends.Remove(agentID);
m_Friends[agentID].Refcount--; else
} m_Friends[agentID].Refcount--;
}
} }
private void OnLogout(IClientAPI client) private void OnLogout(IClientAPI client)
@ -518,12 +524,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
{ {
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
// update the local cache // update the local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
// //
// Notify the friend // Notify the friend
@ -572,7 +579,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
} }
} }
} }

View File

@ -35,6 +35,7 @@ using OpenSim.Framework;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
sr.Close(); sr.Close();
body = body.Trim(); body = body.Trim();
m_log.DebugFormat("[XXX]: query String: {0}", body); //m_log.DebugFormat("[XXX]: query String: {0}", body);
try try
{ {
@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (!UUID.TryParse(request["ToID"].ToString(), out toID)) if (!UUID.TryParse(request["ToID"].ToString(), out toID))
return FailureResult(); return FailureResult();
GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, "", toID, UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID);
string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID,
(byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero);
// !! HACK
im.imSessionID = im.fromAgentID;
if (m_FriendsModule.LocalFriendshipOffered(toID, im)) if (m_FriendsModule.LocalFriendshipOffered(toID, im))
return SuccessResult(); return SuccessResult();

View File

@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public UserAccountCache() public UserAccountCache()
{ {
// Warning: the size values are a bit fuzzy. What matters
// most for this cache is the count value (128 entries).
m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); m_UUIDCache = new ExpiringCache<UUID, UserAccount>();
m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound m_NameCache = new ExpiringCache<string, UUID>();
} }
public void Cache(UUID userID, UserAccount account) public void Cache(UUID userID, UserAccount account)

View File

@ -149,7 +149,7 @@ namespace OpenSim.Server.Handlers.Asset
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e); m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e);
} }
return FailureResult(); return FailureResult();

View File

@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Login
clientVersion = requestData["version"].ToString(); clientVersion = requestData["version"].ToString();
// We should do something interesting with the client version... // We should do something interesting with the client version...
m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
LoginResponse reply = null; LoginResponse reply = null;
reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient);

View File

@ -196,7 +196,7 @@ namespace OpenSim.Services.Connectors
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["PRINCIPALID"] = PrincipalID.ToString();
sendData["FRIENDS"] = Friend; sendData["FRIEND"] = Friend;
sendData["METHOD"] = "deletefriend"; sendData["METHOD"] = "deletefriend";
string reqString = ServerUtils.BuildQueryString(sendData); string reqString = ServerUtils.BuildQueryString(sendData);

View File

@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.Friends
public bool FriendshipDenied(GridRegion region, UUID userID, string userName, UUID friendID) public bool FriendshipDenied(GridRegion region, UUID userID, string userName, UUID friendID)
{ {
if (region == null)
return false;
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
//sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
@ -131,7 +134,11 @@ namespace OpenSim.Services.Connectors.Friends
private bool Call(GridRegion region, Dictionary<string, object> sendData) private bool Call(GridRegion region, Dictionary<string, object> sendData)
{ {
string reqString = ServerUtils.BuildQueryString(sendData); string reqString = ServerUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); //m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString);
if (region == null)
return false;
m_log.DebugFormat("[FRIENDS CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort);
try try
{ {
string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; string url = "http://" + region.ExternalHostName + ":" + region.HttpPort;

View File

@ -209,6 +209,8 @@ namespace OpenSim.Services.LLLoginService
bool success = false; bool success = false;
UUID session = UUID.Random(); UUID session = UUID.Random();
m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} from {2} with user agent {3} starting in {4}",
firstName, lastName, clientIP.Address.ToString(), clientVersion, startLocation);
try try
{ {
// //

View File

@ -55,7 +55,7 @@ namespace OpenSim.Services.PresenceService
UUID secureSessionID) UUID secureSessionID)
{ {
//PresenceData[] d = m_Database.Get("UserID", userID); //PresenceData[] d = m_Database.Get("UserID", userID);
m_Database.Get("UserID", userID); //m_Database.Get("UserID", userID);
PresenceData data = new PresenceData(); PresenceData data = new PresenceData();