Exemplo n.º 1
0
        public void RegionLoaded(Scene scene)
        {
            //            m_log.DebugFormat("[EVENT RECORDER]: REGION {0} LOADED", scene.RegionInfo.RegionName);

            RegionsLoadedCount++;

            if (RegionsLoadedCount == RegionsMonitoredCount && !Enabled)
            {
                m_userManagementModule = scene.RequestModuleInterface <IUserManagement>();

                if (m_userManagementModule == null)
                {
                    m_log.ErrorFormat("[EVENT RECORDER]: IUserManagement module required but not present.  Not enabling.");
                    return;
                }

                // If this scene doesn't have a groups module then we shouldn't see any group requests.
                m_groupsModule = scene.RequestModuleInterface <IGroupsModule>();

                MainConsole.Instance.Commands.AddCommand(
                    "EventRecorder", true, "evr info", "evr info", "Show event recorder info", HandleInfoCommand);

                m_log.InfoFormat("[EVENT RECORDER]: Initialized with recorder {0}", m_recorder.Name);

                Enabled = true;

                m_recorder.Start();
            }
        }
Exemplo n.º 2
0
        private void GetOwnerName(UUID ownerID, out string ownerFirstName, out string ownerLastName)
        {
            ownerFirstName = string.Empty;
            ownerLastName  = string.Empty;
            string username = m_scene.UserManagementModule.GetUserName(ownerID);

            if (!string.IsNullOrEmpty(username) && !username.StartsWith("UnknownUMM2", StringComparison.InvariantCulture))
            {
                string[] parts = username.Split(' ');
                ownerFirstName = parts[0];
                if (parts.Length > 1)
                {
                    ownerLastName = parts[1];
                }
            }
            else
            {
                IGroupsModule groups = m_scene.RequestModuleInterface <IGroupsModule>();
                if (groups != null)
                {
                    GroupRecord grprec = groups.GetGroupRecord(ownerID);
                    if (grprec != null && !string.IsNullOrEmpty(grprec.GroupName))
                    {
                        ownerFirstName = grprec.GroupName;
                    }
                }
            }
            if (string.IsNullOrEmpty(ownerFirstName))
            {
                ownerFirstName = "(unknown)";
                ownerLastName  = string.Empty;
            }
        }
        public void TestShareWithGroup()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");

            TestScene     scene        = SceneHelpers.SetupScene();
            IConfigSource configSource = new IniConfigSource();

            IConfig startupConfig = configSource.AddConfig("Startup");

            startupConfig.Set("serverside_object_permissions", true);

            IConfig groupsConfig = configSource.AddConfig("Groups");

            groupsConfig.Set("Enabled", true);
            groupsConfig.Set("Module", "GroupsModule");
            groupsConfig.Set("DebugEnabled", true);

            SceneHelpers.SetupSceneModules(
                scene, configSource, new object[]
                { new PermissionsModule(),
                  new GroupsModule(),
                  new MockGroupsServicesConnector() });

            IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;

            IGroupsModule groupsModule = scene.RequestModuleInterface <IGroupsModule>();

            groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Check that the required groups structure is in place.
        /// </summary>
        /// <exception cref="GroupsException">Thrown if there is something wrong with the groups setup</exception>
        public void CheckForRequiredSetup()
        {
            if (!WaterWarsConstants.ENABLE_GROUPS)
            {
                return;
            }

            if (null == m_groupsModule)
            {
                m_groupsModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsModule>();

                if (null == m_groupsModule)
                {
                    throw new GroupsSetupException("No groups module present on server");
                }
            }

            if (null == m_groupsMessagingModule)
            {
                m_groupsMessagingModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsMessagingModule>();

                if (null == m_groupsMessagingModule)
                {
                    throw new GroupsSetupException("No groups messaging module present on server");
                }
            }

            if (null == WaterWarsGroup)
            {
                WaterWarsGroup = GetGroup(WaterWarsConstants.GROUP_NAME);
            }

            if (null == WaterWarsAdminGroup)
            {
                WaterWarsAdminGroup = GetGroup(WaterWarsConstants.ADMIN_GROUP_NAME);
            }

            m_systemAccount
                = m_controller.Scenes[0].UserAccountService.GetUserAccount(
                      UUID.Zero, WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            string name
                = string.Format(
                      "{0} {1}", WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            if (null == m_systemAccount)
            {
                throw new GroupsSetupException(
                          string.Format(
                              "System player {0} not present.  Please create this player before restarting OpenSim", name));
            }

            if (!IsPlayerInRequiredGroup(m_systemAccount))
            {
                throw new GroupsSetupException(
                          string.Format(
                              "System player {0} is not in group {1}.  Please correct this.",
                              name, WaterWarsGroup.GroupName));
            }
        }
Exemplo n.º 5
0
        private void client_OnGroupAccountSummaryRequest(IClientAPI client, UUID agentID, UUID groupID, UUID requestID,
                                                         int currentInterval, int intervalDays)
        {
            IGroupsModule groupsModule = client.Scene.RequestModuleInterface <IGroupsModule>();

            if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable))
            {
                IMoneyModule moneyModule = client.Scene.RequestModuleInterface <IMoneyModule>();
                if (moneyModule != null)
                {
                    int          amt     = moneyModule.Balance(groupID);
                    GroupBalance balance = moneyModule.GetGroupBalance(groupID);
                    client.SendGroupAccountingSummary(client, groupID, requestID, amt, balance.TotalTierDebit,
                                                      balance.TotalTierCredits,
                                                      Util.BuildYMDDateString(
                                                          balance.StartingDate.AddDays(-currentInterval * intervalDays)),
                                                      currentInterval, intervalDays,
                                                      Util.BuildYMDDateString(balance.StartingDate.AddDays(intervalDays)),
                                                      Util.BuildYMDDateString(
                                                          balance.StartingDate.AddDays(-(currentInterval + 1) *
                                                                                       intervalDays)),
                                                      balance.ParcelDirectoryFee, balance.LandFee, balance.GroupFee,
                                                      balance.ObjectFee);
                }
                else
                {
                    client.SendGroupAccountingSummary(client, groupID, requestID, 0, 0, 0, "Never",
                                                      currentInterval, intervalDays, "Never",
                                                      "Never", 0, 0, 0, 0);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Sends the details about what
        /// </summary>
        /// <param name="client"></param>
        /// <param name="agentID"></param>
        /// <param name="groupID"></param>
        /// <param name="transactionID"></param>
        /// <param name="sessionID"></param>
        /// <param name="currentInterval"></param>
        /// <param name="intervalDays"></param>
        private void client_OnGroupAccountDetailsRequest(IClientAPI client, UUID agentID, UUID groupID,
                                                         UUID transactionID, UUID sessionID, int currentInterval,
                                                         int intervalDays)
        {
            IGroupsModule groupsModule = client.Scene.RequestModuleInterface <IGroupsModule>();

            if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable))
            {
                IMoneyModule moneyModule = client.Scene.RequestModuleInterface <IMoneyModule>();
                if (moneyModule != null)
                {
                    int amt = moneyModule.Balance(groupID);
                    List <GroupAccountHistory> history = moneyModule.GetTransactions(groupID, agentID, currentInterval,
                                                                                     intervalDays);
                    history = (from h in history where h.Stipend select h).ToList();
                    //We don't want payments, we only want stipends which we sent to users
                    GroupBalance balance = moneyModule.GetGroupBalance(groupID);
                    client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, amt, currentInterval,
                                                      intervalDays,
                                                      Util.BuildYMDDateString(
                                                          balance.StartingDate.AddDays(-currentInterval * intervalDays)),
                                                      history.ToArray());
                }
                else
                {
                    client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, 0, currentInterval,
                                                      intervalDays,
                                                      "Never", new GroupAccountHistory[0]);
                }
            }
        }
