Exemplo n.º 1
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            m_service      = service;
            m_groupService = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();

            service.AddStreamHandler("GroupMemberData",
                                     new GenericStreamHandler("POST", service.CreateCAPS("GroupMemberData", ""), GroupMemberData));
        }
        public void RegisterCaps (IRegionClientCapsService service)
        {
            m_service = service;
            m_groupService = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector> ();

            service.AddStreamHandler ("GroupMemberData",
                new GenericStreamHandler ("POST", service.CreateCAPS ("GroupMemberData", ""), GroupMemberData));
        }
 public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene)
 {
     GroupsConnector = Aurora.DataManager.DataManager.RequestPlugin <IGroupsServiceConnector>();
     if (GroupsConnector == null)
     {
         m_log.Warn("[AURORA-GROUPS-CONNECTOR]: GroupsConnector is null");
         m_connectorEnabled = false;
     }
 }
        public void RegisterCaps (IRegionClientCapsService service)
        {
            m_service = service;
            m_groupService = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector> ();

            var apiUri = service.CreateCAPS ("GroupAPIv1", "");
            service.AddStreamHandler ("GroupAPIv1", new GenericStreamHandler ("GET", apiUri, ProcessGetGroupAPI));
            service.AddStreamHandler ("GroupAPIv1", new GenericStreamHandler ("POST", apiUri, ProcessPostGroupAPI));
        }
Exemplo n.º 5
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            m_service      = service;
            m_groupService = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();

            var apiUri = service.CreateCAPS("GroupAPIv1", "");

            service.AddStreamHandler("GroupAPIv1", new GenericStreamHandler("GET", apiUri, ProcessGetGroupAPI));
            service.AddStreamHandler("GroupAPIv1", new GenericStreamHandler("POST", apiUri, ProcessPostGroupAPI));
        }
 public void FinishedStartup ()
 {
     m_eventQueueService = m_registry.RequestModuleInterface<IEventQueueService> ();
     ISyncMessageRecievedService syncRecievedService =
         m_registry.RequestModuleInterface<ISyncMessageRecievedService> ();
     if (syncRecievedService != null)
         syncRecievedService.OnMessageReceived += syncRecievedService_OnMessageReceived;
     m_groupData = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector> ();
     m_registry.RequestModuleInterface<ISimulationBase> ().EventManager.RegisterEventHandler ("UserStatusChange",
                                                                                            OnGenericEvent);
 }
Exemplo n.º 7
0
        public void FinishedStartup()
        {
            m_eventQueueService = m_registry.RequestModuleInterface <IEventQueueService> ();
            ISyncMessageRecievedService syncRecievedService = m_registry.RequestModuleInterface <ISyncMessageRecievedService> ();

            if (syncRecievedService != null)
            {
                syncRecievedService.OnMessageReceived += syncRecievedService_OnMessageReceived;
            }
            m_groupData = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
            m_registry.RequestModuleInterface <ISimulationBase> ().EventManager.RegisterEventHandler("UserStatusChange",
                                                                                                     OnGenericEvent);
        }
