public bool LocalGrantRights(UUID userID, UUID friendID, int oldRights, int newRights) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { int changedRights = newRights ^ oldRights; bool onlineBitChanged = (changedRights & (int)FriendRights.CanSeeOnline) != 0; if (onlineBitChanged) { if ((newRights & (int)FriendRights.CanSeeOnline) == 1) { friendClient.SendAgentOnline(new UUID[] { userID }); } else { friendClient.SendAgentOffline(new UUID[] { userID }); } } if (changedRights != 0) { friendClient.SendChangeUserRights(userID, friendID, newRights); } // Update local cache UpdateLocalCache(userID, friendID, newRights); return(true); } return(false); }
public override bool SendFriendsOnlineIfNeeded(IClientAPI client) { // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name); if (base.SendFriendsOnlineIfNeeded(client)) { AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId); if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) { UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId); if (account == null) // foreign { FriendInfo[] friends = GetFriendsFromCache(client.AgentId); foreach (FriendInfo f in friends) { int rights = f.TheirFlags; if (rights != -1) { client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, rights); } } } } } // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name); return(false); }
public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0; if (onlineBitChanged) { if ((rights & (int)FriendRights.CanSeeOnline) == 1) { friendClient.SendAgentOnline(new UUID[] { userID }); } else { friendClient.SendAgentOffline(new UUID[] { userID }); } } else { bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; if (canEditObjectsChanged) { friendClient.SendChangeUserRights(userID, friendID, rights); } } // Update local cache UpdateLocalCache(userID, friendID, rights); return(true); } return(false); }
void client_OnGrantUserRights(IClientAPI sender, OpenMetaverse.UUID grantor, OpenMetaverse.UUID grantee, int rights) { if (sender.AgentId != grantor) { return; } //set the user rights on the DB using (ISimpleDB db = _connFactory.GetConnection()) { Dictionary <string, object> parms = new Dictionary <string, object>(); parms.Add("rights", rights); parms.Add("ownerID", grantor); parms.Add("friendID", grantee); db.QueryNoResults("UPDATE userfriends " + "SET friendPerms = ?rights " + "WHERE ownerID = ?ownerID AND friendID = ?friendID;", parms); } m_scene.CommsManager.UserService.UpdateUserFriendPerms(grantor, grantee, (uint)rights); sender.SendChangeUserRights(grantor, grantee, rights); }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) { return; } // Let's find the friend in this user's friend list FriendInfo friend = GetFriend(friends, target); if (friend != null) // Found it { // Store it on the DB if (!StoreRights(requester, target, rights)) { remoteClient.SendAlertMessage("Unable to grant rights."); return; } // 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)) { return; } PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); if (friendSessions != null && friendSessions.Length > 0) { PresenceInfo friendSession = friendSessions[0]; if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); // TODO: You might want to send the delta to save the lookup // on the other end!! m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } else { m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester); } }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { if (!m_Friends.ContainsKey(remoteClient.AgentId)) { return; } m_log.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 UserFriendData fd = m_Friends[remoteClient.AgentId]; FriendInfo friend = null; foreach (FriendInfo fi in fd.Friends) { if (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)) { return; } PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); if (friendSessions != null && friendSessions.Length > 0) { PresenceInfo friendSession = friendSessions[0]; if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); // TODO: You might want to send the delta to save the lookup // on the other end!! m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } }
private 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; #if (!ISWIN) foreach (FriendInfo fi in friends) { if (fi.Friend == target.ToString()) { friend = fi; } } #else foreach (FriendInfo fi in friends.Where(fi => fi.Friend == target.ToString())) { friend = fi; } #endif 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.Post(SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, m_Scenes[0].RegionInfo.RegionHandle), m_Scenes[0].RegionInfo.RegionHandle); } } }
public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0; if (onlineBitChanged) { if ((rights & (int)FriendRights.CanSeeOnline) == 1) { friendClient.SendAgentOnline(new[] { new UUID(userID) }); } else { friendClient.SendAgentOffline(new[] { new UUID(userID) }); } } else { bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; if (canEditObjectsChanged) { friendClient.SendChangeUserRights(userID, friendID, rights); } } // Update local cache FriendInfo[] friends = GetFriends(friendID); foreach (FriendInfo finfo in friends.Where(finfo => finfo.Friend == userID.ToString())) { finfo.TheirFlags = rights; } friends = GetFriends(userID); foreach (FriendInfo finfo in friends.Where(finfo => finfo.Friend == friendID.ToString())) { finfo.MyFlags = rights; } //Add primFlag updates for all the prims in the sim with the owner, so that the new permissions are set up correctly IScenePresence friendSP = friendClient.Scene.GetScenePresence(friendClient.AgentId); foreach ( ISceneEntity entity in friendClient.Scene.Entities.GetEntities().Where(entity => entity.OwnerID == userID)) { entity.ScheduleGroupUpdateToAvatar(friendSP, PrimUpdateFlags.PrimFlags); } return(true); } return(false); }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) { return; } m_log.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) { if (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)) { UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(target.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, region.RegionHandle)); } } } }
public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0; if (onlineBitChanged) { if ((rights & (int)FriendRights.CanSeeOnline) == 1) { friendClient.SendAgentOnline(new UUID[] { new UUID(userID) }); } else { friendClient.SendAgentOffline(new UUID[] { new UUID(userID) }); } } else { bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; if (canEditObjectsChanged) { friendClient.SendChangeUserRights(userID, friendID, rights); } } // Update local cache lock (m_Friends) { FriendInfo[] friends = GetFriends(friendID); foreach (FriendInfo finfo in friends) { if (finfo.Friend == userID.ToString()) { finfo.TheirFlags = rights; } } } return(true); } return(false); }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) return; m_log.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) { if (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)) { PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); if (friendSessions != null && friendSessions.Length > 0) { PresenceInfo friendSession = friendSessions[0]; if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } } }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { if (!m_Friends.ContainsKey(remoteClient.AgentId)) return; m_log.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 UserFriendData fd = m_Friends[remoteClient.AgentId]; FriendInfo friend = null; foreach (FriendInfo fi in fd.Friends) if (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)) return; PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); // TODO: You might want to send the delta to save the lookup // on the other end!! m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } }
void client_OnGrantUserRights(IClientAPI sender, OpenMetaverse.UUID grantor, OpenMetaverse.UUID grantee, int rights) { if (sender.AgentId != grantor) { return; } //set the user rights on the DB using (ISimpleDB db = _connFactory.GetConnection()) { Dictionary<string, object> parms = new Dictionary<string,object>(); parms.Add("rights", rights); parms.Add("ownerID", grantor); parms.Add("friendID", grantee); db.QueryNoResults( "UPDATE userfriends " + "SET friendPerms = ?rights " + "WHERE ownerID = ?ownerID AND friendID = ?friendID;", parms ); } m_scene.CommsManager.UserService.UpdateUserFriendPerms(grantor, grantee, (uint)rights); sender.SendChangeUserRights(grantor, grantee, rights); }
public override bool SendFriendsOnlineIfNeeded(IClientAPI client) { // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name); if (base.SendFriendsOnlineIfNeeded(client)) { AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId); if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) { UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId); if (account == null) // foreign { FriendInfo[] friends = GetFriends(client.AgentId); foreach (FriendInfo f in friends) { client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags); } } } } // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name); return false; }
private 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; #if (!ISWIN) foreach (FriendInfo fi in friends) { if (fi.Friend == target.ToString()) { friend = fi; } } #else foreach (FriendInfo fi in friends.Where(fi => fi.Friend == target.ToString())) { friend = fi; } #endif 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.Post(SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, m_Scenes[0].RegionInfo.RegionHandle), m_Scenes[0].RegionInfo.RegionHandle); } } }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) return; m_log.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) { if (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)) { UserInfo friendSession = m_Scenes[0].RequestModuleInterface<IAgentInfoService>().GetUserInfo(target.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, region.RegionHandle)); } } } }
public void GrantRights(IClientAPI remoteClient, UUID friendID, int rights) { UUID requester = remoteClient.AgentId; m_log.DebugFormat( "[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, friendID); FriendInfo[] friends = GetFriendsFromCache(requester); if (friends.Length == 0) { return; } // Let's find the friend in this user's friend list FriendInfo friend = GetFriend(friends, friendID); if (friend != null) // Found it { // Store it on the DB if (!StoreRights(requester, friendID, rights)) { remoteClient.SendAlertMessage("Unable to grant rights."); return; } // Store it in the local cache int myFlags = friend.MyFlags; friend.MyFlags = rights; // Always send this back to the original client remoteClient.SendChangeUserRights(requester, friendID, rights); // // Notify the friend // // Try local if (LocalGrantRights(requester, friendID, myFlags, rights)) return; PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); if (friendSessions != null && friendSessions.Length > 0) { PresenceInfo friendSession = friendSessions[0]; if (friendSession != null) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); // TODO: You might want to send the delta to save the lookup // on the other end!! m_FriendsSimConnector.GrantRights(region, requester, friendID, myFlags, rights); } } } else { m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", friendID, requester); } }