diff options
author | Dr Scofield | 2008-10-03 14:53:11 +0000 |
---|---|---|
committer | Dr Scofield | 2008-10-03 14:53:11 +0000 |
commit | 5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a (patch) | |
tree | 529c2c8e3ea8f1193f2495f905e542ff1462adb6 /OpenSim | |
parent | * minor: remove warnings (the code cleaners strike again) (diff) | |
download | opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.zip opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.gz opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.bz2 opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.xz |
This changeset changes the way chat from client is routed:
old way: each region module interested in chat from client had to
- subscribe to scene.EventManager.OnNewClient
- then in its OnNewClient delegate it would subscribe to
client.OnChatFromViewer to capture chat messages coming
new way: ChatModule is the only region module that uses the "old
way" approach but is now forwarding all client chat via
scene.EventManager.OnChatFromClient
- each region module interested in chat from client now only
subscribes to scene.EventManager.OnChatFromClient
this not only simplifies code, but also allows us to substitute
ChatModule with derived classes (ConciergeModule is going to be one
example).
Also, this changeset changes ChatFromViewer to ChatFromClient as it
doesn't necessarily have to be a viewer that is a chat source.
i've taken great care to only comment out those OnNewClient delegates
that were only used for getting at the client chat --- hope it's not
breaking anything.
Diffstat (limited to 'OpenSim')
11 files changed, 215 insertions, 178 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8737c22..d2ee770 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -363,7 +363,7 @@ namespace OpenSim.Framework | |||
363 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] | 363 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] |
364 | event ImprovedInstantMessage OnInstantMessage; | 364 | event ImprovedInstantMessage OnInstantMessage; |
365 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments. Rename OnChat.")] | 365 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments. Rename OnChat.")] |
366 | event ChatMessage OnChatFromViewer; | 366 | event ChatMessage OnChatFromClient; |
367 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] | 367 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] |
368 | event TextureRequest OnRequestTexture; | 368 | event TextureRequest OnRequestTexture; |
369 | // [Obsolete("LLClientView Specific - Remove bitbuckets. Adam, can you be more specific here.. as I don't see any bit buckets.")] | 369 | // [Obsolete("LLClientView Specific - Remove bitbuckets. Adam, can you be more specific here.. as I don't see any bit buckets.")] |
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index fbeb7ba..15701f0 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs | |||
@@ -140,6 +140,11 @@ namespace OpenSim.Framework | |||
140 | set { m_scene = value; } | 140 | set { m_scene = value; } |
141 | } | 141 | } |
142 | 142 | ||
143 | public override string ToString() | ||
144 | { | ||
145 | return m_message; | ||
146 | } | ||
147 | |||
143 | #endregion | 148 | #endregion |
144 | } | 149 | } |
145 | } | 150 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index af760ae..199954e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -124,8 +124,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
124 | private GenericMessage handlerGenericMessage = null; | 124 | private GenericMessage handlerGenericMessage = null; |
125 | private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties; | 125 | private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties; |
126 | private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties; | 126 | private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties; |
127 | private ChatMessage handlerChatFromViewer = null; //OnChatFromViewer; | 127 | private ChatMessage handlerChatFromClient = null; //OnChatFromClient; |
128 | private ChatMessage handlerChatFromViewer2 = null; //OnChatFromViewer; | 128 | private ChatMessage handlerChatFromClient2 = null; //OnChatFromClient; |
129 | private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage; | 129 | private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage; |
130 | private FriendActionDelegate handlerApproveFriendRequest = null; //OnApproveFriendRequest; | 130 | private FriendActionDelegate handlerApproveFriendRequest = null; //OnApproveFriendRequest; |
131 | private FriendshipTermination handlerTerminateFriendship = null; //OnTerminateFriendship; | 131 | private FriendshipTermination handlerTerminateFriendship = null; //OnTerminateFriendship; |
@@ -393,7 +393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
393 | /// <param name="circuitCode"></param> | 393 | /// <param name="circuitCode"></param> |
394 | /// <param name="proxyEP"></param> | 394 | /// <param name="proxyEP"></param> |
395 | public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer, | 395 | public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer, |
396 | AgentCircuitManager authenSessions, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP) | 396 | AgentCircuitManager authenSessions, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP) |
397 | { | 397 | { |
398 | m_moneyBalance = 1000; | 398 | m_moneyBalance = 1000; |
399 | 399 | ||
@@ -833,7 +833,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
833 | public event Action<IClientAPI> OnConnectionClosed; | 833 | public event Action<IClientAPI> OnConnectionClosed; |
834 | public event ViewerEffectEventHandler OnViewerEffect; | 834 | public event ViewerEffectEventHandler OnViewerEffect; |
835 | public event ImprovedInstantMessage OnInstantMessage; | 835 | public event ImprovedInstantMessage OnInstantMessage; |
836 | public event ChatMessage OnChatFromViewer; | 836 | public event ChatMessage OnChatFromClient; |
837 | public event TextureRequest OnRequestTexture; | 837 | public event TextureRequest OnRequestTexture; |
838 | public event RezObject OnRezObject; | 838 | public event RezObject OnRezObject; |
839 | public event GenericCall4 OnDeRezObject; | 839 | public event GenericCall4 OnDeRezObject; |
@@ -4008,7 +4008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4008 | 4008 | ||
4009 | int channel = inchatpack.ChatData.Channel; | 4009 | int channel = inchatpack.ChatData.Channel; |
4010 | 4010 | ||
4011 | if (OnChatFromViewer != null) | 4011 | if (OnChatFromClient != null) |
4012 | { | 4012 | { |
4013 | OSChatMessage args = new OSChatMessage(); | 4013 | OSChatMessage args = new OSChatMessage(); |
4014 | args.Channel = channel; | 4014 | args.Channel = channel; |
@@ -4020,9 +4020,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4020 | args.Scene = Scene; | 4020 | args.Scene = Scene; |
4021 | args.Sender = this; | 4021 | args.Sender = this; |
4022 | 4022 | ||
4023 | handlerChatFromViewer = OnChatFromViewer; | 4023 | handlerChatFromClient = OnChatFromClient; |
4024 | if (handlerChatFromViewer != null) | 4024 | if (handlerChatFromClient != null) |
4025 | handlerChatFromViewer(this, args); | 4025 | handlerChatFromClient(this, args); |
4026 | } | 4026 | } |
4027 | break; | 4027 | break; |
4028 | case PacketType.AvatarPropertiesUpdate: | 4028 | case PacketType.AvatarPropertiesUpdate: |
@@ -4047,7 +4047,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4047 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; | 4047 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; |
4048 | int ch = rdialog.Data.ChatChannel; | 4048 | int ch = rdialog.Data.ChatChannel; |
4049 | byte[] msg = rdialog.Data.ButtonLabel; | 4049 | byte[] msg = rdialog.Data.ButtonLabel; |
4050 | if (OnChatFromViewer != null) | 4050 | if (OnChatFromClient != null) |
4051 | { | 4051 | { |
4052 | OSChatMessage args = new OSChatMessage(); | 4052 | OSChatMessage args = new OSChatMessage(); |
4053 | args.Channel = ch; | 4053 | args.Channel = ch; |
@@ -4057,9 +4057,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4057 | args.Position = new Vector3(); | 4057 | args.Position = new Vector3(); |
4058 | args.Scene = Scene; | 4058 | args.Scene = Scene; |
4059 | args.Sender = this; | 4059 | args.Sender = this; |
4060 | handlerChatFromViewer2 = OnChatFromViewer; | 4060 | handlerChatFromClient2 = OnChatFromClient; |
4061 | if (handlerChatFromViewer2 != null) | 4061 | if (handlerChatFromClient2 != null) |
4062 | handlerChatFromViewer2(this, args); | 4062 | handlerChatFromClient2(this, args); |
4063 | } | 4063 | } |
4064 | 4064 | ||
4065 | break; | 4065 | break; |
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs index 606ce7e..34a604e 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs | |||
@@ -64,26 +64,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
64 | { | 64 | { |
65 | m_scenes.Add(scene); | 65 | m_scenes.Add(scene); |
66 | scene.EventManager.OnNewClient += OnNewClient; | 66 | scene.EventManager.OnNewClient += OnNewClient; |
67 | scene.EventManager.OnChatFromWorld += OnSimChat; | 67 | scene.EventManager.OnChatFromWorld += OnChatFromWorld; |
68 | scene.EventManager.OnChatBroadcast += OnSimBroadcast; | 68 | scene.EventManager.OnChatBroadcast += OnChatBroadcast; |
69 | } | 69 | } |
70 | } | ||
70 | 71 | ||
71 | // wrap this in a try block so that defaults will work if | 72 | // wrap this in a try block so that defaults will work if |
72 | // the config file doesn't specify otherwise. | 73 | // the config file doesn't specify otherwise. |
73 | try | 74 | try |
74 | { | 75 | { |
75 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
76 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
77 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
78 | } | ||
79 | catch (Exception) | ||
80 | { | ||
81 | } | ||
82 | m_log.InfoFormat("[CHAT] initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName, | ||
83 | m_whisperdistance, m_saydistance, m_shoutdistance); | ||
84 | } | 79 | } |
80 | catch (Exception) | ||
81 | { | ||
82 | } | ||
83 | m_log.InfoFormat("[CHAT] initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName, | ||
84 | m_whisperdistance, m_saydistance, m_shoutdistance); | ||
85 | } | 85 | } |
86 | |||
87 | public void PostInitialise() | 86 | public void PostInitialise() |
88 | { | 87 | { |
89 | } | 88 | } |
@@ -104,8 +103,89 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
104 | 103 | ||
105 | #endregion | 104 | #endregion |
106 | 105 | ||
107 | #region ISimChat Members | 106 | |
108 | public void OnSimBroadcast(Object sender, OSChatMessage c) | 107 | public void OnNewClient(IClientAPI client) |
108 | { | ||
109 | try | ||
110 | { | ||
111 | client.OnChatFromClient += OnChatFromClient; | ||
112 | } | ||
113 | catch (Exception ex) | ||
114 | { | ||
115 | m_log.Error("[CHAT]: NewClient exception trap:" + ex.ToString()); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | public virtual void OnChatFromClient(Object sender, OSChatMessage e) | ||
120 | { | ||
121 | // redistribute to interested subscribers | ||
122 | Scene scene = (Scene)e.Scene; | ||
123 | scene.EventManager.TriggerOnChatFromClient(sender, e); | ||
124 | |||
125 | // early return if not on public or debug channel | ||
126 | if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return; | ||
127 | |||
128 | // sanity check: | ||
129 | if (e.Sender == null) | ||
130 | { | ||
131 | m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); | ||
132 | return; | ||
133 | } | ||
134 | |||
135 | string message = e.Message; | ||
136 | if (e.Channel == DEBUG_CHANNEL) e.Type = ChatTypeEnum.DebugChannel; | ||
137 | |||
138 | ScenePresence avatar = scene.GetScenePresence(e.Sender.AgentId); | ||
139 | Vector3 fromPos = avatar.AbsolutePosition; | ||
140 | Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
141 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
142 | string fromName = avatar.Firstname + " " + avatar.Lastname; | ||
143 | UUID fromID = e.Sender.AgentId; | ||
144 | |||
145 | DeliverChatToAvatars(fromPos, regionPos, fromID, fromName, e.Type, ChatSourceType.Agent, message); | ||
146 | } | ||
147 | |||
148 | public void OnChatFromWorld(Object sender, OSChatMessage e) | ||
149 | { | ||
150 | Scene scene = (Scene) e.Scene; | ||
151 | |||
152 | // early return if not on public or debug channel | ||
153 | if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return; | ||
154 | |||
155 | // Filled in since it's easier than rewriting right now. | ||
156 | Vector3 fromPos = e.Position; | ||
157 | Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
158 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
159 | |||
160 | string fromName = e.From; | ||
161 | string message = e.Message; | ||
162 | UUID fromID = e.SenderUUID; | ||
163 | |||
164 | if (e.Channel == DEBUG_CHANNEL) | ||
165 | e.Type = ChatTypeEnum.DebugChannel; | ||
166 | |||
167 | DeliverChatToAvatars(fromPos, regionPos, fromID, fromName, e.Type, ChatSourceType.Object, message); | ||
168 | } | ||
169 | |||
170 | protected void DeliverChatToAvatars(Vector3 pos, Vector3 regionPos, UUID uuid, string name, | ||
171 | ChatTypeEnum chatType, ChatSourceType sourceType, string message) | ||
172 | { | ||
173 | // iterate over message | ||
174 | if (message.Length >= 1000) // libomv limit | ||
175 | message = message.Substring(0, 1000); | ||
176 | |||
177 | foreach (Scene s in m_scenes) | ||
178 | { | ||
179 | s.ForEachScenePresence(delegate(ScenePresence presence) | ||
180 | { | ||
181 | TrySendChatMessage(presence, pos, regionPos, uuid, name, | ||
182 | chatType, message, sourceType); | ||
183 | }); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | |||
188 | public void OnChatBroadcast(Object sender, OSChatMessage c) | ||
109 | { | 189 | { |
110 | // We only want to relay stuff on channel 0 and on the debug channel | 190 | // We only want to relay stuff on channel 0 and on the debug channel |
111 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return; | 191 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return; |
@@ -153,83 +233,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
153 | }); | 233 | }); |
154 | } | 234 | } |
155 | 235 | ||
156 | public void OnSimChat(Object sender, OSChatMessage e) | ||
157 | { | ||
158 | // early return if not on public or debug channel | ||
159 | if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return; | ||
160 | |||
161 | ScenePresence avatar = null; | ||
162 | Scene scene = (Scene) e.Scene; | ||
163 | |||
164 | //TODO: Remove the need for this check | ||
165 | if (scene == null) | ||
166 | scene = m_scenes[0]; | ||
167 | |||
168 | // Filled in since it's easier than rewriting right now. | ||
169 | Vector3 fromPos = e.Position; | ||
170 | Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
171 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
172 | |||
173 | string fromName = e.From; | ||
174 | string message = e.Message; | ||
175 | UUID fromID = e.SenderUUID; | ||
176 | |||
177 | if (message.Length >= 1000) // libomv limit | ||
178 | message = message.Substring(0, 1000); | ||
179 | |||
180 | if (e.Sender != null) | ||
181 | { | ||
182 | avatar = scene.GetScenePresence(e.Sender.AgentId); | ||
183 | } | ||
184 | |||
185 | if (avatar != null) | ||
186 | { | ||
187 | fromPos = avatar.AbsolutePosition; | ||
188 | regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | ||
189 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | ||
190 | fromName = avatar.Firstname + " " + avatar.Lastname; | ||
191 | fromID = e.Sender.AgentId; | ||
192 | } | ||
193 | |||
194 | if (e.Channel == DEBUG_CHANNEL) | ||
195 | e.Type = ChatTypeEnum.DebugChannel; | ||
196 | |||
197 | // chat works by redistributing every incoming chat | ||
198 | // message to each avatar in the scene | ||
199 | foreach (Scene s in m_scenes) | ||
200 | { | ||
201 | s.ForEachScenePresence( | ||
202 | delegate(ScenePresence presence) | ||
203 | { | ||
204 | if (e.Channel == DEBUG_CHANNEL) | ||
205 | { | ||
206 | TrySendChatMessage(presence, fromPos, regionPos, | ||
207 | fromID, fromName, e.Type, | ||
208 | message, ChatSourceType.Object); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | TrySendChatMessage(presence, fromPos, regionPos, | ||
213 | fromID, fromName, e.Type, | ||
214 | message, ChatSourceType.Agent); | ||
215 | } | ||
216 | }); | ||
217 | } | ||
218 | } | ||
219 | |||
220 | #endregion | ||
221 | |||
222 | public void OnNewClient(IClientAPI client) | ||
223 | { | ||
224 | try | ||
225 | { | ||
226 | client.OnChatFromViewer += OnSimChat; | ||
227 | } | ||
228 | catch (Exception ex) | ||
229 | { | ||
230 | m_log.Error("[CHAT]: NewClient exception trap:" + ex.ToString()); | ||
231 | } | ||
232 | } | ||
233 | 236 | ||
234 | private void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 237 | private void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
235 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 238 | UUID fromAgentID, string fromName, ChatTypeEnum type, |
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index eba65a9..5840cb2 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs | |||
@@ -93,6 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
93 | m_scenes.Add(scene); | 93 | m_scenes.Add(scene); |
94 | scene.EventManager.OnNewClient += OnNewClient; | 94 | scene.EventManager.OnNewClient += OnNewClient; |
95 | scene.EventManager.OnChatFromWorld += OnSimChat; | 95 | scene.EventManager.OnChatFromWorld += OnSimChat; |
96 | scene.EventManager.OnChatFromClient += OnSimChat; | ||
96 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | 97 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; |
97 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; | 98 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; |
98 | } | 99 | } |
@@ -236,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
236 | 237 | ||
237 | if (avatar != null) | 238 | if (avatar != null) |
238 | { | 239 | { |
239 | fromName = avatar.Firstname + " " + avatar.Lastname; | 240 | fromName = avatar.Name; |
240 | } | 241 | } |
241 | 242 | ||
242 | // Try to reconnect to server if not connected | 243 | // Try to reconnect to server if not connected |
@@ -277,21 +278,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
277 | { | 278 | { |
278 | try | 279 | try |
279 | { | 280 | { |
280 | string clientName = String.Format("{0} {1}", client.FirstName, client.LastName); | 281 | // client.OnChatFromViewer += OnSimChat; |
281 | |||
282 | client.OnChatFromViewer += OnSimChat; | ||
283 | client.OnLogout += OnClientLoggedOut; | 282 | client.OnLogout += OnClientLoggedOut; |
284 | client.OnConnectionClosed += OnClientLoggedOut; | 283 | client.OnConnectionClosed += OnClientLoggedOut; |
285 | 284 | ||
286 | if (clientName != m_last_new_user) | 285 | if (client.Name != m_last_new_user) |
287 | { | 286 | { |
288 | if ((m_irc.Enabled) && (m_irc.Connected)) | 287 | if ((m_irc.Enabled) && (m_irc.Connected)) |
289 | { | 288 | { |
290 | m_log.DebugFormat("[IRC] {0} logging on", clientName); | 289 | m_log.DebugFormat("[IRC] {0} logging on", client.Name); |
291 | m_irc.PrivMsg(m_irc.Nick, "Sim", | 290 | m_irc.PrivMsg(m_irc.Nick, "Sim", |
292 | String.Format("notices {0} logging on", clientName)); | 291 | String.Format("notices {0} logging on", client.Name)); |
293 | } | 292 | } |
294 | m_last_new_user = clientName; | 293 | m_last_new_user = client.Name; |
295 | } | 294 | } |
296 | } | 295 | } |
297 | catch (Exception ex) | 296 | catch (Exception ex) |
@@ -343,21 +342,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
343 | { | 342 | { |
344 | if ((m_irc.Enabled) && (m_irc.Connected)) | 343 | if ((m_irc.Enabled) && (m_irc.Connected)) |
345 | { | 344 | { |
346 | string clientName = String.Format("{0} {1}", client.FirstName, client.LastName); | ||
347 | // handles simple case. May not work for hundred connecting in per second. | 345 | // handles simple case. May not work for hundred connecting in per second. |
348 | // and the NewClients calles getting interleved | 346 | // and the NewClients calles getting interleved |
349 | // but filters out multiple reports | 347 | // but filters out multiple reports |
350 | if (clientName != m_last_leaving_user) | 348 | if (client.Name != m_last_leaving_user) |
351 | { | 349 | { |
352 | Console.WriteLine("Avatar was seen logging out."); | 350 | Console.WriteLine("Avatar was seen logging out."); |
353 | //Console.ReadLine(); | 351 | //Console.ReadLine(); |
354 | Console.WriteLine(); | 352 | Console.WriteLine(); |
355 | m_last_leaving_user = clientName; | 353 | m_last_leaving_user = client.Name; |
356 | m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", clientName)); | 354 | m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", client.Name)); |
357 | m_log.InfoFormat("[IRC]: {0} logging out", clientName); | 355 | m_log.InfoFormat("[IRC]: {0} logging out", client.Name); |
358 | } | 356 | } |
359 | 357 | ||
360 | if (m_last_new_user == clientName) | 358 | if (m_last_new_user == client.Name) |
361 | m_last_new_user = null; | 359 | m_last_new_user = null; |
362 | } | 360 | } |
363 | } | 361 | } |
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs index 0c0f553..d9730dd 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
50 | private int _conciergeChannel = 42; | 50 | private int _conciergeChannel = 42; |
51 | private List<Scene> _scenes = new List<Scene>(); | 51 | private List<Scene> _scenes = new List<Scene>(); |
52 | private IConfig _config; | 52 | private IConfig _config; |
53 | private string _whoami = null; | 53 | private string _whoami = "conferencier"; |
54 | 54 | ||
55 | internal object _syncy = new object(); | 55 | internal object _syncy = new object(); |
56 | 56 | ||
@@ -78,8 +78,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
78 | return; | 78 | return; |
79 | } | 79 | } |
80 | 80 | ||
81 | _conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", _conciergeChannel); | 81 | if (_config != null) |
82 | _whoami = _config.GetString("concierge_name", "conferencier"); | 82 | { |
83 | _conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", _conciergeChannel); | ||
84 | _whoami = _config.GetString("whoami", "conferencier"); | ||
85 | } | ||
86 | _log.InfoFormat("[Concierge] reporting as \"{0}\" to our users", _whoami); | ||
83 | 87 | ||
84 | lock (_syncy) | 88 | lock (_syncy) |
85 | { | 89 | { |
@@ -88,8 +92,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
88 | _scenes.Add(scene); | 92 | _scenes.Add(scene); |
89 | // subscribe to NewClient events | 93 | // subscribe to NewClient events |
90 | scene.EventManager.OnNewClient += OnNewClient; | 94 | scene.EventManager.OnNewClient += OnNewClient; |
95 | scene.EventManager.OnNewClient += OnNewClient; | ||
91 | 96 | ||
92 | // subscribe to *Chat events | 97 | // subscribe to *Chat events and FilterChat* events |
93 | scene.EventManager.OnChatFromWorld += OnSimChat; | 98 | scene.EventManager.OnChatFromWorld += OnSimChat; |
94 | scene.EventManager.OnChatBroadcast += OnSimBroadcast; | 99 | scene.EventManager.OnChatBroadcast += OnSimBroadcast; |
95 | 100 | ||
@@ -124,18 +129,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
124 | #region ISimChat Members | 129 | #region ISimChat Members |
125 | public void OnSimBroadcast(Object sender, OSChatMessage c) | 130 | public void OnSimBroadcast(Object sender, OSChatMessage c) |
126 | { | 131 | { |
127 | if (_conciergeChannel == c.Channel) | 132 | // log to buffer? |
128 | { | ||
129 | // concierge request: interpret | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | if (0 == c.Channel || DEBUG_CHANNEL == c.Channel) | ||
134 | { | ||
135 | // log as avatar/prim chat | ||
136 | return; | ||
137 | } | ||
138 | |||
139 | return; | 133 | return; |
140 | } | 134 | } |
141 | 135 | ||
@@ -149,6 +143,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
149 | 143 | ||
150 | if (0 == c.Channel || DEBUG_CHANNEL == c.Channel) | 144 | if (0 == c.Channel || DEBUG_CHANNEL == c.Channel) |
151 | { | 145 | { |
146 | // if (_amplify) | ||
147 | // { | ||
148 | |||
149 | // } | ||
150 | |||
152 | // log as avatar/prim chat | 151 | // log as avatar/prim chat |
153 | return; | 152 | return; |
154 | } | 153 | } |
@@ -161,14 +160,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
161 | 160 | ||
162 | public void OnNewClient(IClientAPI client) | 161 | public void OnNewClient(IClientAPI client) |
163 | { | 162 | { |
164 | try | 163 | client.OnLogout += OnClientLoggedOut; |
165 | { | 164 | client.OnConnectionClosed += OnClientLoggedOut; |
166 | client.OnChatFromViewer += OnSimChat; | 165 | |
167 | } | 166 | _log.DebugFormat("[Concierge] {0} logs on to {1}", client.Name, client.Scene.RegionInfo.RegionName); |
168 | catch (Exception ex) | 167 | AnnounceToAgentsRegion(client, String.Format("{0} logs on to {1}", client.Name, client.Scene.RegionInfo.RegionName)); |
169 | { | 168 | } |
170 | _log.Error("[Concierge]: NewClient exception trap:" + ex.ToString()); | 169 | |
171 | } | 170 | public void OnClientLoggedOut(IClientAPI client) |
171 | { | ||
172 | client.OnLogout -= OnClientLoggedOut; | ||
173 | client.OnConnectionClosed -= OnClientLoggedOut; | ||
174 | |||
175 | _log.DebugFormat("[Concierge] {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); | ||
176 | AnnounceToAgentsRegion(client, String.Format("{0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName)); | ||
172 | } | 177 | } |
173 | 178 | ||
174 | 179 | ||
@@ -188,13 +193,22 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
188 | 193 | ||
189 | public void ClientLoggedOut(IClientAPI client) | 194 | public void ClientLoggedOut(IClientAPI client) |
190 | { | 195 | { |
191 | string clientName = String.Format("{0} {1}", client.FirstName, client.LastName); | 196 | _log.DebugFormat("[Concierge] {0} logs out of {1}", client.Name, client.Scene.RegionInfo.RegionName); |
192 | _log.DebugFormat("[CONCIERGE] {0} logging off.", clientName); | 197 | AnnounceToAgentsRegion(client, String.Format("{0} logs out of {1}", client.Name, client.Scene.RegionInfo.RegionName)); |
193 | } | 198 | } |
194 | 199 | ||
195 | 200 | ||
196 | static private Vector3 posOfGod = new Vector3(128, 128, 9999); | 201 | static private Vector3 posOfGod = new Vector3(128, 128, 9999); |
197 | 202 | ||
203 | protected void AnnounceToAgentsRegion(IClientAPI client, string msg) | ||
204 | { | ||
205 | ScenePresence agent = null; | ||
206 | if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) | ||
207 | AnnounceToAgentsRegion(agent, msg); | ||
208 | else | ||
209 | _log.DebugFormat("[Concierge] could not find an agent for client {0}", client.Name); | ||
210 | } | ||
211 | |||
198 | protected void AnnounceToAgentsRegion(ScenePresence scenePresence, string msg) | 212 | protected void AnnounceToAgentsRegion(ScenePresence scenePresence, string msg) |
199 | { | 213 | { |
200 | OSChatMessage c = new OSChatMessage(); | 214 | OSChatMessage c = new OSChatMessage(); |
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs index cdd4f4e..6eaaacd 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs | |||
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
381 | protected void StartManaging(IClientAPI client) | 381 | protected void StartManaging(IClientAPI client) |
382 | { | 382 | { |
383 | m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services."); | 383 | m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services."); |
384 | client.OnChatFromViewer += SimChatSent; | 384 | // client.OnChatFromClient += SimChatSent; |
385 | //init = true; | 385 | //init = true; |
386 | 386 | ||
387 | OnNewClient(client); | 387 | OnNewClient(client); |
@@ -412,7 +412,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
412 | { | 412 | { |
413 | IClientAPI client = presence.ControllingClient; | 413 | IClientAPI client = presence.ControllingClient; |
414 | m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services."); | 414 | m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services."); |
415 | client.OnChatFromViewer -= SimChatSent; | 415 | // client.OnChatFromViewer -= SimChatSent; |
416 | 416 | ||
417 | m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client"); | 417 | m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client"); |
418 | client.OnUpdatePrimScale -= UpdateSingleScale; | 418 | client.OnUpdatePrimScale -= UpdateSingleScale; |
@@ -641,6 +641,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
641 | m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System."); | 641 | m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System."); |
642 | 642 | ||
643 | scene.EventManager.OnNewClient += StartManaging; | 643 | scene.EventManager.OnNewClient += StartManaging; |
644 | scene.EventManager.OnChatFromClient += SimChatSent; | ||
644 | scene.EventManager.OnRemovePresence += StopManaging; | 645 | scene.EventManager.OnRemovePresence += StopManaging; |
645 | // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 646 | // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
646 | scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted; | 647 | scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted; |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs index ae5eefc..f5ec389 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
116 | m_scene = scene; | 116 | m_scene = scene; |
117 | m_scene.RegisterModuleInterface<IWorldComm>(this); | 117 | m_scene.RegisterModuleInterface<IWorldComm>(this); |
118 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | 118 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); |
119 | m_scene.EventManager.OnNewClient += NewClient; | 119 | m_scene.EventManager.OnChatFromClient += DeliverClientMessage; |
120 | m_pendingQ = new Queue(); | 120 | m_pendingQ = new Queue(); |
121 | m_pending = Queue.Synchronized(m_pendingQ); | 121 | m_pending = Queue.Synchronized(m_pendingQ); |
122 | } | 122 | } |
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
203 | /// enqueue the message for delivery to the objects listen event handler. | 203 | /// enqueue the message for delivery to the objects listen event handler. |
204 | /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. | 204 | /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. |
205 | /// Objects that do an llSay have their messages delivered here and for nearby avatars, | 205 | /// Objects that do an llSay have their messages delivered here and for nearby avatars, |
206 | /// the OnChatFromViewer event is used. | 206 | /// the OnChatFromClient event is used. |
207 | /// </summary> | 207 | /// </summary> |
208 | /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> | 208 | /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> |
209 | /// <param name="channel">channel to sent on</param> | 209 | /// <param name="channel">channel to sent on</param> |
@@ -311,10 +311,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
311 | 311 | ||
312 | #endregion | 312 | #endregion |
313 | 313 | ||
314 | private void NewClient(IClientAPI client) | 314 | // private void NewClient(IClientAPI client) |
315 | { | 315 | // { |
316 | client.OnChatFromViewer += DeliverClientMessage; | 316 | // client.OnChatFromViewer += DeliverClientMessage; |
317 | } | 317 | // } |
318 | 318 | ||
319 | /******************************************************************** | 319 | /******************************************************************** |
320 | * | 320 | * |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 78aee92..33eade2 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -59,22 +59,22 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
59 | 59 | ||
60 | public void Say(string message) | 60 | public void Say(string message) |
61 | { | 61 | { |
62 | SendOnChatFromViewer(message, ChatTypeEnum.Say); | 62 | SendOnChatFromClient(message, ChatTypeEnum.Say); |
63 | } | 63 | } |
64 | 64 | ||
65 | public void Shout(string message) | 65 | public void Shout(string message) |
66 | { | 66 | { |
67 | SendOnChatFromViewer(message, ChatTypeEnum.Shout); | 67 | SendOnChatFromClient(message, ChatTypeEnum.Shout); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void Whisper(string message) | 70 | public void Whisper(string message) |
71 | { | 71 | { |
72 | SendOnChatFromViewer(message, ChatTypeEnum.Whisper); | 72 | SendOnChatFromClient(message, ChatTypeEnum.Whisper); |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Broadcast(string message) | 75 | public void Broadcast(string message) |
76 | { | 76 | { |
77 | SendOnChatFromViewer(message, ChatTypeEnum.Broadcast); | 77 | SendOnChatFromClient(message, ChatTypeEnum.Broadcast); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void GiveMoney(UUID target, int amount) | 80 | public void GiveMoney(UUID target, int amount) |
@@ -132,19 +132,19 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
132 | 132 | ||
133 | #region Internal Functions | 133 | #region Internal Functions |
134 | 134 | ||
135 | private void SendOnChatFromViewer(string message, ChatTypeEnum chatType) | 135 | private void SendOnChatFromClient(string message, ChatTypeEnum chatType) |
136 | { | 136 | { |
137 | OSChatMessage chatFromViewer = new OSChatMessage(); | 137 | OSChatMessage chatFromClient = new OSChatMessage(); |
138 | chatFromViewer.Channel = 0; | 138 | chatFromClient.Channel = 0; |
139 | chatFromViewer.From = Name; | 139 | chatFromClient.From = Name; |
140 | chatFromViewer.Message = message; | 140 | chatFromClient.Message = message; |
141 | chatFromViewer.Position = StartPos; | 141 | chatFromClient.Position = StartPos; |
142 | chatFromViewer.Scene = m_scene; | 142 | chatFromClient.Scene = m_scene; |
143 | chatFromViewer.Sender = this; | 143 | chatFromClient.Sender = this; |
144 | chatFromViewer.SenderUUID = AgentId; | 144 | chatFromClient.SenderUUID = AgentId; |
145 | chatFromViewer.Type = chatType; | 145 | chatFromClient.Type = chatType; |
146 | 146 | ||
147 | OnChatFromViewer(this, chatFromViewer); | 147 | OnChatFromClient(this, chatFromClient); |
148 | } | 148 | } |
149 | 149 | ||
150 | #endregion | 150 | #endregion |
@@ -161,7 +161,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
161 | public event Action<IClientAPI> OnConnectionClosed; | 161 | public event Action<IClientAPI> OnConnectionClosed; |
162 | public event GenericMessage OnGenericMessage; | 162 | public event GenericMessage OnGenericMessage; |
163 | public event ImprovedInstantMessage OnInstantMessage; | 163 | public event ImprovedInstantMessage OnInstantMessage; |
164 | public event ChatMessage OnChatFromViewer; | 164 | public event ChatMessage OnChatFromClient; |
165 | public event TextureRequest OnRequestTexture; | 165 | public event TextureRequest OnRequestTexture; |
166 | public event RezObject OnRezObject; | 166 | public event RezObject OnRezObject; |
167 | public event ModifyTerrain OnModifyTerrain; | 167 | public event ModifyTerrain OnModifyTerrain; |
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 87f3de1..c629faf 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -230,14 +230,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
230 | public event DeregisterCapsEvent OnDeregisterCaps; | 230 | public event DeregisterCapsEvent OnDeregisterCaps; |
231 | /// <summary> | 231 | /// <summary> |
232 | /// ChatFromWorldEvent is called via Scene when a chat message | 232 | /// ChatFromWorldEvent is called via Scene when a chat message |
233 | /// from world comes in (chat from viewer is available via | 233 | /// from world comes in. |
234 | /// client.OnChatFromViewer). | ||
235 | /// </summary> | 234 | /// </summary> |
236 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); | 235 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); |
237 | public event ChatFromWorldEvent OnChatFromWorld; | 236 | public event ChatFromWorldEvent OnChatFromWorld; |
238 | /// <summary> | 237 | /// <summary> |
238 | /// ChatFromClientEvent is triggered via ChatModule (or | ||
239 | /// substitutes thereof) when a chat message | ||
240 | /// from the client comes in. | ||
241 | /// </summary> | ||
242 | public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat); | ||
243 | public event ChatFromClientEvent OnChatFromClient; | ||
244 | /// <summary> | ||
239 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message | 245 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message |
240 | /// from world comes in (chat from viewer is available via client.OnChatFromViewer). | 246 | /// from world comes in |
241 | /// </summary> | 247 | /// </summary> |
242 | public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat); | 248 | public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat); |
243 | public event ChatBroadcastEvent OnChatBroadcast; | 249 | public event ChatBroadcastEvent OnChatBroadcast; |
@@ -349,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
349 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 355 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
350 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | 356 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; |
351 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; | 357 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; |
358 | private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient; | ||
352 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; | 359 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; |
353 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | 360 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; |
354 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight | 361 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight |
@@ -772,6 +779,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
772 | } | 779 | } |
773 | } | 780 | } |
774 | 781 | ||
782 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) | ||
783 | { | ||
784 | handlerChatFromClient = OnChatFromClient; | ||
785 | if (handlerChatFromClient != null) | ||
786 | { | ||
787 | handlerChatFromClient(sender, chat); | ||
788 | } | ||
789 | } | ||
790 | |||
775 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) | 791 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) |
776 | { | 792 | { |
777 | handlerChatBroadcast = OnChatBroadcast; | 793 | handlerChatBroadcast = OnChatBroadcast; |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 6d69247..fa6ff22 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
55 | public event Action<IClientAPI> OnConnectionClosed; | 55 | public event Action<IClientAPI> OnConnectionClosed; |
56 | 56 | ||
57 | public event ImprovedInstantMessage OnInstantMessage; | 57 | public event ImprovedInstantMessage OnInstantMessage; |
58 | public event ChatMessage OnChatFromViewer; | 58 | public event ChatMessage OnChatFromClient; |
59 | public event TextureRequest OnRequestTexture; | 59 | public event TextureRequest OnRequestTexture; |
60 | public event RezObject OnRezObject; | 60 | public event RezObject OnRezObject; |
61 | public event ModifyTerrain OnModifyTerrain; | 61 | public event ModifyTerrain OnModifyTerrain; |
@@ -696,7 +696,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
696 | 696 | ||
697 | if (count >= 10) | 697 | if (count >= 10) |
698 | { | 698 | { |
699 | if (OnChatFromViewer != null) | 699 | if (OnChatFromClient != null) |
700 | { | 700 | { |
701 | OSChatMessage args = new OSChatMessage(); | 701 | OSChatMessage args = new OSChatMessage(); |
702 | args.Message = "Hey You! Get out of my Home. This is my Region"; | 702 | args.Message = "Hey You! Get out of my Home. This is my Region"; |
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
706 | args.Sender = this; | 706 | args.Sender = this; |
707 | args.Type = ChatTypeEnum.Shout; | 707 | args.Type = ChatTypeEnum.Shout; |
708 | 708 | ||
709 | OnChatFromViewer(this, args); | 709 | OnChatFromClient(this, args); |
710 | } | 710 | } |
711 | count = -1; | 711 | count = -1; |
712 | } | 712 | } |