Exemplo n.º 8
0
 public void AddRegion(IScene scene)
 {
     GroupsConnector = Aurora.DataManager.DataManager.RequestPlugin <IGroupsServiceConnector>();
     if (GroupsConnector == null)
     {
         MainConsole.Instance.Warn("[AURORA-GROUPS-CONNECTOR]: GroupsConnector is null");
         m_connectorEnabled = false;
     }
     if (m_connectorEnabled)
     {
         if (m_accountService == null)
         {
             m_accountService = scene.UserAccountService;
         }
         scene.RegisterModuleInterface <IGroupsServicesConnector>(this);
     }
 }
        private OSD AddUserToGroup(OSDMap map)
        {
            bool finished = false;
            IGroupsServiceConnector groupsService = Aurora.Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector>();

            if (groupsService != null)
            {
                string      first      = map["first"];
                string      last       = map["last"];
                string      group_name = map["group_name"];
                GroupRecord record     = groupsService.GetGroupRecord(UUID.Zero, UUID.Zero, group_name);
                if (record != null)
                {
                    UserAccount user = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(null, first, last);
                    if (user != null)
                    {
                        groupsService.AddAgentToGroup(UUID.Zero, user.PrincipalID, record.GroupID, UUID.Zero);
                        finished = true;
                    }
                }
            }
            return(finished);
        }
        private void InitClients()
        {
            IGroupsServiceConnector conn = Aurora.Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector>();

            foreach (string s in m_config.GetKeys())
            {
                if (s.EndsWith("_Network"))
                {
                    string      networkvalue = m_config.GetString(s);
                    string      channelvalue = m_config.GetString(s.Replace("_Network", "_Channel"));
                    string      nickvalue    = m_config.GetString(s.Replace("_Network", "_Nick"));
                    string      gridName     = m_config.GetString(s.Replace("_Network", "_GridName"), MainServer.Instance.ServerURI.Remove(0, 7));
                    GroupRecord g            = conn.GetGroupRecord(UUID.Zero, UUID.Zero, s.Replace("_Network", "").Replace('_', ' '));
                    if (g != null)
                    {
                        m_network[g.GroupID]  = networkvalue;
                        m_channel[g.GroupID]  = channelvalue;
                        m_gridName[g.GroupID] = gridName;
                        CreateIRCConnection(networkvalue, nickvalue, channelvalue, g.GroupID);
                    }
                }
            }
        }
 public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene)
 {
     GroupsConnector = Aurora.DataManager.DataManager.RequestPlugin<IGroupsServiceConnector>();
     if (GroupsConnector == null)
     {
         m_log.Warn("[AURORA-GROUPS-CONNECTOR]: GroupsConnector is null");
         m_connectorEnabled = false;
     }
 }
 public GroupsServiceHandler(IRegistryCore registry)
 {
     GroupsServiceConnector = DataManager.RequestPlugin<IGroupsServiceConnector>("IGroupsServiceConnectorLocal");
     UserServiceConnector = registry.RequestModuleInterface<IUserAccountService>();
 }
Exemplo n.º 13
0
        public void RegionLoaded(IScene scene)
        {
            if (!m_groupsEnabled)
                return;

            if (m_debugEnabled)
                MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);

            m_groupData = WhiteCore.Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>();

            // No Groups Service Connector, then nothing works...
            if (m_groupData == null)
            {
                m_groupsEnabled = false;
                MainConsole.Instance.Error("[GROUPS]: Could not get IGroupsServicesConnector");
                Close();
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
            m_imService = scene.RequestModuleInterface<IInstantMessagingService>();

            // No message transfer module, no notices, group invites, rejects, ejects, etc
            if (m_msgTransferModule == null)
            {
                m_groupsEnabled = false;
                MainConsole.Instance.Error("[GROUPS]: Could not get MessageTransferModule");
                Close();
                return;
            }

            m_scene = scene;

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
            scene.EventManager.OnClosingClient += OnClosingClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientLogin += EventManager_OnClientLogin;
            scene.EventManager.OnRegisterCaps += OnRegisterCaps;
            scene.EventManager.OnCachedUserInfo += UpdateCachedData;
            // The InstantMessageModule itself doesn't do this,
            // so lets see if things explode if we don't do it
            // scene.EventManager.OnClientClosed += OnClientClosed;
        }
