mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 12:25:42 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
protected IGridService GridService
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Scenes[0].GridService;
|
||||
}
|
||||
get { return m_Scenes[0].GridService; }
|
||||
}
|
||||
|
||||
public IUserAccountService UserAccountService
|
||||
{
|
||||
get { return m_Scenes[0].UserAccountService; }
|
||||
}
|
||||
|
||||
public IScene Scene
|
||||
@@ -220,33 +222,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
client.OnLogout += OnLogout;
|
||||
|
||||
if (m_Friends.ContainsKey(client.AgentId))
|
||||
lock (m_Friends)
|
||||
{
|
||||
m_Friends[client.AgentId].Refcount++;
|
||||
return;
|
||||
if (m_Friends.ContainsKey(client.AgentId))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
private void OnClientClosed(UUID agentID, Scene scene)
|
||||
{
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
if (m_Friends[agentID].Refcount == 1)
|
||||
m_Friends.Remove(agentID);
|
||||
else
|
||||
m_Friends[agentID].Refcount--;
|
||||
}
|
||||
lock (m_Friends)
|
||||
if (m_Friends.ContainsKey(agentID))
|
||||
{
|
||||
if (m_Friends[agentID].Refcount == 1)
|
||||
m_Friends.Remove(agentID);
|
||||
else
|
||||
m_Friends[agentID].Refcount--;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
|
||||
|
||||
FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
|
||||
FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
|
||||
// update the local cache
|
||||
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
|
||||
|
||||
m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
|
||||
|
||||
//
|
||||
// Notify the friend
|
||||
@@ -572,7 +579,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
if (friendSession != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
@@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
sr.Close();
|
||||
body = body.Trim();
|
||||
|
||||
m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
||||
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);
|
||||
|
||||
|
||||
// !! HACK
|
||||
im.imSessionID = im.fromAgentID;
|
||||
|
||||
if (m_FriendsModule.LocalFriendshipOffered(toID, im))
|
||||
return SuccessResult();
|
||||
|
||||
|
||||
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
||||
|
||||
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_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound
|
||||
m_NameCache = new ExpiringCache<string, UUID>();
|
||||
}
|
||||
|
||||
public void Cache(UUID userID, UserAccount account)
|
||||
|
||||
Reference in New Issue
Block a user