Exemplo n.º 7
0
        public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
        {
            m_rootScene = scene;

            m_loadPath = loadPath;
            try
            {
                m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
            }
            catch (EntryPointNotFoundException e)
            {
                m_log.ErrorFormat(
                    "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                    + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                m_log.Error(e);
            }

            m_errorMessage = String.Empty;
            m_merge        = merge;
            m_skipAssets   = skipAssets;
            m_requestId    = requestId;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface <IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 8
0
 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId, bool allowUserReassignment, bool skipErrorGroups)
 {
     m_scene                 = scene;
     m_loadStream            = loadStream;
     m_merge                 = merge;
     m_requestId             = requestId;
     m_allowUserReassignment = allowUserReassignment;
     m_GroupsModule          = scene.RequestModuleInterface <IGroupsModule>();
     m_skipErrorGroups       = skipErrorGroups;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Updates the userpicks
        /// </summary>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        /// <param name='pickID'>
        /// Pick I.
        /// </param>
        /// <param name='creatorID'>
        /// the creator of the pick
        /// </param>
        /// <param name='topPick'>
        /// Top pick.
        /// </param>
        /// <param name='name'>
        /// Name.
        /// </param>
        /// <param name='desc'>
        /// Desc.
        /// </param>
        /// <param name='snapshotID'>
        /// Snapshot I.
        /// </param>
        /// <param name='sortOrder'>
        /// Sort order.
        /// </param>
        /// <param name='enabled'>
        /// Enabled.
        /// </param>
        public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
        {
            m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
            UserProfilePick pick      = new UserProfilePick();
            string          serverURI = string.Empty;

            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
            ScenePresence p = FindPresence(remoteClient.AgentId);

            Vector3 avaPos = p.AbsolutePosition;
            // Getting the global position for the Avatar
            Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + avaPos.X,
                                            remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + avaPos.Y,
                                            avaPos.Z);

            string      landOwnerName = string.Empty;
            ILandObject land          = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y);

            if (land.LandData.IsGroupOwned)
            {
                IGroupsModule groupMod    = p.Scene.RequestModuleInterface <IGroupsModule>();
                UUID          groupId     = land.LandData.GroupID;
                GroupRecord   groupRecord = groupMod.GetGroupRecord(groupId);
                landOwnerName = groupRecord.GroupName;
            }
            else
            {
                IUserAccountService accounts = p.Scene.RequestModuleInterface <IUserAccountService>();
                UserAccount         user     = accounts.GetUserAccount(p.Scene.RegionInfo.ScopeID, land.LandData.OwnerID);
                landOwnerName = user.Name;
            }

            pick.PickId     = pickID;
            pick.CreatorId  = creatorID;
            pick.TopPick    = topPick;
            pick.Name       = name;
            pick.Desc       = desc;
            pick.ParcelId   = p.currentParcelUUID;
            pick.SnapshotId = snapshotID;
            pick.User       = landOwnerName;
            pick.SimName    = remoteClient.Scene.RegionInfo.RegionName;
            pick.GlobalPos  = posGlobal.ToString();
            pick.SortOrder  = sortOrder;
            pick.Enabled    = enabled;

            object Pick = (object)pick;

            if (!JsonRpcRequest(ref Pick, "picks_update", serverURI, UUID.Random().ToString()))
            {
                remoteClient.SendAgentAlertMessage(
                    "Error updating pick", false);
            }

            m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
        }
Exemplo n.º 10
0
 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId, bool allowUserReassignment, bool skipErrorGroups)
 {
     m_scene                 = scene;
     m_loadStream            = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
     m_errorMessage          = String.Empty;
     m_merge                 = merge;
     m_requestId             = requestId;
     m_allowUserReassignment = allowUserReassignment;
     m_GroupsModule          = scene.RequestModuleInterface <IGroupsModule>();
     m_skipErrorGroups       = skipErrorGroups;
 }
 public void RegionLoaded(IScene scene)
 {
     if (!m_SearchEnabled)
     {
         return;
     }
     //Pull in the services we need
     ProfileFrontend  = DataManager.DataManager.RequestPlugin <IProfileConnector>();
     directoryService = DataManager.DataManager.RequestPlugin <IDirectoryServiceConnector>();
     GroupsModule     = scene.RequestModuleInterface <IGroupsModule>();
 }
