aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-27 22:33:42 +0100
committerJustin Clark-Casey (justincc)2012-03-27 22:33:42 +0100
commitb74a89bc125a9f3c0c7aac0001a84df4ec28a192 (patch)
tree41e0d175de20682c38146365bf2aaafc02ce19a6
parentTwo new scripting functions osInviteToGroup(userID) and osEjectFromGroup(user... (diff)
downloadopensim-SC_OLD-b74a89bc125a9f3c0c7aac0001a84df4ec28a192.zip
opensim-SC_OLD-b74a89bc125a9f3c0c7aac0001a84df4ec28a192.tar.gz
opensim-SC_OLD-b74a89bc125a9f3c0c7aac0001a84df4ec28a192.tar.bz2
opensim-SC_OLD-b74a89bc125a9f3c0c7aac0001a84df4ec28a192.tar.xz
minor: clean up some code formatting in VivoxVoiceModule.cs
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs79
1 files changed, 25 insertions, 54 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index 70e2f7e..738133c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -221,15 +221,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
221 } 221 }
222 } 222 }
223 223
224 // Called to indicate that the module has been added to the region
225 public void AddRegion(Scene scene) 224 public void AddRegion(Scene scene)
226 { 225 {
227
228 if (m_pluginEnabled) 226 if (m_pluginEnabled)
229 { 227 {
230 lock (vlock) 228 lock (vlock)
231 { 229 {
232
233 string channelId; 230 string channelId;
234 231
235 string sceneUUID = scene.RegionInfo.RegionID.ToString(); 232 string sceneUUID = scene.RegionInfo.RegionID.ToString();
@@ -273,23 +270,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
273 } 270 }
274 } 271 }
275 272
276
277 // Create a dictionary entry unconditionally. This eliminates the 273 // Create a dictionary entry unconditionally. This eliminates the
278 // need to check for a parent in the core code. The end result is 274 // need to check for a parent in the core code. The end result is
279 // the same, if the parent table entry is an empty string, then 275 // the same, if the parent table entry is an empty string, then
280 // region channels will be created as first-level channels. 276 // region channels will be created as first-level channels.
281 277 lock (m_parents)
282 lock (m_parents) 278 {
283 if (m_parents.ContainsKey(sceneUUID)) 279 if (m_parents.ContainsKey(sceneUUID))
284 { 280 {
285 RemoveRegion(scene); 281 RemoveRegion(scene);
286 m_parents.Add(sceneUUID, channelId); 282 m_parents.Add(sceneUUID, channelId);
287 } 283 }
288 else 284 else
289 { 285 {
290 m_parents.Add(sceneUUID, channelId); 286 m_parents.Add(sceneUUID, channelId);
291 } 287 }
292 288 }
293 } 289 }
294 290
295 // we need to capture scene in an anonymous method 291 // we need to capture scene in an anonymous method
@@ -298,26 +294,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
298 { 294 {
299 OnRegisterCaps(scene, agentID, caps); 295 OnRegisterCaps(scene, agentID, caps);
300 }; 296 };
301
302 } 297 }
303
304 } 298 }
305 299
306 // Called to indicate that all loadable modules have now been added
307 public void RegionLoaded(Scene scene) 300 public void RegionLoaded(Scene scene)
308 { 301 {
309 // Do nothing. 302 // Do nothing.
310 } 303 }
311 304
312 // Called to indicate that the region is going away.
313 public void RemoveRegion(Scene scene) 305 public void RemoveRegion(Scene scene)
314 { 306 {
315
316 if (m_pluginEnabled) 307 if (m_pluginEnabled)
317 { 308 {
318 lock (vlock) 309 lock (vlock)
319 { 310 {
320
321 string channelId; 311 string channelId;
322 312
323 string sceneUUID = scene.RegionInfo.RegionID.ToString(); 313 string sceneUUID = scene.RegionInfo.RegionID.ToString();
@@ -328,10 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
328 // iteration over the set of chidren identified. 318 // iteration over the set of chidren identified.
329 // This assumes that there is just one directory per 319 // This assumes that there is just one directory per
330 // region. 320 // region.
331
332 if (VivoxTryGetDirectory(sceneUUID + "D", out channelId)) 321 if (VivoxTryGetDirectory(sceneUUID + "D", out channelId))
333 { 322 {
334
335 m_log.DebugFormat("[VivoxVoice]: region {0}: uuid {1}: located directory id {2}", 323 m_log.DebugFormat("[VivoxVoice]: region {0}: uuid {1}: located directory id {2}",
336 sceneName, sceneUUID, channelId); 324 sceneName, sceneUUID, channelId);
337 325
@@ -360,7 +348,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
360 348
361 lock (m_parents) 349 lock (m_parents)
362 { 350 {
363 if (m_parents.ContainsKey(sceneUUID)) 351 if (m_parents.ContainsKey(sceneUUID))
364 { 352 {
365 m_parents.Remove(sceneUUID); 353 m_parents.Remove(sceneUUID);
366 } 354 }
@@ -459,11 +447,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
459 { 447 {
460 try 448 try
461 { 449 {
462
463 ScenePresence avatar = null; 450 ScenePresence avatar = null;
464 string avatarName = null; 451 string avatarName = null;
465 452
466 if (scene == null) throw new Exception("[VivoxVoice][PROVISIONVOICE] Invalid scene"); 453 if (scene == null)
454 throw new Exception("[VivoxVoice][PROVISIONVOICE]: Invalid scene");
467 455
468 avatar = scene.GetScenePresence(agentID); 456 avatar = scene.GetScenePresence(agentID);
469 while (avatar == null) 457 while (avatar == null)
@@ -566,7 +554,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
566 } 554 }
567 } 555 }
568 } 556 }
569 } while (retry); 557 }
558 while (retry);
570 559
571 if (code != "OK") 560 if (code != "OK")
572 { 561 {
@@ -676,7 +665,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
676 } 665 }
677 } 666 }
678 667
679
680 /// <summary> 668 /// <summary>
681 /// Callback for a client request for a private chat channel 669 /// Callback for a client request for a private chat channel
682 /// </summary> 670 /// </summary>
@@ -698,10 +686,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
698 return "<llsd>true</llsd>"; 686 return "<llsd>true</llsd>";
699 } 687 }
700 688
701
702 private string RegionGetOrCreateChannel(Scene scene, LandData land) 689 private string RegionGetOrCreateChannel(Scene scene, LandData land)
703 { 690 {
704
705 string channelUri = null; 691 string channelUri = null;
706 string channelId = null; 692 string channelId = null;
707 693
@@ -709,11 +695,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
709 string landName; 695 string landName;
710 string parentId; 696 string parentId;
711 697
712 lock (m_parents) parentId = m_parents[scene.RegionInfo.RegionID.ToString()]; 698 lock (m_parents)
699 parentId = m_parents[scene.RegionInfo.RegionID.ToString()];
713 700
714 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same 701 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
715 // as the directory ID. Otherwise, it reflects the parcel's ID. 702 // as the directory ID. Otherwise, it reflects the parcel's ID.
716
717 if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) 703 if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0)
718 { 704 {
719 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name); 705 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
@@ -741,14 +727,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
741 727
742 m_log.DebugFormat("[VivoxVoice]: Region:Parcel \"{0}\": parent channel id {1}: retrieved parcel channel_uri {2} ", 728 m_log.DebugFormat("[VivoxVoice]: Region:Parcel \"{0}\": parent channel id {1}: retrieved parcel channel_uri {2} ",
743 landName, parentId, channelUri); 729 landName, parentId, channelUri);
744
745
746 } 730 }
747 731
748 return channelUri; 732 return channelUri;
749 } 733 }
750 734
751
752 private static readonly string m_vivoxLoginPath = "http://{0}/api2/viv_signin.php?userid={1}&pwd={2}"; 735 private static readonly string m_vivoxLoginPath = "http://{0}/api2/viv_signin.php?userid={1}&pwd={2}";
753 736
754 /// <summary> 737 /// <summary>
@@ -761,7 +744,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
761 return VivoxCall(requrl, false); 744 return VivoxCall(requrl, false);
762 } 745 }
763 746
764
765 private static readonly string m_vivoxLogoutPath = "http://{0}/api2/viv_signout.php?auth_token={1}"; 747 private static readonly string m_vivoxLogoutPath = "http://{0}/api2/viv_signout.php?auth_token={1}";
766 748
767 /// <summary> 749 /// <summary>
@@ -773,7 +755,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
773 return VivoxCall(requrl, false); 755 return VivoxCall(requrl, false);
774 } 756 }
775 757
776
777 private static readonly string m_vivoxGetAccountPath = "http://{0}/api2/viv_get_acct.php?auth_token={1}&user_name={2}"; 758 private static readonly string m_vivoxGetAccountPath = "http://{0}/api2/viv_get_acct.php?auth_token={1}&user_name={2}";
778 759
779 /// <summary> 760 /// <summary>
@@ -786,7 +767,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
786 return VivoxCall(requrl, true); 767 return VivoxCall(requrl, true);
787 } 768 }
788 769
789
790 private static readonly string m_vivoxNewAccountPath = "http://{0}/api2/viv_adm_acct_new.php?username={1}&pwd={2}&auth_token={3}"; 770 private static readonly string m_vivoxNewAccountPath = "http://{0}/api2/viv_adm_acct_new.php?username={1}&pwd={2}&auth_token={3}";
791 771
792 /// <summary> 772 /// <summary>
@@ -801,7 +781,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
801 return VivoxCall(requrl, true); 781 return VivoxCall(requrl, true);
802 } 782 }
803 783
804
805 private static readonly string m_vivoxPasswordPath = "http://{0}/api2/viv_adm_password.php?user_name={1}&new_pwd={2}&auth_token={3}"; 784 private static readonly string m_vivoxPasswordPath = "http://{0}/api2/viv_adm_password.php?user_name={1}&new_pwd={2}&auth_token={3}";
806 785
807 /// <summary> 786 /// <summary>
@@ -813,7 +792,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
813 return VivoxCall(requrl, true); 792 return VivoxCall(requrl, true);
814 } 793 }
815 794
816
817 private static readonly string m_vivoxChannelPath = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_name={2}&auth_token={3}"; 795 private static readonly string m_vivoxChannelPath = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_name={2}&auth_token={3}";
818 796
819 /// <summary> 797 /// <summary>
@@ -828,7 +806,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
828 /// 806 ///
829 /// In this case the call handles parent and description as optional values. 807 /// In this case the call handles parent and description as optional values.
830 /// </summary> 808 /// </summary>
831
832 private bool VivoxTryCreateChannel(string parent, string channelId, string description, out string channelUri) 809 private bool VivoxTryCreateChannel(string parent, string channelId, string description, out string channelUri)
833 { 810 {
834 string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken); 811 string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken);
@@ -864,7 +841,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
864 /// channel name space. 841 /// channel name space.
865 /// The parent and description are optional values. 842 /// The parent and description are optional values.
866 /// </summary> 843 /// </summary>
867
868 private bool VivoxTryCreateDirectory(string dirId, string description, out string channelId) 844 private bool VivoxTryCreateDirectory(string dirId, string description, out string channelId)
869 { 845 {
870 string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", dirId, m_authToken); 846 string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", dirId, m_authToken);
@@ -901,7 +877,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
901 /// are required in a later phase. 877 /// are required in a later phase.
902 /// In this case the call handles parent and description as optional values. 878 /// In this case the call handles parent and description as optional values.
903 /// </summary> 879 /// </summary>
904
905 private bool VivoxTryGetChannel(string channelParent, string channelName, 880 private bool VivoxTryGetChannel(string channelParent, string channelName,
906 out string channelId, out string channelUri) 881 out string channelId, out string channelUri)
907 { 882 {
@@ -1044,6 +1019,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1044 // return VivoxCall(requrl, true); 1019 // return VivoxCall(requrl, true);
1045 // } 1020 // }
1046 1021
1022 private static readonly string m_vivoxChannelDel = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}";
1023
1047 /// <summary> 1024 /// <summary>
1048 /// Delete a channel. 1025 /// Delete a channel.
1049 /// Once again, there a multitude of options possible. In the simplest case 1026 /// Once again, there a multitude of options possible. In the simplest case
@@ -1055,9 +1032,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1055 /// are required in a later phase. 1032 /// are required in a later phase.
1056 /// In this case the call handles parent and description as optional values. 1033 /// In this case the call handles parent and description as optional values.
1057 /// </summary> 1034 /// </summary>
1058
1059 private static readonly string m_vivoxChannelDel = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}";
1060
1061 private XmlElement VivoxDeleteChannel(string parent, string channelid) 1035 private XmlElement VivoxDeleteChannel(string parent, string channelid)
1062 { 1036 {
1063 string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); 1037 string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken);
@@ -1068,12 +1042,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1068 return VivoxCall(requrl, true); 1042 return VivoxCall(requrl, true);
1069 } 1043 }
1070 1044
1045 private static readonly string m_vivoxChannelSearch = "http://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}";
1046
1071 /// <summary> 1047 /// <summary>
1072 /// Return information on channels in the given directory 1048 /// Return information on channels in the given directory
1073 /// </summary> 1049 /// </summary>
1074
1075 private static readonly string m_vivoxChannelSearch = "http://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}";
1076
1077 private XmlElement VivoxListChildren(string channelid) 1050 private XmlElement VivoxListChildren(string channelid)
1078 { 1051 {
1079 string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken); 1052 string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken);
@@ -1118,7 +1091,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1118 /// The outcome of the call can be determined by examining the 1091 /// The outcome of the call can be determined by examining the
1119 /// status value in the hash table. 1092 /// status value in the hash table.
1120 /// </summary> 1093 /// </summary>
1121
1122 private XmlElement VivoxCall(string requrl, bool admin) 1094 private XmlElement VivoxCall(string requrl, bool admin)
1123 { 1095 {
1124 1096
@@ -1164,7 +1136,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1164 /// <summary> 1136 /// <summary>
1165 /// Just say if it worked. 1137 /// Just say if it worked.
1166 /// </summary> 1138 /// </summary>
1167
1168 private bool IsOK(XmlElement resp) 1139 private bool IsOK(XmlElement resp)
1169 { 1140 {
1170 string status; 1141 string status;
@@ -1337,4 +1308,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1337 return false; 1308 return false;
1338 } 1309 }
1339 } 1310 }
1340} 1311} \ No newline at end of file