aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/FriendsModule.cs
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Region/Environment/Modules/FriendsModule.cs
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/FriendsModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs35
1 files changed, 12 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index fec28a8..3c324a4 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -40,8 +40,7 @@ namespace OpenSim.Region.Environment.Modules
40{ 40{
41 public class FriendsModule : IRegionModule 41 public class FriendsModule : IRegionModule
42 { 42 {
43 43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 private LogBase m_log;
45 44
46 private Scene m_scene; 45 private Scene m_scene;
47 46
@@ -49,7 +48,6 @@ namespace OpenSim.Region.Environment.Modules
49 48
50 public void Initialise(Scene scene, IConfigSource config) 49 public void Initialise(Scene scene, IConfigSource config)
51 { 50 {
52 m_log = MainLog.Instance;
53 m_scene = scene; 51 m_scene = scene;
54 scene.EventManager.OnNewClient += OnNewClient; 52 scene.EventManager.OnNewClient += OnNewClient;
55 scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; 53 scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
@@ -72,6 +70,7 @@ namespace OpenSim.Region.Environment.Modules
72 70
73 71
74 } 72 }
73
75 private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, 74 private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID,
76 LLUUID fromAgentSession, LLUUID toAgentID, 75 LLUUID fromAgentSession, LLUUID toAgentID,
77 LLUUID imSessionID, uint timestamp, string fromAgentName, 76 LLUUID imSessionID, uint timestamp, string fromAgentName,
@@ -89,13 +88,13 @@ namespace OpenSim.Region.Environment.Modules
89 88
90 m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); 89 m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
91 90
92 m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); 91 m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
93 GridInstantMessage msg = new GridInstantMessage(); 92 GridInstantMessage msg = new GridInstantMessage();
94 msg.fromAgentID = fromAgentID.UUID; 93 msg.fromAgentID = fromAgentID.UUID;
95 msg.fromAgentSession = fromAgentSession.UUID; 94 msg.fromAgentSession = fromAgentSession.UUID;
96 msg.toAgentID = toAgentID.UUID; 95 msg.toAgentID = toAgentID.UUID;
97 msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here 96 msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here
98 m_log.Verbose("FRIEND","Filling Session: " + msg.imSessionID.ToString()); 97 m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString());
99 msg.timestamp = timestamp; 98 msg.timestamp = timestamp;
100 if (client != null) 99 if (client != null)
101 { 100 {
@@ -115,20 +114,18 @@ namespace OpenSim.Region.Environment.Modules
115 msg.binaryBucket = binaryBucket; 114 msg.binaryBucket = binaryBucket;
116 m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 115 m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
117 } 116 }
117
118 // 39 == Accept Friendship
118 if (dialog == (byte)39) 119 if (dialog == (byte)39)
119 { 120 {
120 m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); 121 m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
121
122 } 122 }
123
124 // 40 == Decline Friendship
123 if (dialog == (byte)40) 125 if (dialog == (byte)40)
124 { 126 {
125 m_log.Verbose("FRIEND", "38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message); 127 m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
126 } 128 }
127
128 // 39 == Accept Friendship
129
130 // 40 == Decline Friendship
131
132 } 129 }
133 130
134 private void OnApprovedFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) 131 private void OnApprovedFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders)
@@ -160,6 +157,7 @@ namespace OpenSim.Region.Environment.Modules
160 // TODO: Inform agent that the friend is online 157 // TODO: Inform agent that the friend is online
161 } 158 }
162 } 159 }
160
163 private void OnDenyFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders) 161 private void OnDenyFriendRequest(IClientAPI client, LLUUID agentID, LLUUID transactionID, List<LLUUID> callingCardFolders)
164 { 162 {
165 if (m_pendingFriendRequests.ContainsKey(transactionID)) 163 if (m_pendingFriendRequests.ContainsKey(transactionID))
@@ -184,20 +182,15 @@ namespace OpenSim.Region.Environment.Modules
184 msg.binaryBucket = new byte[0]; 182 msg.binaryBucket = new byte[0];
185 m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 183 m_scene.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
186 m_pendingFriendRequests.Remove(transactionID); 184 m_pendingFriendRequests.Remove(transactionID);
187
188 } 185 }
189
190
191 } 186 }
192 187
193 private void OnTerminateFriendship(IClientAPI client, LLUUID agent, LLUUID exfriendID) 188 private void OnTerminateFriendship(IClientAPI client, LLUUID agent, LLUUID exfriendID)
194 { 189 {
195 m_scene.StoreRemoveFriendship(agent, exfriendID); 190 m_scene.StoreRemoveFriendship(agent, exfriendID);
196 // TODO: Inform the client that the ExFriend is offline 191 // TODO: Inform the client that the ExFriend is offline
197
198 } 192 }
199 193
200
201 private void OnGridInstantMessage(GridInstantMessage msg) 194 private void OnGridInstantMessage(GridInstantMessage msg)
202 { 195 {
203 // Trigger the above event handler 196 // Trigger the above event handler
@@ -206,16 +199,12 @@ namespace OpenSim.Region.Environment.Modules
206 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, 199 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
207 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), 200 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
208 msg.binaryBucket); 201 msg.binaryBucket);
209
210 } 202 }
211 203
212
213 public void PostInitialise() 204 public void PostInitialise()
214 { 205 {
215 } 206 }
216 207
217
218
219 public void Close() 208 public void Close()
220 { 209 {
221 } 210 }
@@ -230,4 +219,4 @@ namespace OpenSim.Region.Environment.Modules
230 get { return false; } 219 get { return false; }
231 } 220 }
232 } 221 }
233} \ No newline at end of file 222}