aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSignpostMarv2012-11-10 09:05:32 +0000
committerDiva Canto2012-11-10 08:12:31 -0800
commitfb7bbe167ace2954a961714881e5b0bc3b0dab77 (patch)
treeec9e1db8c641b64ae87dc79b7d581706e81b6048 /OpenSim/Region
parentConverting DialogModule to INonSharedRegionModule (diff)
downloadopensim-SC_OLD-fb7bbe167ace2954a961714881e5b0bc3b0dab77.zip
opensim-SC_OLD-fb7bbe167ace2954a961714881e5b0bc3b0dab77.tar.gz
opensim-SC_OLD-fb7bbe167ace2954a961714881e5b0bc3b0dab77.tar.bz2
opensim-SC_OLD-fb7bbe167ace2954a961714881e5b0bc3b0dab77.tar.xz
formatting DialogModule for 80-character width terminal
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs120
1 files changed, 73 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 2fe708f..d85a6e3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -42,9 +42,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
42{ 42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class DialogModule : IDialogModule, INonSharedRegionModule 44 public class DialogModule : IDialogModule, INonSharedRegionModule
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 protected Scene m_scene; 48 protected Scene m_scene;
49 49
50 public void Initialise(IConfigSource source) { } 50 public void Initialise(IConfigSource source) { }
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
59 59
60 public void RegionLoaded(Scene scene) 60 public void RegionLoaded(Scene scene)
61 { 61 {
62 if(scene != m_scene) 62 if (scene != m_scene)
63 return; 63 return;
64 64
65 m_scene.AddCommand( 65 m_scene.AddCommand(
@@ -68,52 +68,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
68 HandleAlertConsoleCommand); 68 HandleAlertConsoleCommand);
69 69
70 m_scene.AddCommand( 70 m_scene.AddCommand(
71 "Users", this, "alert-user", "alert-user <first> <last> <message>", 71 "Users", this, "alert-user",
72 "alert-user <first> <last> <message>",
72 "Send an alert to a user", 73 "Send an alert to a user",
73 HandleAlertConsoleCommand); 74 HandleAlertConsoleCommand);
74 } 75 }
75 76
76 public void RemoveRegion(Scene scene) 77 public void RemoveRegion(Scene scene)
77 { 78 {
78 if(scene != m_scene) 79 if (scene != m_scene)
79 return; 80 return;
80 81
81 m_scene.UnregisterModuleInterface<IDialogModule>(this); 82 m_scene.UnregisterModuleInterface<IDialogModule>(this);
82 } 83 }
83 84
84 public void Close() {} 85 public void Close() { }
85 public string Name { get { return "Dialog Module"; } } 86 public string Name { get { return "Dialog Module"; } }
86 87
87 public void SendAlertToUser(IClientAPI client, string message) 88 public void SendAlertToUser(IClientAPI client, string message)
88 { 89 {
89 SendAlertToUser(client, message, false); 90 SendAlertToUser(client, message, false);
90 } 91 }
91 92
92 public void SendAlertToUser(IClientAPI client, string message, bool modal) 93 public void SendAlertToUser(IClientAPI client, string message,
94 bool modal)
93 { 95 {
94 client.SendAgentAlertMessage(message, modal); 96 client.SendAgentAlertMessage(message, modal);
95 } 97 }
96 98
97 public void SendAlertToUser(UUID agentID, string message) 99 public void SendAlertToUser(UUID agentID, string message)
98 { 100 {
99 SendAlertToUser(agentID, message, false); 101 SendAlertToUser(agentID, message, false);
100 } 102 }
101 103
102 public void SendAlertToUser(UUID agentID, string message, bool modal) 104 public void SendAlertToUser(UUID agentID, string message, bool modal)
103 { 105 {
104 ScenePresence sp = m_scene.GetScenePresence(agentID); 106 ScenePresence sp = m_scene.GetScenePresence(agentID);
105 107
106 if (sp != null) 108 if (sp != null)
107 sp.ControllingClient.SendAgentAlertMessage(message, modal); 109 sp.ControllingClient.SendAgentAlertMessage(message, modal);
108 } 110 }
109 111
110 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 112 public void SendAlertToUser(string firstName, string lastName,
113 string message, bool modal)
111 { 114 {
112 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); 115 ScenePresence presence = m_scene.GetScenePresence(firstName,
116 lastName);
113 if (presence != null) 117 if (presence != null)
114 presence.ControllingClient.SendAgentAlertMessage(message, modal); 118 {
119 presence.ControllingClient.SendAgentAlertMessage(message,
120 modal);
121 }
115 } 122 }
116 123
117 public void SendGeneralAlert(string message) 124 public void SendGeneralAlert(string message)
118 { 125 {
119 m_scene.ForEachRootClient(delegate(IClientAPI client) 126 m_scene.ForEachRootClient(delegate(IClientAPI client)
@@ -122,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
122 }); 129 });
123 } 130 }
124 131
125 public void SendDialogToUser( 132 public void SendDialogToUser(UUID avatarID, string objectName,
126 UUID avatarID, string objectName, UUID objectID, UUID ownerID, 133 UUID objectID, UUID ownerID, string message, UUID textureID,
127 string message, UUID textureID, int ch, string[] buttonlabels) 134 int ch, string[] buttonlabels)
128 { 135 {
129 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); 136 UserAccount account = m_scene.UserAccountService.GetUserAccount(
137 m_scene.RegionInfo.ScopeID, ownerID);
130 string ownerFirstName, ownerLastName; 138 string ownerFirstName, ownerLastName;
131 if (account != null) 139 if (account != null)
132 { 140 {
@@ -141,29 +149,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
141 149
142 ScenePresence sp = m_scene.GetScenePresence(avatarID); 150 ScenePresence sp = m_scene.GetScenePresence(avatarID);
143 if (sp != null) 151 if (sp != null)
144 sp.ControllingClient.SendDialog( 152 {
145 objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); 153 sp.ControllingClient.SendDialog(objectName, objectID, ownerID,
154 ownerFirstName, ownerLastName, message, textureID, ch,
155 buttonlabels);
156 }
146 } 157 }
147 158
148 public void SendUrlToUser( 159 public void SendUrlToUser(UUID avatarID, string objectName,
149 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 160 UUID objectID, UUID ownerID, bool groupOwned, string message,
161 string url)
150 { 162 {
151 ScenePresence sp = m_scene.GetScenePresence(avatarID); 163 ScenePresence sp = m_scene.GetScenePresence(avatarID);
152 164
153 if (sp != null) 165 if (sp != null)
154 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 166 {
167 sp.ControllingClient.SendLoadURL(objectName, objectID,
168 ownerID, groupOwned, message, url);
169 }
155 } 170 }
156 171
157 public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) 172 public void SendTextBoxToUser(UUID avatarid, string message,
173 int chatChannel, string name, UUID objectid, UUID ownerid)
158 { 174 {
159 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); 175 UserAccount account = m_scene.UserAccountService.GetUserAccount(
176 m_scene.RegionInfo.ScopeID, ownerid);
160 string ownerFirstName, ownerLastName; 177 string ownerFirstName, ownerLastName;
161 UUID ownerID = UUID.Zero; 178 UUID ownerID = UUID.Zero;
162 if (account != null) 179 if (account != null)
163 { 180 {
164 ownerFirstName = account.FirstName; 181 ownerFirstName = account.FirstName;
165 ownerLastName = account.LastName; 182 ownerLastName = account.LastName;
166 ownerID = account.PrincipalID; 183 ownerID = account.PrincipalID;
167 } 184 }
168 else 185 else
169 { 186 {
@@ -172,29 +189,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
172 } 189 }
173 190
174 ScenePresence sp = m_scene.GetScenePresence(avatarid); 191 ScenePresence sp = m_scene.GetScenePresence(avatarid);
175 192
176 if (sp != null) 193 if (sp != null)
177 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); 194 {
195 sp.ControllingClient.SendTextBoxRequest(message, chatChannel,
196 name, ownerID, ownerFirstName, ownerLastName,
197 objectid);
198 }
178 } 199 }
179 200
180 public void SendNotificationToUsersInRegion( 201 public void SendNotificationToUsersInRegion(UUID fromAvatarID,
181 UUID fromAvatarID, string fromAvatarName, string message) 202 string fromAvatarName, string message)
182 { 203 {
183 m_scene.ForEachRootClient(delegate(IClientAPI client) 204 m_scene.ForEachRootClient(delegate(IClientAPI client)
184 { 205 {
185 client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 206 client.SendBlueBoxMessage(fromAvatarID, fromAvatarName,
207 message);
186 }); 208 });
187 } 209 }
188 210
189 /// <summary> 211 /// <summary>
190 /// Handle an alert command from the console. 212 /// Handle an alert command from the console.
191 /// </summary> 213 /// </summary>
192 /// <param name="module"></param> 214 /// <param name="module"></param>
193 /// <param name="cmdparams"></param> 215 /// <param name="cmdparams"></param>
194 public void HandleAlertConsoleCommand(string module, string[] cmdparams) 216 public void HandleAlertConsoleCommand(string module,
217 string[] cmdparams)
195 { 218 {
196 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) 219 if (m_scene.ConsoleScene() != null &&
220 m_scene.ConsoleScene() != m_scene)
221 {
197 return; 222 return;
223 }
198 224
199 string message = string.Empty; 225 string message = string.Empty;
200 226
@@ -202,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
202 { 228 {
203 message = CombineParams(cmdparams, 1); 229 message = CombineParams(cmdparams, 1);
204 m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", 230 m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}",
205 m_scene.RegionInfo.RegionName, message); 231 m_scene.RegionInfo.RegionName, message);
206 SendGeneralAlert(message); 232 SendGeneralAlert(message);
207 } 233 }
208 else if (cmdparams.Length > 3) 234 else if (cmdparams.Length > 3)
@@ -210,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
210 string firstName = cmdparams[1]; 236 string firstName = cmdparams[1];
211 string lastName = cmdparams[2]; 237 string lastName = cmdparams[2];
212 message = CombineParams(cmdparams, 3); 238 message = CombineParams(cmdparams, 3);
213 m_log.InfoFormat( 239 m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
214 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", 240 m_scene.RegionInfo.RegionName, firstName, lastName,
215 m_scene.RegionInfo.RegionName, firstName, lastName, message); 241 message);
216 SendAlertToUser(firstName, lastName, message, false); 242 SendAlertToUser(firstName, lastName, message, false);
217 } 243 }
218 else 244 else
@@ -230,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
230 { 256 {
231 result += commandParams[i] + " "; 257 result += commandParams[i] + " ";
232 } 258 }
233 259
234 return result; 260 return result;
235 } 261 }
236 } 262 }