public FriendInfo[] GetFriends(UUID principalID) { List <FriendInfo> infos = new List <FriendInfo>(); QueryTables tables = new QueryTables(); tables.AddTable(m_realm, "my"); tables.AddTable(m_realm, "his", JoinType.Inner, new[, ] { { "my.Friend", "his.PrincipalID" }, { "my.PrincipalID", "his.Friend" } }); QueryFilter filter = new QueryFilter(); filter.andFilters["my.PrincipalID"] = principalID; List <string> query = GD.Query(new string[] { "my.Friend", "my.Flags", "his.Flags" }, tables, filter, null, null, null); //These are used to get the other flags below for (int i = 0; i < query.Count; i += 3) { FriendInfo info = new FriendInfo { PrincipalID = principalID, Friend = query[i], MyFlags = int.Parse(query[i + 1]), TheirFlags = int.Parse(query[i + 2]) }; infos.Add(info); } return(infos.ToArray()); }
void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) { return; } MainConsole.Instance.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); // Let's find the friend in this user's friend list FriendInfo friend = null; foreach (FriendInfo fi in friends.Where(fi => fi.Friend == target.ToString())) { friend = fi; } if (friend != null) // Found it { // Store it on the DB FriendsService.StoreFriend(requester, target.ToString(), rights); // Store it in the local cache int myFlags = friend.MyFlags; friend.MyFlags = rights; // Always send this back to the original client remoteClient.SendChangeUserRights(requester, target, rights); // // Notify the friend // // Try local if (!LocalGrantRights(requester, target, myFlags, rights)) { SyncMessagePosterService.PostToServer(SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, m_scene.RegionInfo.RegionID)); } } }
private static BuddyList ConvertFriendListItem(FriendInfo[] friendsList) { BuddyList buddylistreturn = new BuddyList(); foreach (BuddyList.BuddyInfo buddyitem in from finfo in friendsList where finfo.TheirFlags != -1 select new BuddyList.BuddyInfo(finfo.Friend) { BuddyID = finfo.Friend, BuddyRightsHave = finfo.TheirFlags, BuddyRightsGiven = finfo.MyFlags }) { buddylistreturn.AddNewBuddy(buddyitem); } return buddylistreturn; }
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, Framework.Services.UserInfo pinfo, GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, IInventoryService invService, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, GridRegion home, IPEndPoint clientIP, string AdultMax, string AdultRating, ArrayList eventValues, ArrayList eventNotificationValues, ArrayList classifiedValues, string seedCap, IConfigSource source, string DisplayName, string cofversion, IGridInfo info) : this() { m_source = source; m_gridInfo = info; SeedCapability = seedCap; FillOutInventoryData(invSkel, libService, invService); FillOutActiveGestures(gestures); CircuitCode = (int) aCircuit.CircuitCode; Lastname = account.LastName; Firstname = account.FirstName; this.DisplayName = DisplayName; AgentID = account.PrincipalID; SessionID = aCircuit.SessionID; SecureSessionID = aCircuit.SecureSessionID; BuddList = ConvertFriendListItem(friendsList); StartLocation = where; AgentAccessMax = AdultMax; AgentAccess = AdultRating; AgentRegionAccess = AgentRegionAccess; AOTransition = AOTransition; AgentFlag = AgentFlag; eventCategories = eventValues; eventNotifications = eventNotificationValues; classifiedCategories = classifiedValues; COFVersion = cofversion; FillOutHomeData(pinfo, home); LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); FillOutRegionData(aCircuit, destination); login = "******"; ErrorMessage = ""; ErrorReason = LoginResponseEnum.OK; }
public FriendInfo [] GetFriends (UUID principalID) { List<FriendInfo> infos = new List<FriendInfo> (); QueryTables tables = new QueryTables (); tables.AddTable (m_realm, "my"); tables.AddTable (m_realm, "his", JoinType.Inner, new [,] { { "my.Friend", "his.PrincipalID" }, { "my.PrincipalID", "his.Friend" } }); QueryFilter filter = new QueryFilter (); filter.andFilters ["my.PrincipalID"] = principalID; List<string> query = GD.Query (new string [] { "my.Friend", "my.Flags", "his.Flags" }, tables, filter, null, null, null); //These are used to get the other flags below for (int i = 0; i < query.Count; i += 3) { FriendInfo info = new FriendInfo { PrincipalID = principalID, Friend = query [i], MyFlags = int.Parse (query [i + 1]), TheirFlags = int.Parse (query [i + 2]) }; infos.Add (info); } return infos.ToArray (); }
public override void FromOSD(OSDMap map) { AgentInfo = new IAgentInfo(); AgentInfo.FromOSD((OSDMap)(map["AgentInfo"])); UserAccount = new UserAccount(); UserAccount.FromOSD((OSDMap)(map["UserAccount"])); if (!map.ContainsKey("ActiveGroup")) { ActiveGroup = null; } else { ActiveGroup = new GroupMembershipData(); ActiveGroup.FromOSD((OSDMap)(map["ActiveGroup"])); } GroupMemberships = ((OSDArray)map["GroupMemberships"]).ConvertAll <GroupMembershipData>((o) => { GroupMembershipData group = new GroupMembershipData (); group .FromOSD ((OSDMap )o); return(group); }); OfflineMessages = ((OSDArray)map["OfflineMessages"]).ConvertAll <GridInstantMessage>((o) => { GridInstantMessage group = new GridInstantMessage (); group.FromOSD( (OSDMap)o); return(group); }); MuteList = ((OSDArray)map["MuteList"]).ConvertAll <MuteList>((o) => { MuteList group = new MuteList(); group.FromOSD((OSDMap)o); return(group); }); if (map.ContainsKey("Appearance")) { Appearance = new AvatarAppearance(); Appearance.FromOSD((OSDMap)map["Appearance"]); } if (map.ContainsKey("FriendOnlineStatuses")) { FriendOnlineStatuses = ((OSDArray)map["FriendOnlineStatuses"]).ConvertAll <UUID>((o) => { return(o); }); } if (map.ContainsKey("Friends")) { Friends = ((OSDArray)map["Friends"]).ConvertAll <FriendInfo>((o) => { FriendInfo f = new FriendInfo(); f.FromOSD((OSDMap)o); return(f); }); } }