Exemplo n.º 12
0
        private bool CheckEstateGroups(EstateSettings ES, AgentCircuitData agent)
        {
            IGroupsModule gm = m_scene.RequestModuleInterface <IGroupsModule>();

            if (gm != null && ES.EstateGroups.Count > 0)
            {
                GroupMembershipData[] gmds = gm.GetMembershipData(agent.AgentID);
                return(gmds.Any(gmd => ES.EstateGroups.Contains(gmd.GroupID)));
            }
            return(false);
        }
Exemplo n.º 13
0
        public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary <string, object> options)
        {
            m_rootScene = scene;

            if (options.ContainsKey("default-user"))
            {
                m_defaultUser = (UUID)options["default-user"];
                m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
            }
            else
            {
                m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
            }

            m_loadPath = loadPath;
            try
            {
                m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
            }
            catch (EntryPointNotFoundException e)
            {
                m_log.ErrorFormat(
                    "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                    + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                m_log.Error(e);
            }

            m_errorMessage = String.Empty;
            m_merge        = options.ContainsKey("merge");
            m_forceTerrain = options.ContainsKey("force-terrain");
            m_forceParcels = options.ContainsKey("force-parcels");
            m_persistuuids = options.ContainsKey("persist-uuids");
            if (m_persistuuids)
            {
                m_merge = false;
            }
            m_noObjects      = options.ContainsKey("no-objects");
            m_skipAssets     = options.ContainsKey("skipAssets");
            m_requestId      = requestId;
            m_displacement   = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
            m_rotation       = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
            m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
                                : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);

            // Zero can never be a valid user or group id
            m_validUserUuids[UUID.Zero]  = false;
            m_validGroupUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface <IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 14
0
        /// <summary>
        ///     Constructor
        /// </summary>
        public LLClientView(EndPoint remoteEP, IScene scene, LLUDPServer udpServer, LLUDPClient udpClient,
                            AgentCircuitData sessionInfo,
                            UUID agentId, UUID sessionId, uint circuitCode)
        {
            startMem = GC.GetTotalMemory(false);

            InitDefaultAnimations();

            m_scene = scene;

            IConfig advancedConfig = m_scene.Config.Configs ["ClientStack.LindenUDP"];

            if (advancedConfig != null)
            {
                m_allowUDPInv = advancedConfig.GetBoolean("AllowUDPInventory", m_allowUDPInv);
            }

            //m_killRecord = new HashSet<uint>();
            //            m_attachmentsSent = new HashSet<uint>();

            m_assetService = m_scene.RequestModuleInterface <IAssetService> ();
            m_GroupsModule = scene.RequestModuleInterface <IGroupsModule> ();
            m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface <IJ2KDecoder> ());
            ISimulationBase simulationBase = m_scene.RequestModuleInterface <ISimulationBase> ();

            if (simulationBase != null)
            {
                m_channelVersion = Util.StringToBytes256(simulationBase.Version);
            }
            m_agentId         = agentId;
            m_sessionId       = sessionId;
            m_secureSessionId = sessionInfo.SecureSessionID;
            m_circuitCode     = circuitCode;
            m_userEndPoint    = remoteEP;
            UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.AllScopeIDs, m_agentId);

            if (account != null)
            {
                m_Name = account.Name;
            }

            StartPos = sessionInfo.StartingPosition;

            m_udpServer = udpServer;
            m_udpClient = udpClient;
            m_udpClient.OnQueueEmpty  += HandleQueueEmpty;
            m_udpClient.OnPacketStats += PopulateStats;

            RegisterLocalPacketHandlers();
        }
Exemplo n.º 15
0
        public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
        {
            m_rootScene  = scene;
            m_loadPath   = null;
            m_loadStream = loadStream;
            m_merge      = merge;
            m_skipAssets = skipAssets;
            m_requestId  = requestId;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface <IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
        public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary <string, object> options)
        {
            m_rootScene  = scene;
            m_loadPath   = null;
            m_loadStream = loadStream;
            m_skipAssets = options.ContainsKey("skipAssets");
            m_merge      = options.ContainsKey("merge");
            m_requestId  = requestId;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface <IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 17
0
        /**
         * @brief Allow any member of group given by config SetParcelMusicURLGroup to set music URL.
         *        Code modelled after llSetParcelMusicURL().
         * @param newurl = new URL to set (or "" to leave it alone)
         * @returns previous URL string
         */
        public string xmrSetParcelMusicURLGroup(string newurl)
        {
            string groupname = m_ScriptEngine.Config.GetString("SetParcelMusicURLGroup", "");

            if (groupname == "")
            {
                throw new ApplicationException("no SetParcelMusicURLGroup config param set");
            }

            IGroupsModule igm = World.RequestModuleInterface <IGroupsModule> ();

            if (igm == null)
            {
                throw new ApplicationException("no GroupsModule loaded");
            }

            GroupRecord grouprec = igm.GetGroupRecord(groupname);

            if (grouprec == null)
            {
                throw new ApplicationException("no such group " + groupname);
            }

            GroupMembershipData gmd = igm.GetMembershipData(grouprec.GroupID, m_host.OwnerID);

            if (gmd == null)
            {
                throw new ApplicationException("not a member of group " + groupname);
            }

            ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);

            if (land == null)
            {
                throw new ApplicationException("no land at " + m_host.AbsolutePosition.ToString());
            }
            string oldurl = land.GetMusicUrl();

            if (oldurl == null)
            {
                oldurl = "";
            }
            if ((newurl != null) && (newurl != ""))
            {
                land.SetMusicUrl(newurl);
            }
            return(oldurl);
        }
Exemplo n.º 18
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
            {
                return;
            }

            if (m_GroupsService == null)
            {
                m_GroupsService = scene.RequestModuleInterface <IGroupsModule>();
                if (m_GroupsService == null)
                {
                    m_log.Warn("[OPEN SEARCH MODULE]: Could not get IGroupsModule");
                }
            }
        }
Exemplo n.º 19
0
        public void RegionLoaded(Scene s)
        {
            if (!m_Enabled)
            {
                return;
            }

            if (m_GroupsService == null)
            {
                m_GroupsService = s.RequestModuleInterface <IGroupsModule>();

                // No Groups Service Connector, then group search won't work...
                if (m_GroupsService == null)
                {
                    m_log.Warn("[BASIC SEARCH MODULE]: Could not get IGroupsModule");
                }
            }
        }