Exemplo n.º 14
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();

            string      username = filename.Split('/').LastOrDefault();
            UserAccount userAcct = new UserAccount();

            if (httpRequest.Query.ContainsKey("userid"))
            {
                string userid = httpRequest.Query["userid"].ToString();

                userAcct = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                           GetUserAccount(null, UUID.Parse(userid));
            }
            else if (httpRequest.Query.ContainsKey("name") || username.Contains('.'))
            {
                string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username;
                name     = name.Replace('.', ' ');
                userAcct = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                           GetUserAccount(null, name);
            }
            else
            {
                username = username.Replace("%20", " ");
                userAcct = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                           GetUserAccount(null, username);
            }

            if (!userAcct.Valid)
            {
                return(vars);
            }

            // User found...
            vars.Add("UserName", userAcct.Name);

            IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>().
                                       GetUserProfile(userAcct.PrincipalID);
            IWebHttpTextureService webhttpService =
                webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>();

            if (profile != null)
            {
                vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup);
                if (profile.Partner != UUID.Zero)
                {
                    var partnerAcct = webInterface.Registry.RequestModuleInterface <IUserAccountService>().
                                      GetUserAccount(null, profile.Partner);
                    vars.Add("UserPartner", partnerAcct.Name);
                }
                else
                {
                    vars.Add("UserPartner", "No partner");
                }

                vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText);
                string url = "../images/icons/no_avatar.jpg";
                if (webhttpService != null && profile.Image != UUID.Zero)
                {
                    url = webhttpService.GetTextureURL(profile.Image);
                }
                vars.Add("UserPictureURL", url);
            }
            else
            {
                // no profile yet
                vars.Add("UserType", "Guest");
                vars.Add("UserPartner", "Not specified yet");
                vars.Add("UserAboutMe", "Nothing here yet");
                vars.Add("UserPictureURL", "../images/icons/no_avatar.jpg");
            }

            vars.Add("UsersGroupsText", translator.GetTranslatedString("UsersGroupsText"));

            IGroupsServiceConnector groupsConnector =
                Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector>();
            List <Dictionary <string, object> > groups = new List <Dictionary <string, object> > ();

            if (groupsConnector != null)
            {
                foreach (var grp in groupsConnector.GetAgentGroupMemberships(userAcct.PrincipalID, userAcct.PrincipalID))
                {
                    var    grpData = groupsConnector.GetGroupProfile(userAcct.PrincipalID, grp.GroupID);
                    string url     = "../images/icons/no_groups.jpg";
                    if (webhttpService != null && grpData.InsigniaID != UUID.Zero)
                    {
                        url = webhttpService.GetTextureURL(grpData.InsigniaID);
                    }
                    groups.Add(new Dictionary <string, object> {
                        { "GroupPictureURL", url },
                        { "GroupName", grp.GroupName }
                    });
                }

                if (groups.Count == 0)
                {
                    groups.Add(new Dictionary <string, object> {
                        { "GroupPictureURL", "../images/icons/no_groups.jpg" },
                        { "GroupName", "None yet" }
                    });
                }
            }

            vars.Add("GroupNameText", translator.GetTranslatedString("GroupNameText"));
            vars.Add("Groups", groups);
            vars.Add("GroupsJoined", groups.Count);

            return(vars);
        }
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON AURORA.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message["Message"];
                if (innerMessage["message"] == "ChatterBoxSessionAgentListUpdates")
                //ONLY forward on this type of message
                {
                    UUID agentID            = message["AgentID"];
                    IEventQueueService eqs  = m_registry.RequestModuleInterface <IEventQueueService>();
                    ICapsService       caps = m_registry.RequestModuleInterface <ICapsService>();
                    if (caps != null)
                    {
                        IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                        if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                        {
                            eqs.Enqueue(innerMessage, agentID, clientCaps.GetRootCapsService().RegionHandle);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FixGroupRoleTitles")
            {
                //COMES IN ON AURORA.SERVER SIDE FROM REGION
                UUID groupID = message["GroupID"].AsUUID();
                UUID agentID = message["AgentID"].AsUUID();
                UUID roleID  = message["RoleID"].AsUUID();
                byte type    = (byte)message["Type"].AsInteger();
                IGroupsServiceConnector     con     = DataManager.RequestPlugin <IGroupsServiceConnector>();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;
#if (!ISWIN)
                foreach (GroupRolesData role in roles)
                {
                    if (role.Name == "Everyone")
                    {
                        everyone = role;
                    }
                }
#else
                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }
#endif

                List <ulong> regionsToBeUpdated = new List <ulong>();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        //They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:
                            //No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers:     //Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                //Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }
                            //Need to update their title inworld
                            ICapsService caps = m_registry.RequestModuleInterface <ICapsService>();
                            if (caps != null)
                            {
                                IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                                if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                                {
                                    regionsToBeUpdated.Add(clientCaps.GetRootCapsService().RegionHandle);
                                }
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>();
                    if (messagePost != null)
                    {
                        foreach (ulong regionhandle in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage["GroupID"]  = groupID;
                            outgoingMessage["RoleID"]   = roleID;
                            outgoingMessage["RegionID"] = regionhandle;
                            messagePost.Post(regionhandle, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "ForceUpdateGroupTitles")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                UUID          groupID  = message["GroupID"].AsUUID();
                UUID          roleID   = message["RoleID"].AsUUID();
                ulong         regionID = message["RegionID"].AsULong();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "SendGroupNoticeToUsers")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                GroupNoticeInfo notice = new GroupNoticeInfo();
                notice.FromOSD((OSDMap)message["Notice"]);
                IGroupsModule gm = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.SendGroupNoticeToUsers(null, notice, true);
                }
            }
            return(null);
        }
Exemplo n.º 16
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object> ();

            IWebHttpTextureService webhttpService =
                webInterface.Registry.RequestModuleInterface <IWebHttpTextureService> ();

            //string username = filename.Split('/').LastOrDefault();
            UserAccount account = Authenticator.GetAuthentication(httpRequest);

            if (account == null)
            {
                return(vars);
            }

            /* Allow access to the syatem user info - needed for Estate owner Profiles of regions
             *
             * if ( Utilities.IsSystemUser(account.PrincipalID))
             *  return vars;
             */

            vars.Add("UserName", account.Name);
            //  TODO: User Profile inworld shows this as the standard mm/dd/yyyy
            //  Do we want this to be localised into the users Localisation or keep it as standard ?
            //
            //  vars.Add("UserBorn", Culture.LocaleDate(Util.ToDateTime(account.Created)));
            vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString());

            IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> ().
                                       GetUserProfile(account.PrincipalID);
            string picUrl = "../images/icons/no_avatar.jpg";

            if (profile != null)
            {
                vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup);

                if (profile.Partner != UUID.Zero)
                {
                    account = webInterface.Registry.RequestModuleInterface <IUserAccountService> ().
                              GetUserAccount(null, profile.Partner);
                    vars.Add("UserPartner", account.Name);
                }
                else
                {
                    vars.Add("UserPartner", "No partner");
                }
                vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText);
                if (webhttpService != null && profile.Image != UUID.Zero)
                {
                    picUrl = webhttpService.GetTextureURL(profile.Image);
                }
            }
            else
            {
                // no profile yet
                vars.Add("UserType", "Guest");
                vars.Add("UserPartner", "Not specified yet");
                vars.Add("UserAboutMe", "Nothing here yet");
            }
            vars.Add("UserPictureURL", picUrl);

            // TODO:  This is only showing online status if you are logged in ??
            UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest);

            if (ourAccount != null)
            {
                IFriendsService friendsService = webInterface.Registry.RequestModuleInterface <IFriendsService> ();
                var             friends        = friendsService.GetFriends(account.PrincipalID);
                UUID            friendID       = UUID.Zero;
                if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID))
                {
                    IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService> ();
                    IGridService      gridService      = webInterface.Registry.RequestModuleInterface <IGridService> ();
                    UserInfo          ourInfo          = agentInfoService.GetUserInfo(account.PrincipalID.ToString());
                    if (ourInfo != null && ourInfo.IsOnline)
                    {
                        vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName);
                    }
                    vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline);
                    vars.Add("IsOnline",
                             ourInfo != null && ourInfo.IsOnline
                        ? translator.GetTranslatedString("Online")
                        : translator.GetTranslatedString("Offline"));
                }
                else
                {
                    vars.Add("OnlineLocation", "");
                    vars.Add("UserIsOnline", false);
                    vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
                }
            }
            else
            {
                vars.Add("OnlineLocation", "");
                vars.Add("UserIsOnline", false);
                vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
            }

            vars.Add("UsersGroupsText", translator.GetTranslatedString("UsersGroupsText"));

            IGroupsServiceConnector groupsConnector =
                Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
            List <Dictionary <string, object> > groups = new List <Dictionary <string, object> > ();

            if (groupsConnector != null)
            {
                var groupsIn = groupsConnector.GetAgentGroupMemberships(account.PrincipalID, account.PrincipalID);
                if (groupsIn != null)
                {
                    foreach (var grp in groupsIn)
                    {
                        var    grpData = groupsConnector.GetGroupProfile(account.PrincipalID, grp.GroupID);
                        string url     = "../images/icons/no_groups.jpg";
                        if (grpData != null)
                        {
                            if (webhttpService != null && grpData.InsigniaID != UUID.Zero)
                            {
                                url = webhttpService.GetTextureURL(grpData.InsigniaID);
                            }
                            groups.Add(new Dictionary <string, object> {
                                { "GroupPictureURL", url },
                                { "GroupName", grp.GroupName }
                            });
                        }
                    }
                }


                if (groups.Count == 0)
                {
                    groups.Add(new Dictionary <string, object> {
                        { "GroupPictureURL", "../images/icons/no_groups.jpg" },
                        { "GroupName", "None yet" }
                    });
                }
            }

            vars.Add("GroupNameText", translator.GetTranslatedString("GroupNameText"));
            vars.Add("Groups", groups);
            vars.Add("GroupsJoined", groups.Count);

            // Menus
            vars.Add("MenuProfileTitle", translator.GetTranslatedString("MenuProfileTitle"));
            vars.Add("TooltipsMenuProfile", translator.GetTranslatedString("TooltipsMenuProfile"));
            vars.Add("MenuGroupTitle", translator.GetTranslatedString("MenuGroupTitle"));
            vars.Add("TooltipsMenuGroups", translator.GetTranslatedString("TooltipsMenuGroups"));
            vars.Add("MenuPicksTitle", translator.GetTranslatedString("MenuPicksTitle"));
            vars.Add("TooltipsMenuPicks", translator.GetTranslatedString("TooltipsMenuPicks"));
            vars.Add("MenuRegionsTitle", translator.GetTranslatedString("MenuRegionsTitle"));
            vars.Add("TooltipsMenuRegions", translator.GetTranslatedString("TooltipsMenuRegions"));

            // User data
            vars.Add("UserProfileFor", translator.GetTranslatedString("UserProfileFor"));
            vars.Add("ResidentSince", translator.GetTranslatedString("ResidentSince"));
            vars.Add("AccountType", translator.GetTranslatedString("AccountType"));
            vars.Add("PartnersName", translator.GetTranslatedString("PartnersName"));
            vars.Add("AboutMe", translator.GetTranslatedString("AboutMe"));
            vars.Add("IsOnlineText", translator.GetTranslatedString("IsOnlineText"));
            vars.Add("OnlineLocationText", translator.GetTranslatedString("OnlineLocationText"));

            // Style Switcher
            vars.Add("styles1", translator.GetTranslatedString("styles1"));
            vars.Add("styles2", translator.GetTranslatedString("styles2"));
            vars.Add("styles3", translator.GetTranslatedString("styles3"));
            vars.Add("styles4", translator.GetTranslatedString("styles4"));
            vars.Add("styles5", translator.GetTranslatedString("styles5"));

            vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
            vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
            vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));

            // Language Switcher
            vars.Add("en", translator.GetTranslatedString("en"));
            vars.Add("fr", translator.GetTranslatedString("fr"));
            vars.Add("de", translator.GetTranslatedString("de"));
            vars.Add("it", translator.GetTranslatedString("it"));
            vars.Add("es", translator.GetTranslatedString("es"));
            vars.Add("nl", translator.GetTranslatedString("nl"));

            var settings = webInterface.GetWebUISettings();

            vars.Add("ShowLanguageTranslatorBar", !settings.HideLanguageTranslatorBar);
            vars.Add("ShowStyleBar", !settings.HideStyleBar);

            return(vars);
        }
 public GroupsServiceHandler()
 {
     GroupsServiceConnector = DataManager.RequestPlugin<IGroupsServiceConnector>("IGroupsServiceConnectorLocal");
 }
