public bool LocalFriendshipApproved(UUID userID, string userName, UUID friendID) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { // the prospective friend in this sim as root agent GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccm != null) { ccm.CreateCallingCard(friendID, userID, UUID.Zero); } // Update the local cache RecacheFriends(friendClient); // we're done return(true); } return(false); }
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders) { MainConsole.Instance.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); // Update the local cache UpdateFriendsCache(agentID); // Notify the friend and send calling card to the local user ICallingCardModule ccmodule = client.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccmodule != null) { UserAccount account = client.Scene.UserAccountService.GetUserAccount(client.AllScopeIDs, friendID); UUID folderID = client.Scene.InventoryService.GetFolderForType(agentID, InventoryType.Unknown, AssetType.CallingCard) .ID; if (account != null) { ccmodule.CreateCallingCard(client, friendID, folderID, account.Name); } } // Try Local if (LocalFriendshipApproved(agentID, client.Name, client, friendID)) { return; } SyncMessagePosterService.PostToServer(SyncMessageHelper.FriendshipApproved( agentID, client.Name, friendID, m_scene.RegionInfo.RegionID)); }
public bool LocalFriendshipApproved(UUID userID, string name, IClientAPI us, UUID friendID) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { //They are online, send the online message if (us != null) { us.SendAgentOnline(new[] { friendID }); } // the prospective friend in this sim as root agent GridInstantMessage im = new GridInstantMessage() { FromAgentID = userID, FromAgentName = name, ToAgentID = friendID, Dialog = (byte)InstantMessageDialog.FriendshipAccepted, Message = userID.ToString(), Offline = 0, RegionID = us.Scene.RegionInfo.RegionID }; friendClient.SendInstantMessage(im); // Update the local cache UpdateFriendsCache(friendID); // // put a calling card into the inventory of the friend // ICallingCardModule ccmodule = friendClient.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccmodule != null) { UserAccount account = friendClient.Scene.UserAccountService.GetUserAccount(friendClient.AllScopeIDs, userID); UUID folderID = friendClient.Scene.InventoryService.GetFolderForType(friendID, InventoryType.Unknown, AssetType.CallingCard).ID; ccmodule.CreateCallingCard(friendClient, userID, folderID, account.Name); } // we're done return(true); } return(false); }
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders) { m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); // Update the local cache UpdateFriendsCache(agentID); // // Notify the friend // // // Send calling card to the local user // ICallingCardModule ccmodule = client.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccmodule != null) { UserAccount account = ((Scene)client.Scene).UserAccountService.GetUserAccount(UUID.Zero, friendID); UUID folderID = ((Scene)client.Scene).InventoryService.GetFolderForType(agentID, AssetType.CallingCard).ID; ccmodule.CreateCallingCard(client, friendID, folderID, account.Name); } // Try Local if (LocalFriendshipApproved(agentID, client.Name, client, friendID)) { return; } // The friend is not here UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipApproved( agentID, client.Name, friendID, region.RegionHandle)); } }
public void AddFriendship(IClientAPI client, UUID friendID) { StoreFriendships(client.AgentId, friendID); ICallingCardModule ccm = client.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccm != null) { ccm.CreateCallingCard(client.AgentId, friendID, UUID.Zero); } // Update the local cache. RecacheFriends(client); // // Notify the friend // // Try Local if (LocalFriendshipApproved(client.AgentId, client.Name, friendID)) { client.SendAgentOnline(new UUID[] { friendID }); return; } // The friend is not here 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); m_FriendsSimConnector.FriendshipApproved(region, client.AgentId, client.Name, friendID); client.SendAgentOnline(new UUID[] { friendID }); } } }
public bool LocalFriendshipApproved(UUID userID, string name, IClientAPI us, UUID friendID) { IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { //They are online, send the online message if (us != null) { us.SendAgentOnline(new UUID[] { friendID }); } // the prospective friend in this sim as root agent GridInstantMessage im = new GridInstantMessage(m_Scenes[0], userID, name, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); // Update the local cache UpdateFriendsCache(friendID); // // put a calling card into the inventory of the friend // ICallingCardModule ccmodule = friendClient.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccmodule != null) { UserAccount account = ((Scene)friendClient.Scene).UserAccountService.GetUserAccount(UUID.Zero, userID); UUID folderID = ((Scene)friendClient.Scene).InventoryService.GetFolderForType(friendID, AssetType.CallingCard).ID; ccmodule.CreateCallingCard(friendClient, userID, folderID, account.Name); } // we're done return(true); } return(false); }