Exemplo n.º 20
0
        public bool HasGroupAccess(UUID avatar)
        {
            if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
            {
                ScenePresence sp;
                if (!m_scene.TryGetScenePresence(avatar, out sp))
                {
                    bool isMember;
                    if (m_groupMemberCache.TryGetValue(avatar, out isMember))
                    {
                        m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout);
                        return(isMember);
                    }

                    IGroupsModule groupsModule = m_scene.RequestModuleInterface <IGroupsModule>();
                    if (groupsModule == null)
                    {
                        return(false);
                    }

                    GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar);
                    if (membership == null || membership.Length == 0)
                    {
                        m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
                        return(false);
                    }

                    foreach (GroupMembershipData d in membership)
                    {
                        if (d.GroupID == LandData.GroupID)
                        {
                            m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout);
                            return(true);
                        }
                    }
                    m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
                    return(false);
                }

                return(sp.ControllingClient.IsGroupMember(LandData.GroupID));
            }
            return(false);
        }
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupMessagingEnabled)
            {
                return;
            }

            if (m_debugEnabled)
            {
                m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            m_groupsModule = scene.RequestModuleInterface <IGroupsModule>();

            // No groups module, no groups messaging
            if (m_groupsModule == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled.");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface <IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get MessageTransferModule");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }


            m_sceneList.Add(scene);

            scene.EventManager.OnNewClient              += OnNewClient;
            scene.EventManager.OnRemovePresence         += OnRemovePresence;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
        }
Exemplo n.º 22
0
        public string ResolveGroupName(UUID groupID)
        {
            Scene         scene = GetRandomScene();
            IGroupsModule gm    = scene.RequestModuleInterface <IGroupsModule>();

            try
            {
                string @group = gm.GetGroupRecord(groupID).GroupName;
                if (@group != null)
                {
                    m_log.DebugFormat("[OMECONOMY]: Resolved group {0} to {1}", groupID, @group);
                    return(@group);
                }
            }
            catch (Exception)
            {
                m_log.ErrorFormat("[OMECONOMY]: Could not resolve group {0}", groupID);
            }

            return(String.Empty);
        }
