protected object OnGenericEvent(string functionName, object parameters) { if (functionName == "UserStatusChange") { // A user has logged in or out... we need to update friends lists across the grid object [] info = (object [])parameters; UUID us = UUID.Parse(info [0].ToString()); bool isOnline = bool.Parse(info [1].ToString()); if (!isOnline) { // If they are going offline, actually remove from from all group chats so that the next time they log in, they will be re-added foreach (GroupMembershipData gmd in m_groupData.GetAgentGroupMemberships(us, us)) { ChatSessionMember member = FindMember(us, gmd.GroupID); if (member != null) { member.HasBeenAdded = false; member.RequestedRemoval = false; } } } } return(null); }
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); }
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 List <GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) { return(GroupsConnector.GetAgentGroupMemberships(requestingAgentID, AgentID)); }