From 13526097f24b7a8ad63b1d482c44b44397fa055f Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 16:35:00 +0000 Subject: * Spring cleaning on Region.Environment. * Converted a large number of read-only fields to be actually, readonly. * Reformatted code sections. * Removed redundant code. --- .../Modules/Avatar/Friends/FriendsModule.cs | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs index dd6a92e..1dffc62 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs @@ -42,10 +42,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary> FriendLists = new Dictionary>(); - private Dictionary m_pendingFriendRequests = new Dictionary(); - private Dictionary m_rootAgents = new Dictionary(); - private List m_scene = new List(); + private readonly Dictionary> FriendLists = new Dictionary>(); + private readonly Dictionary m_pendingFriendRequests = new Dictionary(); + private readonly Dictionary m_rootAgents = new Dictionary(); + private readonly List m_scene = new List(); #region IRegionModule Members @@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends List updateUsers = new List(); foreach (FriendListItem fli in lfli) { - if (fli.onlinestatus == true) + if (fli.onlinestatus) { updateUsers.Add(fli.Friend); } @@ -357,20 +357,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends // https://wiki.secondlife.com/wiki/ImprovedInstantMessage // 38 == Offer friendship - if (dialog == (byte) 38) + if (dialog == 38) { LLUUID friendTransactionID = LLUUID.Random(); m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); - m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + + m_log.Info("[FRIEND]: 38 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + message); GridInstantMessage msg = new GridInstantMessage(); msg.fromAgentID = fromAgentID.UUID; msg.fromAgentSession = fromAgentSession.UUID; msg.toAgentID = toAgentID.UUID; msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here - m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString()); + m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID); msg.timestamp = timestamp; if (client != null) { @@ -393,16 +393,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends } // 39 == Accept Friendship - if (dialog == (byte) 39) + if (dialog == 39) { - m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + + m_log.Info("[FRIEND]: 39 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + message); } // 40 == Decline Friendship - if (dialog == (byte) 40) + if (dialog == 40) { - m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + + m_log.Info("[FRIEND]: 40 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + message); } } @@ -433,14 +433,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends msg.ParentEstateID = 0; msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; - msg.dialog = (byte) 39; // Approved friend request + msg.dialog = 39; // Approved friend request msg.Position = new sLLVector3(); - msg.offline = (byte) 0; + msg.offline = 0; msg.binaryBucket = new byte[0]; // We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); - SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1); + SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, 1); m_pendingFriendRequests.Remove(transactionID); // TODO: Inform agent that the friend is online @@ -471,9 +471,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends msg.ParentEstateID = 0; msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; - msg.dialog = (byte) 40; // Deny friend request + msg.dialog = 40; // Deny friend request msg.Position = new sLLVector3(); - msg.offline = (byte) 0; + msg.offline = 0; msg.binaryBucket = new byte[0]; SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); m_pendingFriendRequests.Remove(transactionID); -- cgit v1.1