Exemplo n.º 23
0
        public void RegionLoaded(IScene scene)
        {
            if (!m_groupMessagingEnabled)
            {
                return;
            }

            m_groupData    = scene.RequestModuleInterface <IGroupsServicesConnector>();
            m_groupsModule = scene.RequestModuleInterface <IGroupsModule>();

            // No groups module, no groups messaging
            if (m_groupData == null)
            {
                MainConsole.Instance.Error(
                    "[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface <IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                MainConsole.Instance.Error("[GROUPS-MESSAGING]: Could not get MessageTransferModule");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }


            m_sceneList.Add(scene);

            scene.EventManager.OnNewClient              += OnNewClient;
            scene.EventManager.OnClosingClient          += OnClosingClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientLogin            += OnClientLogin;
            scene.EventManager.OnChatSessionRequest     += OnChatSessionRequest;
        }
Exemplo n.º 24
0
        public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary <string, object> options)
        {
            m_rootScene    = scene;
            m_loadPath     = null;
            m_loadStream   = loadStream;
            m_skipAssets   = options.ContainsKey("skipAssets");
            m_merge        = options.ContainsKey("merge");
            m_persistuuids = options.ContainsKey("persist-uuids");
            if (m_persistuuids)
            {
                m_merge = false;
            }
            m_requestId = requestId;

            m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface <IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
        public void Close()
        {
            if (!m_groupMessagingEnabled)
            {
                return;
            }

            if (m_debugEnabled)
            {
                m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module.");
            }

            foreach (Scene scene in m_sceneList)
            {
                scene.EventManager.OnNewClient -= OnNewClient;
                scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
            }

            m_sceneList.Clear();

            m_groupsModule      = null;
            m_msgTransferModule = null;
        }
        UUID ResolveGroupUuid(UUID GroupID)
        {
            UUID u;

            if (!m_validGroupUuids.TryGetValue(GroupID, out u))
            {
                IGroupsModule groups = m_scene.RequestModuleInterface <IGroupsModule> ();
                if (groups != null)
                {
                    GroupRecord gr = groups.GetGroupRecord(GroupID);
                    if (gr != null)
                    {
                        m_validGroupUuids.Add(GroupID, GroupID);
                    }
                    else
                    {
                        m_validGroupUuids.Add(GroupID, UUID.Zero);          // GroupID does not exist.. keep track
                    }
                }
                return(m_validGroupUuids [GroupID]);
            }

            return(u);
        }
Exemplo n.º 27
0
        public string resolveName(UUID objecUUID)
        {
            // try avatar username surname
            UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, objecUUID);

            if (account != null)
            {
                return(account.Name);
            }

            // try an scene object
            ISceneChildEntity SOP = World.GetSceneObjectPart(objecUUID);

            if (SOP != null)
            {
                return(SOP.Name);
            }

            ISceneChildEntity SensedObject;

            if (!World.TryGetPart(objecUUID, out SensedObject))
            {
                IGroupsModule groups = World.RequestModuleInterface <IGroupsModule>();
                if (groups != null)
                {
                    GroupRecord gr = groups.GetGroupRecord(objecUUID);
                    if (gr != null)
                    {
                        return(gr.GroupName);
                    }
                }
                return(String.Empty);
            }

            return(SensedObject.Name);
        }
Exemplo n.º 28
0
        public void PostInitialise()
        {
            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();

            if (m_friendsModule == null)
                m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");

            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            if (m_groupsModule == null)
                m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");        
        }
Exemplo n.º 29
0
        public void RegionLoaded(IScene scene)
        {
            if (!m_groupMessagingEnabled)
                return;

            m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
            m_groupsModule = scene.RequestModuleInterface<IGroupsModule>();

            // No groups module, no groups messaging
            if (m_groupData == null)
            {
                MainConsole.Instance.Error(
                    "[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                MainConsole.Instance.Error("[GROUPS-MESSAGING]: Could not get MessageTransferModule");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }


            m_sceneList.Add(scene);

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnClosingClient += OnClosingClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientLogin += OnClientLogin;
            scene.EventManager.OnChatSessionRequest += OnChatSessionRequest;
        }
Exemplo n.º 30
0
 public void RegionLoaded(Scene scene)
 {
     if (!m_SearchEnabled)
         return;
     //Pull in the services we need
     ProfileFrontend = DataManager.DataManager.RequestPlugin<IProfileConnector>();
     directoryService = Aurora.DataManager.DataManager.RequestPlugin<IDirectoryServiceConnector>();
     GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
 }
Exemplo n.º 31
0
        private void UndeliveredMessage(GridInstantMessage im, string reason)
        {
            if (OfflineMessagesConnector == null || im == null)
            {
                return;
            }
            IClientAPI client = FindClient(im.FromAgentID);

            if ((client == null) && (im.Dialog != 32))
            {
                return;
            }
            if (!OfflineMessagesConnector.AddOfflineMessage(im))
            {
                if ((!im.FromGroup) && (reason != "User does not exist.") && (client != null))
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "User has too many IMs already, please try again later.",
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }
                else if (client == null)
                {
                    return;
                }
            }
            else if ((im.Offline != 0) &&
                     (!im.FromGroup || im.FromGroup))
            {
                if (im.Dialog == 32) //Group notice
                {
                    IGroupsModule module = m_Scene.RequestModuleInterface <IGroupsModule>();
                    if (module != null)
                    {
                        im = module.BuildOfflineGroupNotice(im);
                    }
                    return;
                }
                if (client == null)
                {
                    return;
                }
                IEmailModule emailModule = m_Scene.RequestModuleInterface <IEmailModule>();
                if (emailModule != null && m_SendOfflineMessagesToEmail)
                {
                    IUserProfileInfo profile =
                        Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>().GetUserProfile(im.ToAgentID);
                    if (profile != null && profile.IMViaEmail)
                    {
                        UserAccount account = m_Scene.UserAccountService.GetUserAccount(null, im.ToAgentID);
                        if (account != null && !string.IsNullOrEmpty(account.Email))
                        {
                            emailModule.SendEmail(UUID.Zero, account.Email,
                                                  string.Format("Offline Message from {0}", im.FromAgentName),
                                                  string.Format("Time: {0}\n",
                                                                Util.ToDateTime(im.Timestamp).ToShortDateString()) +
                                                  string.Format("From: {0}\n", im.FromAgentName) +
                                                  string.Format("Message: {0}\n", im.Message), m_Scene);
                        }
                    }
                }

                if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup)
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "Message saved, reason: " + reason,
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }

                if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    client.SendAlertMessage("User is not online. Inventory has been saved");
                }
            }
            else if (im.Offline == 0)
            {
                if (client == null)
                {
                    return;
                }
                if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup)
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "Message saved, reason: " + reason,
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }

                if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    client.SendAlertMessage("User not able to be found. Inventory has been saved");
                }
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Check that the required groups structure is in place.
        /// </summary>
        /// <exception cref="GroupsException">Thrown if there is something wrong with the groups setup</exception>
        public void CheckForRequiredSetup()
        {
            if (!WaterWarsConstants.ENABLE_GROUPS)
                return;

            if (null == m_groupsModule)
            {
                m_groupsModule = m_controller.Scenes[0].RequestModuleInterface<IGroupsModule>();

                if (null == m_groupsModule)
                    throw new GroupsSetupException("No groups module present on server");
            }

            if (null == m_groupsMessagingModule)
            {
                m_groupsMessagingModule = m_controller.Scenes[0].RequestModuleInterface<IGroupsMessagingModule>();

                if (null == m_groupsMessagingModule)
                    throw new GroupsSetupException("No groups messaging module present on server");
            }

            if (null == WaterWarsGroup)
                WaterWarsGroup = GetGroup(WaterWarsConstants.GROUP_NAME);

            if (null == WaterWarsAdminGroup)
                WaterWarsAdminGroup = GetGroup(WaterWarsConstants.ADMIN_GROUP_NAME);

            m_systemAccount
                = m_controller.Scenes[0].UserAccountService.GetUserAccount(
                    UUID.Zero, WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            string name
                = string.Format(
                    "{0} {1}", WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            if (null == m_systemAccount)
                throw new GroupsSetupException(
                    string.Format(
                        "System player {0} not present.  Please create this player before restarting OpenSim", name));

            if (!IsPlayerInRequiredGroup(m_systemAccount))
                throw new GroupsSetupException(
                    string.Format(
                        "System player {0} is not in group {1}.  Please correct this.",
                        name, WaterWarsGroup.GroupName));
        }
Exemplo n.º 33
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupMessagingEnabled)
                return;

            if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            m_groupsModule = scene.RequestModuleInterface<IGroupsModule>();

            // No groups module, no groups messaging
            if (m_groupsModule == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled.");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get MessageTransferModule");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }


            m_sceneList.Add(scene);

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;

        }
Exemplo n.º 34
0
        public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
        {
            m_rootScene = scene;
            m_loadPath = null;
            m_loadStream = loadStream;
            m_merge = merge;
            m_skipAssets = skipAssets;
            m_requestId = requestId;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 35
0
        public void RegionLoaded(Scene s)
        {
            if (!m_Enabled)
                return;

            if (m_GroupsService == null)
            {
                m_GroupsService = s.RequestModuleInterface<IGroupsModule>();

                // No Groups Service Connector, then group search won't work...
                if (m_GroupsService == null)
                    m_log.Warn("[BASIC SEARCH MODULE]: Could not get IGroupsModule");
            }
        }
Exemplo n.º 36
0
 /// <summary>
 /// Sets up references to modules required by the scene
 /// </summary>
 public void SetModuleInterfaces()
 {
     m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
     m_worldCommModule = RequestModuleInterface<IWorldComm>();
     XferManager = RequestModuleInterface<IXfer>();
     m_AvatarFactory = RequestModuleInterface<IAvatarFactoryModule>();
     AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
     m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
     m_dialogModule = RequestModuleInterface<IDialogModule>();
     m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
     EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
     m_groupsModule = RequestModuleInterface<IGroupsModule>();
     AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>();
     UserManagementModule = RequestModuleInterface<IUserManagement>();
 }
Exemplo n.º 37
0
 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId, bool allowUserReassignment, bool skipErrorGroups)
 {
     m_scene = scene;
     m_loadStream = loadStream;
     m_merge = merge;
     m_requestId = requestId;
     m_allowUserReassignment = allowUserReassignment;
     m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
     m_skipErrorGroups = skipErrorGroups;
 }
        public void RegionLoaded(IScene scene)
        {
            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();

            m_parcelManagement = m_scene.RequestModuleInterface<IParcelManagementModule>();
        }
