aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs26
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs82
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs325
7 files changed, 222 insertions, 224 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs
index 84211a9..5c45e4d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Animation; 43using OpenSim.Region.Framework.Scenes.Animation;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using AnimationSet = OpenSim.Region.Framework.Scenes.Animation.AnimationSet;
45 46
46namespace OpenSim.Region.OptionalModules.Avatar.Animations 47namespace OpenSim.Region.OptionalModules.Avatar.Animations
47{ 48{
@@ -197,4 +198,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations
197 sb.Append("\n"); 198 sb.Append("\n");
198 } 199 }
199 } 200 }
200} \ No newline at end of file 201}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 535bf67..c53a762 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); 184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
185 } 185 }
186 186
187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0; 187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, false, true) ? 1 : 0;
188 } 188 }
189 } 189 }
190} 190}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index 6985371..5b9a5b5 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -368,11 +368,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
368 m_writer.Flush(); 368 m_writer.Flush();
369 m_writer.WriteLine(m_user); 369 m_writer.WriteLine(m_user);
370 m_writer.Flush(); 370 m_writer.Flush();
371 m_writer.WriteLine(String.Format("JOIN {0}", m_ircChannel));
372 m_writer.Flush();
373
374 m_log.InfoFormat("[IRC-Connector-{0}]: {1} has asked to join {2}", idn, m_nick, m_ircChannel);
375
376 } 371 }
377 catch (Exception e) 372 catch (Exception e)
378 { 373 {
@@ -521,7 +516,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
521 c.Message = data["msg"]; 516 c.Message = data["msg"];
522 c.Type = ChatTypeEnum.Region; 517 c.Type = ChatTypeEnum.Region;
523 c.Position = CenterOfRegion; 518 c.Position = CenterOfRegion;
524 c.From = data["nick"]; 519 c.From = data["nick"] + "@IRC";
525 c.Sender = null; 520 c.Sender = null;
526 c.SenderUUID = UUID.Zero; 521 c.SenderUUID = UUID.Zero;
527 522
@@ -659,6 +654,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
659 version = commArgs[2]; 654 version = commArgs[2];
660 usermod = commArgs[3]; 655 usermod = commArgs[3];
661 chanmod = commArgs[4]; 656 chanmod = commArgs[4];
657
658 m_writer.WriteLine(String.Format("JOIN {0}", m_ircChannel));
659 m_writer.Flush();
660 m_log.InfoFormat("[IRC-Connector-{0}]: sent request to join {1} ", idn, m_ircChannel);
661
662 break; 662 break;
663 case "005": // Server information 663 case "005": // Server information
664 break; 664 break;
@@ -721,11 +721,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
721 case "PONG": 721 case "PONG":
722 break; 722 break;
723 case "JOIN": 723 case "JOIN":
724 if (m_pending) 724
725 {
726 m_log.InfoFormat("[IRC-Connector-{0}] [{1}] Connected", idn, cmd);
727 m_pending = false;
728 }
729 m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms); 725 m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
730 eventIrcJoin(pfx, cmd, parms); 726 eventIrcJoin(pfx, cmd, parms);
731 break; 727 break;
@@ -767,7 +763,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
767 if (IrcChannel.StartsWith(":")) 763 if (IrcChannel.StartsWith(":"))
768 IrcChannel = IrcChannel.Substring(1); 764 IrcChannel = IrcChannel.Substring(1);
769 765
770 m_log.DebugFormat("[IRC-Connector-{0}] Event: IRCJoin {1}:{2}", idn, m_server, m_ircChannel); 766 if(IrcChannel == m_ircChannel)
767 {
768 m_log.InfoFormat("[IRC-Connector-{0}] Joined requested channel {1} at {2}", idn, IrcChannel,m_server);
769 m_pending = false;
770 }
771 else
772 m_log.InfoFormat("[IRC-Connector-{0}] Joined unknown channel {1} at {2}", idn, IrcChannel,m_server);
771 BroadcastSim(IrcUser, "/me joins {0}", IrcChannel); 773 BroadcastSim(IrcUser, "/me joins {0}", IrcChannel);
772 } 774 }
773 775
diff --git a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
index 4e84364..026ceca 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
107 m_scene.AddCommand( 107 m_scene.AddCommand(
108 "Friends", this, "friends show", 108 "Friends", this, "friends show",
109 "friends show [--cache] <first-name> <last-name>", 109 "friends show [--cache] <first-name> <last-name>",
110 "Show the friends for the given user if they exist.\n", 110 "Show the friends for the given user if they exist.",
111 "The --cache option will show locally cached information for that user.", 111 "The --cache option will show locally cached information for that user.",
112 HandleFriendsShowCommand); 112 HandleFriendsShowCommand);
113 } 113 }
@@ -197,4 +197,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
197 } 197 }
198 } 198 }
199 } 199 }
200} \ No newline at end of file 200}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 45af212..3db0781 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -575,7 +575,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
575 575
576 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) 576 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
577 { 577 {
578 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called"); 578// m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
579 579
580 Hashtable response = new Hashtable(); 580 Hashtable response = new Hashtable();
581 response["content_type"] = "text/xml"; 581 response["content_type"] = "text/xml";
@@ -726,7 +726,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
726 726
727 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) 727 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
728 { 728 {
729 m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called"); 729 //m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
730// string requestbody = (string)request["body"]; 730// string requestbody = (string)request["body"];
731// string uri = (string)request["uri"]; 731// string uri = (string)request["uri"];
732// string contenttype = (string)request["content-type"]; 732// string contenttype = (string)request["content-type"];
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index dd44564..f51527e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -121,6 +121,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
121 121
122 public void Initialise(IConfigSource config) 122 public void Initialise(IConfigSource config)
123 { 123 {
124 MainConsole.Instance.Commands.AddCommand("vivox", false, "vivox debug", "vivox debug <on>|<off>", "Set vivox debugging", HandleDebug);
124 125
125 m_config = config.Configs["VivoxVoice"]; 126 m_config = config.Configs["VivoxVoice"];
126 127
@@ -196,7 +197,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
196 break; 197 break;
197 } 198 }
198 199
199 m_vivoxVoiceAccountApi = String.Format("http://{0}/api2", m_vivoxServer); 200 m_vivoxVoiceAccountApi = String.Format("https://{0}/api2", m_vivoxServer);
200 201
201 // Admin interface required values 202 // Admin interface required values
202 if (String.IsNullOrEmpty(m_vivoxServer) || 203 if (String.IsNullOrEmpty(m_vivoxServer) ||
@@ -475,8 +476,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
475 avatarName = avatar.Name; 476 avatarName = avatar.Name;
476 477
477 m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: scene = {0}, agentID = {1}", scene, agentID); 478 m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: scene = {0}, agentID = {1}", scene, agentID);
478 m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", 479// m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
479 request, path, param); 480// request, path, param);
480 481
481 XmlElement resp; 482 XmlElement resp;
482 bool retry = false; 483 bool retry = false;
@@ -583,7 +584,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
583 584
584 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse); 585 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
585 586
586 m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r); 587// m_log.DebugFormat("[VivoxVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r);
587 588
588 return r; 589 return r;
589 } 590 }
@@ -630,24 +631,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
630 // voice, if all do retrieve or obtain the parcel 631 // voice, if all do retrieve or obtain the parcel
631 // voice channel 632 // voice channel
632 LandData land = scene.GetLandData(avatar.AbsolutePosition); 633 LandData land = scene.GetLandData(avatar.AbsolutePosition);
634 if (land == null)
635 {
636 return "<llsd><undef /></llsd>";
637 }
633 638
634 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", 639// m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
635 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); 640// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
636 // m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: avatar \"{0}\": location: {1} {2} {3}", 641 // m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: avatar \"{0}\": location: {1} {2} {3}",
637 // avatarName, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); 642 // avatarName, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
638 643
639 // TODO: EstateSettings don't seem to get propagated... 644 // TODO: EstateSettings don't seem to get propagated...
640 if (!scene.RegionInfo.EstateSettings.AllowVoice) 645 if (!scene.RegionInfo.EstateSettings.AllowVoice)
641 { 646 {
642 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings", 647 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
643 scene.RegionInfo.RegionName); 648 // scene.RegionInfo.RegionName);
644 channel_uri = String.Empty; 649 channel_uri = String.Empty;
645 } 650 }
646 651
647 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0) 652 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
648 { 653 {
649 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel", 654 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
650 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName); 655 // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
651 channel_uri = String.Empty; 656 channel_uri = String.Empty;
652 } 657 }
653 else 658 else
@@ -662,8 +667,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
662 parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds); 667 parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
663 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo); 668 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
664 669
665 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}", 670// m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
666 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r); 671// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
667 return r; 672 return r;
668 } 673 }
669 catch (Exception e) 674 catch (Exception e)
@@ -690,11 +695,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
690 public string ChatSessionRequest(Scene scene, string request, string path, string param, 695 public string ChatSessionRequest(Scene scene, string request, string path, string param,
691 UUID agentID, Caps caps) 696 UUID agentID, Caps caps)
692 { 697 {
693 ScenePresence avatar = scene.GetScenePresence(agentID); 698// ScenePresence avatar = scene.GetScenePresence(agentID);
694 string avatarName = avatar.Name; 699// string avatarName = avatar.Name;
695 700
696 m_log.DebugFormat("[VivoxVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}", 701// m_log.DebugFormat("[VivoxVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
697 avatarName, request, path, param); 702// avatarName, request, path, param);
698 return "<llsd>true</llsd>"; 703 return "<llsd>true</llsd>";
699 } 704 }
700 705
@@ -744,7 +749,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
744 return channelUri; 749 return channelUri;
745 } 750 }
746 751
747 private static readonly string m_vivoxLoginPath = "http://{0}/api2/viv_signin.php?userid={1}&pwd={2}"; 752
753 private static readonly string m_vivoxLoginPath = "https://{0}/api2/viv_signin.php?userid={1}&pwd={2}";
748 754
749 /// <summary> 755 /// <summary>
750 /// Perform administrative login for Vivox. 756 /// Perform administrative login for Vivox.
@@ -756,7 +762,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
756 return VivoxCall(requrl, false); 762 return VivoxCall(requrl, false);
757 } 763 }
758 764
759 private static readonly string m_vivoxLogoutPath = "http://{0}/api2/viv_signout.php?auth_token={1}"; 765 private static readonly string m_vivoxLogoutPath = "https://{0}/api2/viv_signout.php?auth_token={1}";
760 766
761 /// <summary> 767 /// <summary>
762 /// Perform administrative logout for Vivox. 768 /// Perform administrative logout for Vivox.
@@ -767,7 +773,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
767 return VivoxCall(requrl, false); 773 return VivoxCall(requrl, false);
768 } 774 }
769 775
770 private static readonly string m_vivoxGetAccountPath = "http://{0}/api2/viv_get_acct.php?auth_token={1}&user_name={2}"; 776
777 private static readonly string m_vivoxGetAccountPath = "https://{0}/api2/viv_get_acct.php?auth_token={1}&user_name={2}";
771 778
772 /// <summary> 779 /// <summary>
773 /// Retrieve account information for the specified user. 780 /// Retrieve account information for the specified user.
@@ -779,7 +786,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
779 return VivoxCall(requrl, true); 786 return VivoxCall(requrl, true);
780 } 787 }
781 788
782 private static readonly string m_vivoxNewAccountPath = "http://{0}/api2/viv_adm_acct_new.php?username={1}&pwd={2}&auth_token={3}"; 789
790 private static readonly string m_vivoxNewAccountPath = "https://{0}/api2/viv_adm_acct_new.php?username={1}&pwd={2}&auth_token={3}";
783 791
784 /// <summary> 792 /// <summary>
785 /// Creates a new account. 793 /// Creates a new account.
@@ -793,7 +801,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
793 return VivoxCall(requrl, true); 801 return VivoxCall(requrl, true);
794 } 802 }
795 803
796 private static readonly string m_vivoxPasswordPath = "http://{0}/api2/viv_adm_password.php?user_name={1}&new_pwd={2}&auth_token={3}"; 804
805 private static readonly string m_vivoxPasswordPath = "https://{0}/api2/viv_adm_password.php?user_name={1}&new_pwd={2}&auth_token={3}";
797 806
798 /// <summary> 807 /// <summary>
799 /// Change the user's password. 808 /// Change the user's password.
@@ -804,7 +813,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
804 return VivoxCall(requrl, true); 813 return VivoxCall(requrl, true);
805 } 814 }
806 815
807 private static readonly string m_vivoxChannelPath = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_name={2}&auth_token={3}"; 816
817 private static readonly string m_vivoxChannelPath = "https://{0}/api2/viv_chan_mod.php?mode={1}&chan_name={2}&auth_token={3}";
808 818
809 /// <summary> 819 /// <summary>
810 /// Create a channel. 820 /// Create a channel.
@@ -876,7 +886,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
876 return false; 886 return false;
877 } 887 }
878 888
879 private static readonly string m_vivoxChannelSearchPath = "http://{0}/api2/viv_chan_search.php?cond_channame={1}&auth_token={2}"; 889 private static readonly string m_vivoxChannelSearchPath = "https://{0}/api2/viv_chan_search.php?cond_channame={1}&auth_token={2}";
880 890
881 /// <summary> 891 /// <summary>
882 /// Retrieve a channel. 892 /// Retrieve a channel.
@@ -1019,7 +1029,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1019 return false; 1029 return false;
1020 } 1030 }
1021 1031
1022 // private static readonly string m_vivoxChannelById = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; 1032 // private static readonly string m_vivoxChannelById = "https://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}";
1023 1033
1024 // private XmlElement VivoxGetChannelById(string parent, string channelid) 1034 // private XmlElement VivoxGetChannelById(string parent, string channelid)
1025 // { 1035 // {
@@ -1031,7 +1041,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1031 // return VivoxCall(requrl, true); 1041 // return VivoxCall(requrl, true);
1032 // } 1042 // }
1033 1043
1034 private static readonly string m_vivoxChannelDel = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; 1044 private static readonly string m_vivoxChannelDel = "https://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}";
1035 1045
1036 /// <summary> 1046 /// <summary>
1037 /// Delete a channel. 1047 /// Delete a channel.
@@ -1044,6 +1054,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1044 /// are required in a later phase. 1054 /// are required in a later phase.
1045 /// In this case the call handles parent and description as optional values. 1055 /// In this case the call handles parent and description as optional values.
1046 /// </summary> 1056 /// </summary>
1057
1047 private XmlElement VivoxDeleteChannel(string parent, string channelid) 1058 private XmlElement VivoxDeleteChannel(string parent, string channelid)
1048 { 1059 {
1049 string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); 1060 string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken);
@@ -1054,11 +1065,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1054 return VivoxCall(requrl, true); 1065 return VivoxCall(requrl, true);
1055 } 1066 }
1056 1067
1057 private static readonly string m_vivoxChannelSearch = "http://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}"; 1068 private static readonly string m_vivoxChannelSearch = "https://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}";
1058 1069
1059 /// <summary> 1070 /// <summary>
1060 /// Return information on channels in the given directory 1071 /// Return information on channels in the given directory
1061 /// </summary> 1072 /// </summary>
1073
1062 private XmlElement VivoxListChildren(string channelid) 1074 private XmlElement VivoxListChildren(string channelid)
1063 { 1075 {
1064 string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken); 1076 string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken);
@@ -1124,7 +1136,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1124 try 1136 try
1125 { 1137 {
1126 // Otherwise prepare the request 1138 // Otherwise prepare the request
1127 m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); 1139 //m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl);
1128 1140
1129 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); 1141 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
1130 1142
@@ -1324,5 +1336,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1324 result = String.Empty; 1336 result = String.Empty;
1325 return false; 1337 return false;
1326 } 1338 }
1339
1340 private void HandleDebug(string module, string[] cmd)
1341 {
1342 if (cmd.Length < 3)
1343 {
1344 MainConsole.Instance.Output("Error: missing on/off flag");
1345 return;
1346 }
1347
1348 if (cmd[2] == "on")
1349 m_dumpXml = true;
1350 else if (cmd[2] == "off")
1351 m_dumpXml = false;
1352 else
1353 MainConsole.Instance.Output("Error: only on and off are supported");
1354 }
1327 } 1355 }
1328} 1356}
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 1565da9..8d587b9 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
79 private IMessageTransferModule m_msgTransferModule; 79 private IMessageTransferModule m_msgTransferModule;
80 80
81 private IGroupsMessagingModule m_groupsMessagingModule; 81 private IGroupsMessagingModule m_groupsMessagingModule;
82 82
83 private IGroupsServicesConnector m_groupData; 83 private IGroupsServicesConnector m_groupData;
84 84
85 // Configuration settings 85 // Configuration settings
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
205 } 205 }
206 206
207 scene.EventManager.OnNewClient += OnNewClient; 207 scene.EventManager.OnNewClient += OnNewClient;
208 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
209 scene.EventManager.OnMakeChildAgent += OnMakeChild;
208 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 210 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
209 // The InstantMessageModule itself doesn't do this, 211 scene.EventManager.OnClientClosed += OnClientClosed;
210 // so lets see if things explode if we don't do it
211 // scene.EventManager.OnClientClosed += OnClientClosed;
212 212
213 } 213 }
214 214
@@ -233,7 +233,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
233 if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); 233 if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module.");
234 } 234 }
235 235
236 public Type ReplaceableInterface 236 public Type ReplaceableInterface
237 { 237 {
238 get { return null; } 238 get { return null; }
239 } 239 }
@@ -255,84 +255,121 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
255 #endregion 255 #endregion
256 256
257 #region EventHandlers 257 #region EventHandlers
258
259 private void OnMakeRoot(ScenePresence sp)
260 {
261 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
262
263 sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
264 // Used for Notices and Group Invites/Accept/Reject
265 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
266
267 // comented out because some viewers no longer suport it
268 // sp.ControllingClient.AddGenericPacketHandler("avatargroupsrequest", AvatarGroupsRequest);
269
270 // we should send a DataUpdate here for compatibility,
271 // but this is a bad place and a bad thread to do it
272 // also current viewers do ignore it and ask later on a much nicer thread
273 }
274
275 private void OnMakeChild(ScenePresence sp)
276 {
277 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
278
279 sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
280 sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
281 }
282
258 private void OnNewClient(IClientAPI client) 283 private void OnNewClient(IClientAPI client)
259 { 284 {
260 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 285 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
261 286
262 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
263 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 287 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
264 client.OnRequestAvatarProperties += OnRequestAvatarProperties; 288 client.OnRequestAvatarProperties += OnRequestAvatarProperties;
265 289
266 // Used for Notices and Group Invites/Accept/Reject
267 client.OnInstantMessage += OnInstantMessage;
268 290
269 // Send client their groups information.
270 SendAgentGroupDataUpdate(client, client.AgentId);
271 } 291 }
272 292
293/* this should be the right message to ask for other avatars groups
294
295 private void AvatarGroupsRequest(Object sender, string method, List<String> args)
296 {
297 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
298
299 if (!(sender is IClientAPI))
300 return;
301
302 IClientAPI remoteClient = (IClientAPI)sender;
303
304 UUID avatarID;
305 UUID.TryParse(args[0], out avatarID);
306
307 if (avatarID != UUID.Zero)
308 {
309 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
310 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
311 }
312 }
313*/
314
315 // this should not be used to send groups memberships, but some viewers do expect it
316 // it does send unnecessary memberships, when viewers just want other properties information
273 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 317 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
274 { 318 {
275 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 319 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
276 320
277 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
278 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); 321 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
279 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 322 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
280 } 323 }
281 324
282 /* 325
283 * This becomes very problematic in a shared module. In a shared module you may have more then one 326 private void OnClientClosed(UUID AgentId, Scene scene)
284 * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
285 * The OnClientClosed event does not provide anything to indicate which one of those should be closed
286 * nor does it provide what scene it was from so that the specific reference can be looked up.
287 * The InstantMessageModule.cs does not currently worry about unregistering the handles,
288 * and it should be an issue, since it's the client that references us not the other way around
289 * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
290 private void OnClientClosed(UUID AgentId)
291 { 327 {
292 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 328 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
329 if (scene == null)
330 return;
293 331
294 lock (m_ActiveClients) 332 ScenePresence sp = scene.GetScenePresence(AgentId);
333 IClientAPI client = sp.ControllingClient;
334 if (client != null)
295 { 335 {
296 if (m_ActiveClients.ContainsKey(AgentId)) 336 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
337 client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
338 // make child possible not called?
339 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
340 client.OnInstantMessage -= OnInstantMessage;
341 }
342
343/*
344 lock (m_ActiveClients)
297 { 345 {
298 IClientAPI client = m_ActiveClients[AgentId]; 346 if (m_ActiveClients.ContainsKey(AgentId))
299 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; 347 {
300 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; 348 IClientAPI client = m_ActiveClients[AgentId];
301 client.OnDirFindQuery -= OnDirFindQuery; 349 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
302 client.OnInstantMessage -= OnInstantMessage; 350 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
351 client.OnDirFindQuery -= OnDirFindQuery;
352 client.OnInstantMessage -= OnInstantMessage;
303 353
304 m_ActiveClients.Remove(AgentId); 354 m_ActiveClients.Remove(AgentId);
305 } 355 }
306 else 356 else
307 { 357 {
308 if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); 358 if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here.");
359 }
309 } 360 }
310 361*/
311
312 }
313 } 362 }
314 */
315 363
316 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 364 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
317 { 365 {
318 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 366 // this a private message for own agent only
319 367 if (dataForAgentID != GetRequestingAgentID(remoteClient))
320 UUID activeGroupID = UUID.Zero; 368 return;
321 string activeGroupTitle = string.Empty;
322 string activeGroupName = string.Empty;
323 ulong activeGroupPowers = (ulong)GroupPowers.None;
324
325 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient), dataForAgentID);
326 if (membership != null)
327 {
328 activeGroupID = membership.GroupID;
329 activeGroupTitle = membership.GroupTitle;
330 activeGroupPowers = membership.GroupPowers;
331 }
332
333 SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle);
334 369
335 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); 370 SendAgentGroupDataUpdate(remoteClient, false);
371 // its a info request not a change, so nothing is sent to others
372 // they do get the group title with the avatar object update on arrivel to a region
336 } 373 }
337 374
338 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) 375 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
@@ -403,7 +440,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
403 440
404 OutgoingInstantMessage(msg, inviteInfo.AgentID); 441 OutgoingInstantMessage(msg, inviteInfo.AgentID);
405 442
406 UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); 443 IClientAPI client = GetActiveClient(inviteInfo.AgentID);
444 if (client != null)
445 SendDataUpdate(remoteClient, true);
407 446
408 // TODO: If the inviter is still online, they need an agent dataupdate 447 // TODO: If the inviter is still online, they need an agent dataupdate
409 // and maybe group membership updates for the invitee 448 // and maybe group membership updates for the invitee
@@ -656,13 +695,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
656 { 695 {
657 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 696 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
658 697
659 m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 698 UUID agentID = GetRequestingAgentID(remoteClient);
699 m_groupData.SetAgentActiveGroup(agentID, agentID, groupID);
660 700
661 // Changing active group changes title, active powers, all kinds of things 701 // llClientView does this
662 // anyone who is in any region that can see this client, should probably be 702 SendAgentGroupDataUpdate(remoteClient, true);
663 // updated with new group info. At a minimum, they should get ScenePresence
664 // updated with new title.
665 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
666 } 703 }
667 704
668 /// <summary> 705 /// <summary>
@@ -672,7 +709,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
672 { 709 {
673 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 710 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
674 711
675
676 List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 712 List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
677 GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 713 GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
678 714
@@ -710,7 +746,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
710 } 746 }
711 747
712 return data; 748 return data;
713
714 } 749 }
715 750
716 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) 751 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
@@ -848,7 +883,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
848 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 883 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
849 884
850 // Update the founder with new group information. 885 // Update the founder with new group information.
851 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 886 SendAgentGroupDataUpdate(remoteClient, false);
852 887
853 return groupID; 888 return groupID;
854 } 889 }
@@ -889,10 +924,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
889 // TODO: Not sure what all is needed here, but if the active group role change is for the group 924 // TODO: Not sure what all is needed here, but if the active group role change is for the group
890 // the client currently has set active, then we need to do a scene presence update too 925 // the client currently has set active, then we need to do a scene presence update too
891 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) 926 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
892
893 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
894 }
895 927
928 SendDataUpdate(remoteClient, true);
929 }
896 930
897 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) 931 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType)
898 { 932 {
@@ -929,7 +963,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
929 } 963 }
930 964
931 // TODO: This update really should send out updates for everyone in the role that just got changed. 965 // TODO: This update really should send out updates for everyone in the role that just got changed.
932 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 966 SendAgentGroupDataUpdate(remoteClient, false);
933 } 967 }
934 968
935 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) 969 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
@@ -955,7 +989,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
955 } 989 }
956 990
957 // TODO: This update really should send out updates for everyone in the role that just got changed. 991 // TODO: This update really should send out updates for everyone in the role that just got changed.
958 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 992 SendAgentGroupDataUpdate(remoteClient, false);
959 } 993 }
960 994
961 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) 995 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
@@ -983,7 +1017,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
983 msg.toAgentID = agentID.Guid; 1017 msg.toAgentID = agentID.Guid;
984 msg.dialog = dialog; 1018 msg.dialog = dialog;
985 msg.fromGroup = true; 1019 msg.fromGroup = true;
986 msg.offline = (byte)0; 1020 msg.offline = (byte)1; // Allow this message to be stored for offline use
987 msg.ParentEstateID = 0; 1021 msg.ParentEstateID = 0;
988 msg.Position = Vector3.Zero; 1022 msg.Position = Vector3.Zero;
989 msg.RegionID = UUID.Zero.Guid; 1023 msg.RegionID = UUID.Zero.Guid;
@@ -1035,14 +1069,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1035 return msg; 1069 return msg;
1036 } 1070 }
1037 1071
1038 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1039 {
1040 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1041
1042 // Send agent information about his groups
1043 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
1044 }
1045
1046 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) 1072 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
1047 { 1073 {
1048 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1074 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -1052,8 +1078,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1052 1078
1053 remoteClient.SendJoinGroupReply(groupID, true); 1079 remoteClient.SendJoinGroupReply(groupID, true);
1054 1080
1055 // Should this send updates to everyone in the group? 1081 SendAgentGroupDataUpdate(remoteClient, true);
1056 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
1057 } 1082 }
1058 1083
1059 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) 1084 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID)
@@ -1068,7 +1093,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1068 1093
1069 // SL sends out notifcations to the group messaging session that the person has left 1094 // SL sends out notifcations to the group messaging session that the person has left
1070 // Should this also update everyone who is in the group? 1095 // Should this also update everyone who is in the group?
1071 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1096 SendAgentGroupDataUpdate(remoteClient, true);
1072 } 1097 }
1073 1098
1074 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) 1099 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
@@ -1177,10 +1202,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1177 msg.binaryBucket = new byte[0]; 1202 msg.binaryBucket = new byte[0];
1178 OutgoingInstantMessage(msg, agentID); 1203 OutgoingInstantMessage(msg, agentID);
1179 1204
1180
1181 // SL sends out messages to everyone in the group 1205 // SL sends out messages to everyone in the group
1182 // Who all should receive updates and what should they be updated with? 1206 // Who all should receive updates and what should they be updated with?
1183 UpdateAllClientsWithGroupInfo(ejecteeID); 1207 // just tell this the group change
1208 SendAgentGroupDataUpdate(remoteClient, false);
1209 // TODO fix the rest of sends
1184 } 1210 }
1185 1211
1186 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) 1212 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
@@ -1303,67 +1329,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1303 return child; 1329 return child;
1304 } 1330 }
1305 1331
1306 /// <summary>
1307 /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
1308 /// </summary>
1309 private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
1310 {
1311 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1312
1313 OSDArray AgentData = new OSDArray(1);
1314 OSDMap AgentDataMap = new OSDMap(1);
1315 AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
1316 AgentData.Add(AgentDataMap);
1317
1318 OSDArray GroupData = new OSDArray(data.Length);
1319 OSDArray NewGroupData = new OSDArray(data.Length);
1320
1321 foreach (GroupMembershipData membership in data)
1322 {
1323 if (GetRequestingAgentID(remoteClient) != dataForAgentID)
1324 {
1325 if (!membership.ListInProfile)
1326 {
1327 // If we're sending group info to remoteclient about another agent,
1328 // filter out groups the other agent doesn't want to share.
1329 continue;
1330 }
1331 }
1332
1333 OSDMap GroupDataMap = new OSDMap(6);
1334 OSDMap NewGroupDataMap = new OSDMap(1);
1335
1336 GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
1337 GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
1338 GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
1339 GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
1340 GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
1341 GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
1342 NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
1343
1344 GroupData.Add(GroupDataMap);
1345 NewGroupData.Add(NewGroupDataMap);
1346 }
1347
1348 OSDMap llDataStruct = new OSDMap(3);
1349 llDataStruct.Add("AgentData", AgentData);
1350 llDataStruct.Add("GroupData", GroupData);
1351 llDataStruct.Add("NewGroupData", NewGroupData);
1352
1353 if (m_debugEnabled)
1354 {
1355 m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct));
1356 }
1357
1358 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
1359
1360 if (queue != null)
1361 {
1362 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
1363 }
1364
1365 }
1366
1367 private void SendScenePresenceUpdate(UUID AgentID, string Title) 1332 private void SendScenePresenceUpdate(UUID AgentID, string Title)
1368 { 1333 {
1369 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Updating scene title for {0} with title: {1}", AgentID, Title); 1334 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Updating scene title for {0} with title: {1}", AgentID, Title);
@@ -1380,54 +1345,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1380 presence.Grouptitle = Title; 1345 presence.Grouptitle = Title;
1381 1346
1382 if (! presence.IsChildAgent) 1347 if (! presence.IsChildAgent)
1383 presence.SendAvatarDataToAllClients(); 1348 presence.SendAvatarDataToAllAgents();
1384 } 1349 }
1385 } 1350 }
1386 } 1351 }
1387 } 1352 }
1388 1353
1389 /// <summary> 1354 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1390 /// Send updates to all clients who might be interested in groups data for dataForClientID
1391 /// </summary>
1392 private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
1393 { 1355 {
1394 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1356 SendAgentGroupDataUpdate(remoteClient, true);
1395
1396 // TODO: Probably isn't nessesary to update every client in every scene.
1397 // Need to examine client updates and do only what's nessesary.
1398 lock (m_sceneList)
1399 {
1400 foreach (Scene scene in m_sceneList)
1401 {
1402 scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
1403 }
1404 }
1405 } 1357 }
1406 1358
1407 /// <summary> 1359 /// <summary>
1408 /// Update remoteClient with group information about dataForAgentID 1360 /// Tell remoteClient about its agent groups, and optionally send title to others
1409 /// </summary> 1361 /// </summary>
1410 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) 1362 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
1411 { 1363 {
1412 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); 1364 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
1413 1365
1414 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1366 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
1415 1367
1416 OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); 1368 UUID agentID = GetRequestingAgentID(remoteClient);
1417 1369
1418 // Need to send a group membership update to the client 1370 SendDataUpdate(remoteClient, tellOthers);
1419 // UDP version doesn't seem to behave nicely. But we're going to send it out here
1420 // with an empty group membership to hopefully remove groups being displayed due
1421 // to the core Groups Stub
1422 remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1423 1371
1424 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1372 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
1425 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); 1373 remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray);
1426 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
1427 1374
1428 if (remoteClient.AgentId == dataForAgentID) 1375 remoteClient.RefreshGroupMembership();
1429 remoteClient.RefreshGroupMembership(); 1376 }
1430 }
1431 1377
1432 /// <summary> 1378 /// <summary>
1433 /// Get a list of groups memberships for the agent that are marked "ListInProfile" 1379 /// Get a list of groups memberships for the agent that are marked "ListInProfile"
@@ -1478,13 +1424,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1478 return membershipArray; 1424 return membershipArray;
1479 } 1425 }
1480 1426
1481 1427 //tell remoteClient about its agent group info, and optionally send title to others
1482 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1428 private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
1483 { 1429 {
1484 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1430 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1485 1431
1486 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1432 UUID activeGroupID = UUID.Zero;
1487 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); 1433 string activeGroupTitle = string.Empty;
1434 string activeGroupName = string.Empty;
1435 ulong activeGroupPowers = (ulong)GroupPowers.None;
1436
1437 UUID agentID = GetRequestingAgentID(remoteClient);
1438 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID, agentID);
1439 if (membership != null)
1440 {
1441 activeGroupID = membership.GroupID;
1442 activeGroupTitle = membership.GroupTitle;
1443 activeGroupPowers = membership.GroupPowers;
1444 activeGroupName = membership.GroupName;
1445 }
1446
1447 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
1488 string firstname, lastname; 1448 string firstname, lastname;
1489 if (account != null) 1449 if (account != null)
1490 { 1450 {
@@ -1497,9 +1457,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1497 lastname = "Unknown"; 1457 lastname = "Unknown";
1498 } 1458 }
1499 1459
1500 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, 1460 remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
1501 lastname, activeGroupPowers, activeGroupName, 1461 lastname, activeGroupPowers, activeGroupName,
1502 activeGroupTitle); 1462 activeGroupTitle);
1463
1464 if (tellOthers)
1465 SendScenePresenceUpdate(agentID, activeGroupTitle);
1466
1467 ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
1468 if (sp != null)
1469 sp.Grouptitle = activeGroupTitle;
1503 } 1470 }
1504 1471
1505 #endregion 1472 #endregion