diff options
author | Melanie | 2009-12-28 01:24:15 +0000 |
---|---|---|
committer | Melanie | 2009-12-28 01:24:15 +0000 |
commit | eebddcd5e693a4b56af326546d4222bd594286e0 (patch) | |
tree | b36b509696710a9082627962101323aa562fc552 /OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |
parent | Allow lists to be embedded in query strings (diff) | |
download | opensim-SC-eebddcd5e693a4b56af326546d4222bd594286e0.zip opensim-SC-eebddcd5e693a4b56af326546d4222bd594286e0.tar.gz opensim-SC-eebddcd5e693a4b56af326546d4222bd594286e0.tar.bz2 opensim-SC-eebddcd5e693a4b56af326546d4222bd594286e0.tar.xz |
Change FriendsModule, InstantMessageModule, MessageTransferModule, MuteListModule, OfflineMessageModule, PresenceModule, InventoryTransferModule and LureModule to new style. Reduce FriendsModule and PresenceModule to shells.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index e5159b3..b5019f1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -40,18 +40,17 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
42 | { | 42 | { |
43 | public class MessageTransferModule : IRegionModule, IMessageTransferModule | 43 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | // private bool m_Enabled = false; | 47 | private bool m_Enabled = false; |
48 | protected bool m_Gridmode = false; | ||
49 | protected List<Scene> m_Scenes = new List<Scene>(); | 48 | protected List<Scene> m_Scenes = new List<Scene>(); |
50 | protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); | 49 | protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); |
51 | 50 | ||
52 | public event UndeliveredMessage OnUndeliveredMessage; | 51 | public event UndeliveredMessage OnUndeliveredMessage; |
53 | 52 | ||
54 | public virtual void Initialise(Scene scene, IConfigSource config) | 53 | public virtual void Initialise(IConfigSource config) |
55 | { | 54 | { |
56 | IConfig cnf = config.Configs["Messaging"]; | 55 | IConfig cnf = config.Configs["Messaging"]; |
57 | if (cnf != null && cnf.GetString( | 56 | if (cnf != null && cnf.GetString( |
@@ -62,20 +61,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
62 | return; | 61 | return; |
63 | } | 62 | } |
64 | 63 | ||
65 | cnf = config.Configs["Startup"]; | 64 | MainServer.Instance.AddXmlRPCHandler( |
66 | if (cnf != null) | 65 | "grid_instant_message", processXMLRPCGridInstantMessage); |
67 | m_Gridmode = cnf.GetBoolean("gridmode", false); | ||
68 | 66 | ||
69 | // m_Enabled = true; | 67 | m_Enabled = true; |
68 | } | ||
69 | |||
70 | public virtual void AddRegion(Scene scene) | ||
71 | { | ||
72 | if (!m_Enabled) | ||
73 | return; | ||
70 | 74 | ||
71 | lock (m_Scenes) | 75 | lock (m_Scenes) |
72 | { | 76 | { |
73 | if (m_Scenes.Count == 0) | ||
74 | { | ||
75 | MainServer.Instance.AddXmlRPCHandler( | ||
76 | "grid_instant_message", processXMLRPCGridInstantMessage); | ||
77 | } | ||
78 | |||
79 | m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); | 77 | m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); |
80 | scene.RegisterModuleInterface<IMessageTransferModule>(this); | 78 | scene.RegisterModuleInterface<IMessageTransferModule>(this); |
81 | m_Scenes.Add(scene); | 79 | m_Scenes.Add(scene); |
@@ -86,6 +84,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
86 | { | 84 | { |
87 | } | 85 | } |
88 | 86 | ||
87 | public virtual void RegionLoaded(Scene scene) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | public virtual void RemoveRegion(Scene scene) | ||
92 | { | ||
93 | if (!m_Enabled) | ||
94 | return; | ||
95 | |||
96 | lock(m_Scenes) | ||
97 | { | ||
98 | m_Scenes.Remove(scene); | ||
99 | } | ||
100 | } | ||
101 | |||
89 | public virtual void Close() | 102 | public virtual void Close() |
90 | { | 103 | { |
91 | } | 104 | } |
@@ -95,9 +108,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
95 | get { return "MessageTransferModule"; } | 108 | get { return "MessageTransferModule"; } |
96 | } | 109 | } |
97 | 110 | ||
98 | public virtual bool IsSharedModule | 111 | public virtual Type ReplaceableInterface |
99 | { | 112 | { |
100 | get { return true; } | 113 | get { return null; } |
101 | } | 114 | } |
102 | 115 | ||
103 | public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) | 116 | public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) |
@@ -148,15 +161,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
148 | } | 161 | } |
149 | } | 162 | } |
150 | 163 | ||
151 | if (m_Gridmode) | 164 | SendGridInstantMessageViaXMLRPC(im, result); |
152 | { | ||
153 | //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid"); | ||
154 | // Still here, try send via Grid | ||
155 | SendGridInstantMessageViaXMLRPC(im, result); | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | HandleUndeliveredMessage(im, result); | ||
160 | 165 | ||
161 | return; | 166 | return; |
162 | } | 167 | } |