Exemplo n.º 39
0
        public void RegionLoaded(IScene scene)
        {
            //if (m_friendsModule == null)
            //    MainConsole.Instance.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");

            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            //if (m_groupsModule == null)
            //    MainConsole.Instance.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");

            m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();

            // This log line will be commented out when no longer required for debugging
//            if (m_moapModule == null)
//                MainConsole.Instance.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");

            m_parcelManagement = m_scene.RequestModuleInterface<IParcelManagementModule>();
        }
        public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
        {
            m_rootScene = scene;

            if (options.ContainsKey("default-user"))
            {
                m_defaultUser = (UUID)options["default-user"];
                m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
            }
            else 
            {
                m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
            }

            m_loadPath = loadPath;
            try
            {
                m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
            }
            catch (EntryPointNotFoundException e)
            {
                m_log.ErrorFormat(
                    "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                        + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                m_log.Error(e);
            }
        
            m_errorMessage = String.Empty;
            m_merge = options.ContainsKey("merge");
            m_forceTerrain = options.ContainsKey("force-terrain");
            m_forceParcels = options.ContainsKey("force-parcels");
            m_noObjects = options.ContainsKey("no-objects");
            m_skipAssets = options.ContainsKey("skipAssets");
            m_requestId = requestId;
            m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
            m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
            m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] 
                                : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);

            // Zero can never be a valid user or group id
            m_validUserUuids[UUID.Zero] = false;
            m_validGroupUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 41
