aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
diff options
context:
space:
mode:
authorMelanie2010-01-26 14:53:14 +0000
committerMelanie2010-01-26 14:53:14 +0000
commitb80ea002654bd0ab232aee2b0f842be18b8d4edc (patch)
tree35971637efd7ec9cbfaee88bc5ea56edffddfc1b /OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
parentReplace dome tabs with spaces (diff)
downloadopensim-SC-b80ea002654bd0ab232aee2b0f842be18b8d4edc.zip
opensim-SC-b80ea002654bd0ab232aee2b0f842be18b8d4edc.tar.gz
opensim-SC-b80ea002654bd0ab232aee2b0f842be18b8d4edc.tar.bz2
opensim-SC-b80ea002654bd0ab232aee2b0f842be18b8d4edc.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs54
1 files changed, 37 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index e5159b3..16bdfdd 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -40,7 +41,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 41
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 43{
43 public class MessageTransferModule : IRegionModule, IMessageTransferModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule
44 { 46 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 48
@@ -50,8 +52,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
50 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); 52 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
51 53
52 public event UndeliveredMessage OnUndeliveredMessage; 54 public event UndeliveredMessage OnUndeliveredMessage;
55 private bool m_enabled = true;
53 56
54 public virtual void Initialise(Scene scene, IConfigSource config) 57 public virtual void Initialise(IConfigSource config)
55 { 58 {
56 IConfig cnf = config.Configs["Messaging"]; 59 IConfig cnf = config.Configs["Messaging"];
57 if (cnf != null && cnf.GetString( 60 if (cnf != null && cnf.GetString(
@@ -59,29 +62,51 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
59 "MessageTransferModule") 62 "MessageTransferModule")
60 { 63 {
61 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); 64 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration");
62 return; 65 m_enabled = false;
63 } 66 }
64 67
65 cnf = config.Configs["Startup"]; 68 cnf = config.Configs["Startup"];
66 if (cnf != null) 69 if (cnf != null)
67 m_Gridmode = cnf.GetBoolean("gridmode", false); 70 m_Gridmode = cnf.GetBoolean("gridmode", false);
71 }
68 72
69 // m_Enabled = true; 73 public Type ReplaceableInterface
74 {
75 get { return null; }
76 }
70 77
71 lock (m_Scenes) 78 public void AddRegion(Scene scene)
79 {
80 if (m_enabled)
72 { 81 {
73 if (m_Scenes.Count == 0) 82 lock (m_Scenes)
74 { 83 {
75 MainServer.Instance.AddXmlRPCHandler( 84 if (m_Scenes.Count == 0)
76 "grid_instant_message", processXMLRPCGridInstantMessage); 85 {
77 } 86 MainServer.Instance.AddXmlRPCHandler(
87 "grid_instant_message", processXMLRPCGridInstantMessage);
88 }
78 89
79 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); 90 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
80 scene.RegisterModuleInterface<IMessageTransferModule>(this); 91 scene.RegisterModuleInterface<IMessageTransferModule>(this);
81 m_Scenes.Add(scene); 92 m_Scenes.Add(scene);
93 }
82 } 94 }
83 } 95 }
84 96
97 public void RegionLoaded(Scene scene)
98 {
99 }
100
101 public void RemoveRegion(Scene scene)
102 {
103 if (m_Scenes.Contains(scene))
104 m_Scenes.Remove(scene);
105 MainServer.Instance.RemoveXmlRPCHandler(
106 "grid_instant_message");
107 scene.UnregisterModuleInterface<IMessageTransferModule>(this);
108 }
109
85 public virtual void PostInitialise() 110 public virtual void PostInitialise()
86 { 111 {
87 } 112 }
@@ -95,11 +120,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
95 get { return "MessageTransferModule"; } 120 get { return "MessageTransferModule"; }
96 } 121 }
97 122
98 public virtual bool IsSharedModule
99 {
100 get { return true; }
101 }
102
103 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) 123 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
104 { 124 {
105 UUID toAgentID = new UUID(im.toAgentID); 125 UUID toAgentID = new UUID(im.toAgentID);