diff options
author | Dr Scofield | 2008-05-26 15:37:31 +0000 |
---|---|---|
committer | Dr Scofield | 2008-05-26 15:37:31 +0000 |
commit | 1bb1d5d9b06887380eec0696102eb859f04810e6 (patch) | |
tree | fecd69763a3daeba464a1bcbc1349828dd9445b3 /OpenSim/Region/Environment | |
parent | Adding OnChatBroadcast event logic to EventManager providing (diff) | |
download | opensim-SC_OLD-1bb1d5d9b06887380eec0696102eb859f04810e6.zip opensim-SC_OLD-1bb1d5d9b06887380eec0696102eb859f04810e6.tar.gz opensim-SC_OLD-1bb1d5d9b06887380eec0696102eb859f04810e6.tar.bz2 opensim-SC_OLD-1bb1d5d9b06887380eec0696102eb859f04810e6.tar.xz |
This cleans up a merge mess from the earlier checkin and implements llOwnerSay()
via the newly created Scene.SimBroadcast() call.
Diffstat (limited to 'OpenSim/Region/Environment')
4 files changed, 73 insertions, 53 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs index e12588c..c3fc26e 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
107 | #region ISimChat Members | 107 | #region ISimChat Members |
108 | public void SimBroadcast(Object sender, ChatFromViewerArgs c) | 108 | public void SimBroadcast(Object sender, ChatFromViewerArgs c) |
109 | { | 109 | { |
110 | // We only want to relay stuff on channel 0 | 110 | // We only want to relay stuff on channel 0 and on the debug channel |
111 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return; | 111 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return; |
112 | 112 | ||
113 | if (c.Channel == DEBUG_CHANNEL) | 113 | if (c.Channel == DEBUG_CHANNEL) |
@@ -118,13 +118,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
118 | LLVector3 pos = new LLVector3(128, 128, 30); | 118 | LLVector3 pos = new LLVector3(128, 128, 30); |
119 | ((Scene)c.Scene).ForEachScenePresence(delegate(ScenePresence presence) | 119 | ((Scene)c.Scene).ForEachScenePresence(delegate(ScenePresence presence) |
120 | { | 120 | { |
121 | if (!presence.IsChildAgent) return; | 121 | if (presence.IsChildAgent) return; |
122 | |||
123 | IClientAPI client = presence.ControllingClient; | ||
124 | |||
125 | if ((c.Type == ChatTypeEnum.Owner) && | ||
126 | (null != c.SenderObject) && | ||
127 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | ||
128 | return; | ||
122 | 129 | ||
123 | presence.ControllingClient.SendChatMessage(c.Message, | 130 | if (null == c.SenderObject) |
124 | 1, //255, | 131 | client.SendChatMessage(c.Message, (byte)c.Type, |
125 | pos, c.From, LLUUID.Zero, | 132 | pos, c.From, LLUUID.Zero, |
126 | c.Channel == DEBUG_CHANNEL? (byte)ChatSourceType.Object : (byte)ChatSourceType.Agent, | 133 | (byte)ChatSourceType.Agent, |
127 | (byte)ChatAudibleLevel.Fully); | 134 | (byte)ChatAudibleLevel.Fully); |
135 | else | ||
136 | client.SendChatMessage(c.Message, (byte)c.Type, | ||
137 | pos, c.From, LLUUID.Zero, | ||
138 | (byte)ChatSourceType.Object, | ||
139 | (byte)ChatAudibleLevel.Fully); | ||
128 | }); | 140 | }); |
129 | } | 141 | } |
130 | 142 | ||
@@ -147,7 +159,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
147 | 159 | ||
148 | string fromName = e.From; | 160 | string fromName = e.From; |
149 | string message = e.Message; | 161 | string message = e.Message; |
150 | LLUUID fromAgentID = e.SenderUUID; | 162 | LLUUID fromID = e.SenderUUID; |
151 | 163 | ||
152 | if (e.Sender != null) | 164 | if (e.Sender != null) |
153 | { | 165 | { |
@@ -160,7 +172,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
160 | regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, | 172 | regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, |
161 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 173 | scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
162 | fromName = avatar.Firstname + " " + avatar.Lastname; | 174 | fromName = avatar.Firstname + " " + avatar.Lastname; |
163 | fromAgentID = e.Sender.AgentId; | 175 | fromID = e.Sender.AgentId; |
164 | } | 176 | } |
165 | 177 | ||
166 | if (e.Channel == DEBUG_CHANNEL) | 178 | if (e.Channel == DEBUG_CHANNEL) |
@@ -175,13 +187,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
175 | if (e.Channel == DEBUG_CHANNEL) | 187 | if (e.Channel == DEBUG_CHANNEL) |
176 | { | 188 | { |
177 | TrySendChatMessage(presence, fromPos, regionPos, | 189 | TrySendChatMessage(presence, fromPos, regionPos, |
178 | fromAgentID, fromName, e.Type, | 190 | fromID, fromName, e.Type, |
179 | message, ChatSourceType.Object); | 191 | message, ChatSourceType.Object); |
180 | } | 192 | } |
181 | else | 193 | else |
182 | { | 194 | { |
183 | TrySendChatMessage(presence, fromPos, regionPos, | 195 | TrySendChatMessage(presence, fromPos, regionPos, |
184 | fromAgentID, fromName, e.Type, | 196 | fromID, fromName, e.Type, |
185 | message, ChatSourceType.Agent); | 197 | message, ChatSourceType.Agent); |
186 | } | 198 | } |
187 | }); | 199 | }); |
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index 18106be..452ea7b 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
88 | { | 88 | { |
89 | m_irc = new IRCChatModule(config); | 89 | m_irc = new IRCChatModule(config); |
90 | } | 90 | } |
91 | |||
91 | if (m_irc_connector == null) | 92 | if (m_irc_connector == null) |
92 | { | 93 | { |
93 | m_irc_connector = new Thread(IRCConnectRun); | 94 | m_irc_connector = new Thread(IRCConnectRun); |
@@ -183,6 +184,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
183 | m_irc_connector.Name = "IRCConnectorThread"; | 184 | m_irc_connector.Name = "IRCConnectorThread"; |
184 | m_irc_connector.IsBackground = true; | 185 | m_irc_connector.IsBackground = true; |
185 | } | 186 | } |
187 | |||
186 | if (!m_irc_connector.IsAlive) | 188 | if (!m_irc_connector.IsAlive) |
187 | { | 189 | { |
188 | m_irc_connector.Start(); | 190 | m_irc_connector.Start(); |
@@ -196,20 +198,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
196 | 198 | ||
197 | if (e.Message.StartsWith("/me ") && (null != avatar)) | 199 | if (e.Message.StartsWith("/me ") && (null != avatar)) |
198 | e.Message = String.Format("{0} {1}", fromName, e.Message.Substring(4)); | 200 | e.Message = String.Format("{0} {1}", fromName, e.Message.Substring(4)); |
199 | if (e.Channel == 0 || e.Channel == DEBUG_CHANNEL) | 201 | |
200 | { | 202 | // this is to keep objects from talking to IRC |
201 | if (e.Channel == DEBUG_CHANNEL) | 203 | if (m_irc.Connected && (avatar != null)) |
202 | e.Type = ChatTypeEnum.DebugChannel; | ||
203 | |||
204 | // IRC stuff | ||
205 | if (e.Message.Length > 0 && e.Channel == 0) | ||
206 | { | ||
207 | if (m_irc.Connected && (avatar != null)) // this is to keep objects from talking to IRC | ||
208 | { | ||
209 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | 204 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); |
210 | } | ||
211 | } | ||
212 | } | ||
213 | } | 205 | } |
214 | 206 | ||
215 | #endregion | 207 | #endregion |
@@ -529,14 +521,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
529 | // Get some direct matches $1 $4 is a | 521 | // Get some direct matches $1 $4 is a |
530 | if ((matches.Count == 0) || (matches.Count != 1) || (matches[0].Groups.Count != 5)) | 522 | if ((matches.Count == 0) || (matches.Count != 1) || (matches[0].Groups.Count != 5)) |
531 | { | 523 | { |
532 | result = new Dictionary<string, string>(); | ||
533 | result.Add("nick", matches[0].Groups[1].Value); | ||
534 | result.Add("user", matches[0].Groups[2].Value); | ||
535 | result.Add("channel", matches[0].Groups[3].Value); | ||
536 | result.Add("msg", matches[0].Groups[4].Value); | ||
537 | } | ||
538 | else | ||
539 | { | ||
540 | m_log.Info("[IRC]: Number of matches: " + matches.Count); | 524 | m_log.Info("[IRC]: Number of matches: " + matches.Count); |
541 | if (matches.Count > 0) | 525 | if (matches.Count > 0) |
542 | { | 526 | { |
@@ -641,7 +625,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
641 | 625 | ||
642 | public void BroadcastSim(string sender, string format, params string[] args) | 626 | public void BroadcastSim(string sender, string format, params string[] args) |
643 | { | 627 | { |
644 | LLVector3 pos = new LLVector3(128, 128, 20); | ||
645 | try | 628 | try |
646 | { | 629 | { |
647 | ChatFromViewerArgs c = new ChatFromViewerArgs(); | 630 | ChatFromViewerArgs c = new ChatFromViewerArgs(); |
@@ -781,8 +764,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
781 | 764 | ||
782 | public void eventIrcMode(string[] commArgs) | 765 | public void eventIrcMode(string[] commArgs) |
783 | { | 766 | { |
784 | string IrcChannel = commArgs[2]; | ||
785 | string IrcUser = commArgs[0].Split('!')[0]; | ||
786 | string UserMode = ""; | 767 | string UserMode = ""; |
787 | for (int i = 3; i < commArgs.Length; i++) | 768 | for (int i = 3; i < commArgs.Length; i++) |
788 | { | 769 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 788e80a..8419399 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -34,16 +34,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
34 | { | 34 | { |
35 | public partial class Scene | 35 | public partial class Scene |
36 | { | 36 | { |
37 | /// <summary> | 37 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, |
38 | /// | 38 | LLUUID fromID, bool fromAgent, bool broadcast) |
39 | /// </summary> | ||
40 | /// <param name="message"></param> | ||
41 | /// <param name="type"></param> | ||
42 | /// <param name="fromPos"></param> | ||
43 | /// <param name="fromName"></param> | ||
44 | /// <param name="fromAgentID"></param> | ||
45 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, | ||
46 | LLUUID fromAgentID) | ||
47 | { | 39 | { |
48 | ChatFromViewerArgs args = new ChatFromViewerArgs(); | 40 | ChatFromViewerArgs args = new ChatFromViewerArgs(); |
49 | 41 | ||
@@ -51,19 +43,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
51 | args.Channel = channel; | 43 | args.Channel = channel; |
52 | args.Type = type; | 44 | args.Type = type; |
53 | args.Position = fromPos; | 45 | args.Position = fromPos; |
54 | args.SenderUUID = fromAgentID; | 46 | args.SenderUUID = fromID; |
55 | args.Scene = this; | 47 | args.Scene = this; |
56 | 48 | ||
57 | ScenePresence user = GetScenePresence(fromAgentID); | 49 | if (fromAgent) |
58 | if (user != null) | 50 | { |
59 | args.Sender = user.ControllingClient; | 51 | ScenePresence user = GetScenePresence(fromID); |
52 | if (user != null) | ||
53 | args.Sender = user.ControllingClient; | ||
54 | } | ||
60 | else | 55 | else |
61 | args.Sender = null; | 56 | { |
57 | SceneObjectPart obj = GetSceneObjectPart(fromID); | ||
58 | args.SenderObject = obj; | ||
59 | } | ||
62 | 60 | ||
63 | args.From = fromName; | 61 | args.From = fromName; |
64 | //args. | 62 | //args. |
65 | 63 | ||
66 | EventManager.TriggerOnChatFromWorld(this, args); | 64 | if (broadcast) |
65 | EventManager.TriggerOnChatBroadcast(this, args); | ||
66 | else | ||
67 | EventManager.TriggerOnChatFromWorld(this, args); | ||
68 | |||
69 | } | ||
70 | /// <summary> | ||
71 | /// | ||
72 | /// </summary> | ||
73 | /// <param name="message"></param> | ||
74 | /// <param name="type"></param> | ||
75 | /// <param name="fromPos"></param> | ||
76 | /// <param name="fromName"></param> | ||
77 | /// <param name="fromAgentID"></param> | ||
78 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, | ||
79 | LLUUID fromID, bool fromAgent) | ||
80 | { | ||
81 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, false); | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// | ||
86 | /// </summary> | ||
87 | /// <param name="message"></param> | ||
88 | /// <param name="type"></param> | ||
89 | /// <param name="fromPos"></param> | ||
90 | /// <param name="fromName"></param> | ||
91 | /// <param name="fromAgentID"></param> | ||
92 | public void SimChatBroadcast(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, | ||
93 | LLUUID fromID, bool fromAgent) | ||
94 | { | ||
95 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); | ||
67 | } | 96 | } |
68 | 97 | ||
69 | /// <summary> | 98 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f4ec1a3..4d380f9 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -113,7 +113,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
113 | public IXfer XferManager; | 113 | public IXfer XferManager; |
114 | 114 | ||
115 | protected IHttpRequests m_httpRequestModule; | 115 | protected IHttpRequests m_httpRequestModule; |
116 | protected ISimChat m_simChatModule; | ||
117 | protected IXMLRPC m_xmlrpcModule; | 116 | protected IXMLRPC m_xmlrpcModule; |
118 | protected IWorldComm m_worldCommModule; | 117 | protected IWorldComm m_worldCommModule; |
119 | protected IAvatarFactory m_AvatarFactory; | 118 | protected IAvatarFactory m_AvatarFactory; |
@@ -637,7 +636,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
637 | /// </summary> | 636 | /// </summary> |
638 | public void SetModuleInterfaces() | 637 | public void SetModuleInterfaces() |
639 | { | 638 | { |
640 | m_simChatModule = RequestModuleInterface<ISimChat>(); | ||
641 | m_httpRequestModule = RequestModuleInterface<IHttpRequests>(); | 639 | m_httpRequestModule = RequestModuleInterface<IHttpRequests>(); |
642 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); | 640 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); |
643 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); | 641 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); |