0
        protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            Dictionary <string, object> request = new Dictionary <string, object>();

            foreach (string name in httpRequest.QueryString)
            {
                request[name] = httpRequest.QueryString[name];
            }

            httpResponse.ContentType = "application/json";

            mainDataSet _dataSet = new mainDataSet();

            foreach (Scene _scene in m_scenes)
            {
                try
                {
                    if (_scene != null)
                    {
                        regionDataSet _regionData = new regionDataSet();

                        _regionData.RegionName              = ToUTF8(_scene.Name);
                        _regionData.RegionEstate            = ToUTF8(_scene.RegionInfo.EstateSettings.EstateName);
                        _regionData.RegionImageUUID         = _scene.RegionInfo.lastMapUUID.ToString();
                        _regionData.RegionPosition          = _scene.RegionInfo.WorldLocX + "/" + _scene.RegionInfo.WorldLocY;
                        _regionData.RegionPublicAccess      = _scene.RegionInfo.EstateSettings.PublicAccess;
                        _regionData.RegionSize              = _scene.RegionInfo.RegionSizeX.ToString();
                        _regionData.RegionUUID              = _scene.RegionInfo.RegionID.ToString();
                        _regionData.RegionIsVisibleInSearch = true;

                        if (m_config.Configs["Hypergrid"] != null)
                        {
                            _regionData.RegionHomeURI = m_config.Configs["Hypergrid"].GetString("HomeURI", string.Empty);
                        }

                        _dataSet.RegionData.Add(_regionData);

                        List <ILandObject> _landData = _scene.LandChannel.AllParcels();
                        foreach (ILandObject _parcel in _landData)
                        {
                            try
                            {
                                parcelDataSet _parcelSet = new parcelDataSet();

                                if (_parcel.LandData != null)
                                {
                                    _parcelSet.ParcelName            = ToUTF8(_parcel.LandData.Name);
                                    _parcelSet.ParcelDescription     = ToUTF8(_parcel.LandData.Description);
                                    _parcelSet.ImageUUID             = _parcel.LandData.SnapshotID.ToString();
                                    _parcelSet.ParcelDwell           = (int)_parcel.LandData.Dwell;
                                    _parcelSet.ParcelGroup           = _parcel.LandData.GroupID.ToString();
                                    _parcelSet.ParcelOwner.OwnerUUID = _parcel.LandData.OwnerID.ToString();

                                    if (_parcelSet.ParcelOwner.OwnerUUID != _parcelSet.ParcelGroup)
                                    {
                                        if (m_userManager != null)
                                        {
                                            _parcelSet.ParcelOwner.OwnerName    = m_userManager.GetUserName(_parcel.LandData.OwnerID);
                                            _parcelSet.ParcelOwner.OwnerHomeURI = m_userManager.GetUserHomeURL(_parcel.LandData.OwnerID);

                                            if (_parcelSet.ParcelOwner.OwnerHomeURI == String.Empty)
                                            {
                                                _parcelSet.ParcelOwner.OwnerHomeURI = _regionData.RegionHomeURI;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (_parcelSet.ParcelOwner.OwnerUUID == _parcelSet.ParcelGroup)
                                        {
                                            IGroupsModule groups = _scene.RequestModuleInterface <IGroupsModule>();

                                            if (groups != null)
                                            {
                                                GroupRecord _group = groups.GetGroupRecord(_parcel.LandData.GroupID);

                                                if (_group != null)
                                                {
                                                    _parcelSet.ParcelOwner.OwnerName    = _group.GroupName;
                                                    _parcelSet.ParcelOwner.OwnerHomeURI = _regionData.RegionHomeURI;

                                                    if (_dataSet.GroupData.Find(x => x.GroupUUID == _group.GroupID.ToString()) == null)
                                                    {
                                                        GroupDataSet _groupData = new GroupDataSet();

                                                        _groupData.GroupName         = _group.GroupName;
                                                        _groupData.GroupHomeURI      = _regionData.RegionHomeURI;
                                                        _groupData.GroupUUID         = _group.GroupID.ToString();
                                                        _groupData.GroupImage        = _group.GroupPicture.ToString();
                                                        _groupData.GroupShowInList   = _group.ShowInList;
                                                        _groupData.GroupAllowPublish = _group.AllowPublish;
                                                        _groupData.GroupFounder      = _group.FounderID.ToString();

                                                        _dataSet.GroupData.Add(_groupData);
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    _parcelSet.ParcelPosition = _parcel.CenterPoint.X + "/" + _parcel.CenterPoint.Y;

                                    if (_parcel.LandData.LandingType == (byte)LandingType.LandingPoint)
                                    {
                                        if (_parcel.LandData.UserLocation.X != 0 && _parcel.LandData.UserLocation.X != 0 && _parcel.LandData.UserLocation.X != 0)
                                        {
                                            _parcelSet.ParcelPosition = _parcel.LandData.UserLocation.X + "/" + _parcel.LandData.UserLocation.Y + "/" + _parcel.LandData.UserLocation.Z;
                                        }
                                    }

                                    _parcelSet.ParcelPrims = _parcel.GetParcelMaxPrimCount();

                                    _parcelSet.ParcelSize              = _parcel.LandData.Area;
                                    _parcelSet.ParcelBitmap            = Convert.ToBase64String(_parcel.LandData.Bitmap);
                                    _parcelSet.ParcelPrice             = _parcel.LandData.SalePrice;
                                    _parcelSet.ParcelIsVisibleInSearch = getStatusForSearch(_parcel);
                                    _parcelSet.ParcelIsForSale         = getStatusForSale(_parcel);
                                    _parcelSet.ParentUUID              = _scene.RegionInfo.RegionID.ToString();
                                    _parcelSet.ParcelUUID              = _parcel.LandData.GlobalID.ToString();

                                    _dataSet.ParcelData.Add(_parcelSet);
                                }
                            }
                            catch
                            {
                                m_log.Error("Error while fetching land data.");
                            }
                        }

                        foreach (SceneObjectGroup _cog in _scene.GetSceneObjectGroups())
                        {
                            try
                            {
                                if (_cog != null)
                                {
                                    if (_cog.IsTemporary == false && _cog.IsAttachment == false)
                                    {
                                        objectDataSet _objectData = new objectDataSet();

                                        _objectData.ObjectName        = ToUTF8(_cog.Name);
                                        _objectData.ObjectDescription = ToUTF8(_cog.Description);
                                        _objectData.ObjectUUID        = _cog.RootPart.UUID.ToString();
                                        _objectData.ParentUUID        = _scene.LandChannel.GetLandObject(_cog.RootPart.AbsolutePosition.X, _cog.RootPart.AbsolutePosition.Y).LandData.GlobalID.ToString();
                                        _objectData.ObjectIsForSale   = false;
                                        _objectData.ObjectSalePrice   = _cog.RootPart.SalePrice;

                                        if (_cog.RootPart.ObjectSaleType != (byte)0)
                                        {
                                            _objectData.ObjectIsForSale = true;
                                        }

                                        _objectData.ObjectIsForCopy       = getStatusForCopy(_cog);
                                        _objectData.ObjectGroupUUID       = _cog.GroupID.ToString();
                                        _objectData.ObjectItemUUID        = _cog.FromItemID.ToString();
                                        _objectData.ObjectOwner.OwnerUUID = _cog.OwnerID.ToString();

                                        _objectData.Textures = getAllTextures(_cog);

                                        foreach (SceneObjectPart part in _cog.Parts)
                                        {
                                            foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems())
                                            {
                                                inventoryDataSet data = new inventoryDataSet();
                                                data.AssetID       = item.AssetID.ToString();
                                                data.ItemID        = item.ItemID.ToString();
                                                data.Name          = item.Name;
                                                data.Description   = item.Description;
                                                data.InventoryType = item.InvType;
                                                _objectData.Inventory.Add(data);
                                            }
                                        }

                                        if (_objectData.ObjectOwner.OwnerUUID != _objectData.ObjectGroupUUID)
                                        {
                                            if (m_userManager != null)
                                            {
                                                _objectData.ObjectOwner.OwnerName    = m_userManager.GetUserName(_cog.OwnerID);
                                                _objectData.ObjectOwner.OwnerHomeURI = m_userManager.GetUserHomeURL(_cog.OwnerID);

                                                if (_objectData.ObjectOwner.OwnerHomeURI == String.Empty)
                                                {
                                                    _objectData.ObjectOwner.OwnerHomeURI = _regionData.RegionHomeURI;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (_objectData.ObjectOwner.OwnerUUID == _objectData.ObjectGroupUUID)
                                            {
                                                IGroupsModule groups = _scene.RequestModuleInterface <IGroupsModule>();

                                                if (groups != null)
                                                {
                                                    GroupRecord _group = groups.GetGroupRecord(_cog.RootPart.GroupID);

                                                    if (_group != null)
                                                    {
                                                        _objectData.ObjectOwner.OwnerName    = _group.GroupName;
                                                        _objectData.ObjectOwner.OwnerHomeURI = _regionData.RegionHomeURI;

                                                        if (_dataSet.GroupData.Find(x => x.GroupUUID == _group.GroupID.ToString()) == null)
                                                        {
                                                            GroupDataSet _groupData = new GroupDataSet();

                                                            _groupData.GroupName         = _group.GroupName;
                                                            _groupData.GroupHomeURI      = _regionData.RegionHomeURI;
                                                            _groupData.GroupUUID         = _group.GroupID.ToString();
                                                            _groupData.GroupImage        = _group.GroupPicture.ToString();
                                                            _groupData.GroupShowInList   = _group.ShowInList;
                                                            _groupData.GroupAllowPublish = _group.AllowPublish;
                                                            _groupData.GroupFounder      = _group.FounderID.ToString();

                                                            _dataSet.GroupData.Add(_groupData);
                                                        }
                                                    }
                                                }
                                            }
                                        }

                                        _objectData.ObjectPosition          = _cog.RootPart.AbsolutePosition.X + "/" + _cog.RootPart.AbsolutePosition.Y + "/" + _cog.RootPart.AbsolutePosition.Z;
                                        _objectData.ObjectImageUUID         = GuessImage(_cog);
                                        _objectData.ObjectIsVisibleInSearch = getStatusForSearch(_cog);

                                        _dataSet.ObjectData.Add(_objectData);
                                    }
                                }
                            }
                            catch
                            {
                                m_log.Error("Error while fetching scene object groups.");
                            }
                        }

                        foreach (ScenePresence _presence in _scene.GetScenePresences())
                        {
                            try
                            {
                                if (_presence.PresenceType == PresenceType.User)
                                {
                                    agentDataSet _agentData = new agentDataSet();
                                    _agentData.AgentName = _presence.Name;

                                    if (_presence.AbsolutePosition != null)
                                    {
                                        _agentData.AgentPosition = _presence.AbsolutePosition.X + "/" + _presence.AbsolutePosition.Y + "/" + _presence.AbsolutePosition.Z;
                                    }

                                    _agentData.AgentUUID    = _presence.UUID.ToString();
                                    _agentData.AgentHomeURI = _scene.GetAgentHomeURI(_presence.UUID);

                                    if (_scene.LandChannel != null && _presence.AbsolutePosition != null)
                                    {
                                        _agentData.ParentUUID = _scene.LandChannel.GetLandObject(_presence.AbsolutePosition.X, _presence.AbsolutePosition.Y).LandData.GlobalID.ToString();
                                    }

                                    _dataSet.AvatarData.Add(_agentData);
                                }
                            }
                            catch
                            {
                                m_log.Error("Error while fetching presence data.");
                            }
                        }
                    }
                }catch
                {
                    m_log.Error("Error while fetching scene data.");
                }
            }

            return(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(_dataSet, Formatting.Indented)));
        }
Exemplo n.º 42
0
        public void PostInitialise()
        {
            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();

            if (m_friendsModule == null)
                m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");

            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            if (m_groupsModule == null)
                m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
            
            m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
            
            // This log line will be commented out when no longer required for debugging
//            if (m_moapModule == null)
//                m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
        }
Exemplo n.º 43
0
        public void Close()
        {
            if (!m_groupMessagingEnabled)
                return;

            if (m_debugEnabled) m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module.");

            foreach (Scene scene in m_sceneList)
            {
                scene.EventManager.OnNewClient -= OnNewClient;
                scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
            }

            m_sceneList.Clear();

            m_groupsModule = null;
            m_msgTransferModule = null;
        }
 public void RegionLoaded(Scene scene)
 {
     m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
     m_groupManager = m_scene.RequestModuleInterface<IGroupsModule>();
     m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
     m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
 }
Exemplo n.º 45
0
        public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
        {
            IGroupsModule groupService = m_scene.RequestModuleInterface <IGroupsModule>();
            ScenePresence SP           = m_scene.GetScenePresence(this.m_agentID);
            IClientAPI    client       = (SP == null) ? null : SP.ControllingClient;

            if ((groupService == null) || (client == null))
            {
                return(new byte[0]);
            }
            try
            {
                // Get *this* user's friends list (should be fast).
                List <FriendListItem> friends = m_scene.CommsManager.UserService.GetUserFriendList(this.m_agentID);

                OSDMap rm      = (OSDMap)OSDParser.DeserializeLLSDXml(request);
                UUID   groupID = rm["group_id"].AsUUID();

                OSDMap defaults = new OSDMap();
                defaults["default_powers"] = (ulong)Constants.DefaultEveryonePowers;

                OSDMap        members   = new OSDMap();
                List <string> titleList = new List <string>();
                int           count     = 0;
                foreach (GroupMembersData gmd in groupService.GroupMembersRequest(null, m_scene, m_agentID, groupID))
                {
                    OSDMap member = new OSDMap();
                    member["donated_square_meters"] = gmd.Contribution;
                    member["last_login"]            = FilterOnlineStatus(gmd.AgentID, gmd.OnlineStatus, gmd.LastLogout, friends);
                    member["powers"] = gmd.AgentPowers;

                    if (gmd.IsOwner)
                    {
                        member["owner"] = "Y";  // mere presence of this means IsOwner to the viewer.
                    }
                    int titleIndex;
                    if (titleList.Contains(gmd.Title))
                    {
                        titleIndex = titleList.IndexOf(gmd.Title);
                    }
                    else
                    {
                        titleIndex = titleList.Count;   // before adding, 0-based
                        titleList.Add(gmd.Title);
                    }
                    member["title"] = titleIndex.ToString();

                    count++;
                    members[gmd.AgentID.ToString()] = member;
                }

                // Convert optimized list to OSDArray.
                OSDArray titles = new OSDArray();
                foreach (string title in titleList)
                {
                    titles.Add(title);
                }

                OSDMap map = new OSDMap();
                map["member_count"] = count;
                map["group_id"]     = groupID;
                map["defaults"]     = defaults;
                map["titles"]       = titles;
                map["members"]      = members;
                return(OSDParser.SerializeLLSDXmlBytes(map));
            }
            catch (Exception e)
            {
                MainConsole.Instance.Error("[CAPS]: " + e);
            }

            return(new byte[0]);
        }
Exemplo n.º 46
0
 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId, bool allowUserReassignment, bool skipErrorGroups)
 {
     m_scene = scene;
     m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
     m_errorMessage = String.Empty;
     m_merge = merge;
     m_requestId = requestId;
     m_allowUserReassignment = allowUserReassignment;
     m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
     m_skipErrorGroups = skipErrorGroups;
 }
        public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options)
        {
            m_rootScene = scene;
            m_loadPath = null;
            m_loadStream = loadStream;
            m_skipAssets = options.ContainsKey("skipAssets");
            m_merge = options.ContainsKey("merge");
            m_requestId = requestId;

            m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
     
            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }
Exemplo n.º 48
0
        public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
        {
            m_rootScene = scene;

            m_loadPath = loadPath;
            try
            {
                m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress);
            }
            catch (EntryPointNotFoundException e)
            {
                m_log.ErrorFormat(
                    "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                        + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                m_log.Error(e);
            }
        
            m_errorMessage = String.Empty;
            m_merge = merge;
            m_skipAssets = skipAssets;
            m_requestId = requestId;

            // Zero can never be a valid user id
            m_validUserUuids[UUID.Zero] = false;

            m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
            m_assetService = m_rootScene.AssetService;
        }