From 8ca37dbefadc9b2d31b76786051d0ed8e1342121 Mon Sep 17 00:00:00 2001 From: Revolution Date: Wed, 30 Dec 2009 22:00:58 -0600 Subject: Adds Friend Finding functionality. Signed-off-by: Melanie --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index d6a82ef..580e06f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -395,7 +395,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // if it leaves, we want to know, too client.OnLogout += OnLogout; + client.OnGrantUserRights += GrantUserFriendRights; + client.OnTrackAgentEvent += FindAgent; + client.OnFindAgentEvent += FindAgent; } @@ -1114,6 +1117,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights); } + public void FindAgent(IClientAPI remoteClient, UUID hunter, UUID target) + { + List friendList = GetUserFriends(hunter); + foreach (FriendListItem item in friendList) + { + if(item.onlinestatus == true) + { + if(item.Friend == target && (item.FriendPerms & (uint)FriendRights.CanSeeOnMap) != 0) + { + ScenePresence SPTarget = ((Scene)remoteClient.Scene).GetScenePresence(target); + string regionname = SPTarget.Scene.RegionInfo.RegionName; + remoteClient.SendScriptTeleportRequest("FindAgent", regionname,new Vector3(SPTarget.AbsolutePosition),new Vector3(SPTarget.Lookat)); + } + } + else + { + remoteClient.SendAgentAlertMessage("The agent you are looking for is not online.", false); + } + } + } public List GetUserFriends(UUID agentID) { -- cgit v1.1