aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs54
1 files changed, 41 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 086d4fe..7254180 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using Nwc.XmlRpc; 36using Nwc.XmlRpc;
36using OpenMetaverse; 37using OpenMetaverse;
@@ -81,7 +82,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
81 - Terminate Friendship messages (single) 82 - Terminate Friendship messages (single)
82 */ 83 */
83 84
84 public class FriendsModule : IRegionModule, IFriendsModule 85 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
86 public class FriendsModule : ISharedRegionModule, IFriendsModule
85 { 87 {
86 private class Transaction 88 private class Transaction
87 { 89 {
@@ -111,9 +113,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
111 113
112 private IGridService m_gridServices = null; 114 private IGridService m_gridServices = null;
113 115
114 #region IRegionModule Members 116 #region ISharedRegionModule Members
115 117
116 public void Initialise(Scene scene, IConfigSource config) 118 public void Initialise(IConfigSource config)
119 {
120
121 }
122
123 public void PostInitialise()
124 {
125 }
126
127 public Type ReplaceableInterface
128 {
129 get { return null; }
130 }
131
132 public void AddRegion(Scene scene)
117 { 133 {
118 lock (m_scenes) 134 lock (m_scenes)
119 { 135 {
@@ -128,9 +144,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
128 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) 144 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
129 m_scenes[scene.RegionInfo.RegionHandle] = scene; 145 m_scenes[scene.RegionInfo.RegionHandle] = scene;
130 } 146 }
131 147
132 scene.RegisterModuleInterface<IFriendsModule>(this); 148 scene.RegisterModuleInterface<IFriendsModule>(this);
133 149
134 scene.EventManager.OnNewClient += OnNewClient; 150 scene.EventManager.OnNewClient += OnNewClient;
135 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 151 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
136 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 152 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@@ -138,29 +154,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
138 scene.EventManager.OnClientClosed += ClientClosed; 154 scene.EventManager.OnClientClosed += ClientClosed;
139 } 155 }
140 156
141 public void PostInitialise() 157 public void RegionLoaded(Scene scene)
142 { 158 {
143 if (m_scenes.Count > 0) 159 if (m_scenes.Count > 0)
144 { 160 {
145 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); 161 m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
146 m_gridServices = m_initialScene.GridService; 162 m_gridServices = scene.GridService;
147 } 163 }
148 if (m_TransferModule == null) 164 if (m_TransferModule == null)
149 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); 165 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
150 } 166 }
151 167
152 public void Close() 168 public void RemoveRegion(Scene scene)
153 { 169 {
170 MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk");
171 MainServer.Instance.RemoveXmlRPCHandler("terminate_friend");
172
173 if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
174 m_scenes.Remove(scene.RegionInfo.RegionHandle);
175
176 scene.UnregisterModuleInterface<IFriendsModule>(this);
177
178 scene.EventManager.OnNewClient -= OnNewClient;
179 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
180 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
181 scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
182 scene.EventManager.OnClientClosed -= ClientClosed;
154 } 183 }
155 184
156 public string Name 185 public void Close()
157 { 186 {
158 get { return "FriendsModule"; }
159 } 187 }
160 188
161 public bool IsSharedModule 189 public string Name
162 { 190 {
163 get { return true; } 191 get { return "FriendsModule"; }
164 } 192 }
165 193
166 #endregion 194 #endregion