Exemplo n.º 18
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message ["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON WhiteCore.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message ["Message"];
                if (innerMessage ["message"] == "ChatterBoxSessionAgentListUpdates")
                // ONLY forward on this type of message
                {
                    UUID agentID                 = message ["AgentID"];
                    IEventQueueService eqs       = m_registry.RequestModuleInterface <IEventQueueService> ();
                    IAgentInfoService  agentInfo = m_registry.RequestModuleInterface <IAgentInfoService> ();
                    if (agentInfo != null)
                    {
                        UserInfo user = agentInfo.GetUserInfo(agentID.ToString());
                        if (user != null && user.IsOnline)
                        {
                            eqs.Enqueue(innerMessage, agentID, user.CurrentRegionID);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "FixGroupRoleTitles")
            {
                // This message comes in on WhiteCore.Server side from the region
                UUID groupID = message ["GroupID"].AsUUID();
                UUID agentID = message ["AgentID"].AsUUID();
                UUID roleID  = message ["RoleID"].AsUUID();
                byte type    = (byte)message ["Type"].AsInteger();
                IGroupsServiceConnector     con     = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;

                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }

                List <UserInfo> regionsToBeUpdated = new List <UserInfo> ();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        // They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:     // No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers: // Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                // Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }

                            // Need to update their title inworld
                            IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                            UserInfo          info;
                            if (agentInfoService != null &&
                                (info = agentInfoService.GetUserInfo(agentID.ToString())) != null && info.IsOnline)
                            {
                                // Forward the message
                                regionsToBeUpdated.Add(info);
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    ISyncMessagePosterService messagePost = m_registry.RequestModuleInterface <ISyncMessagePosterService> ();
                    if (messagePost != null)
                    {
                        foreach (UserInfo userInfo in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage ["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage ["GroupID"]  = groupID;
                            outgoingMessage ["RoleID"]   = roleID;
                            outgoingMessage ["RegionID"] = userInfo.CurrentRegionID;
                            messagePost.Post(userInfo.CurrentRegionURI, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "ForceUpdateGroupTitles")
            {
                // This message comes in on the region side from WhiteCore.Server
                UUID          groupID  = message ["GroupID"].AsUUID();
                UUID          roleID   = message ["RoleID"].AsUUID();
                UUID          regionID = message ["RegionID"].AsUUID();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule> ();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            return(null);
        }
 public void AddRegion(IScene scene)
 {
     GroupsConnector = Aurora.DataManager.DataManager.RequestPlugin<IGroupsServiceConnector>();
     if (GroupsConnector == null)
     {
         MainConsole.Instance.Warn("[AURORA-GROUPS-CONNECTOR]: GroupsConnector is null");
         m_connectorEnabled = false;
     }
     if (m_connectorEnabled)
     {
         if (m_accountService == null)
         {
             m_accountService = scene.UserAccountService;
         }
         scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
     }
 }