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/Region/Environment/Modules | |
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/Region/Environment/Modules')
6 files changed, 175 insertions, 159 deletions
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; |