Change friends to handle offers as it was originally designed. This may
need to be changed in SQLite & MSSQL as wellslimupdates
							parent
							
								
									18727235a0
								
							
						
					
					
						commit
						bfcc57c071
					
				| 
						 | 
				
			
			@ -59,7 +59,7 @@ namespace OpenSim.Data.MySQL
 | 
			
		|||
        {
 | 
			
		||||
            MySqlCommand cmd = new MySqlCommand();
 | 
			
		||||
 | 
			
		||||
            cmd.CommandText = String.Format("select a.*,b.Flags as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID and b.Flags is not null", m_Realm);
 | 
			
		||||
            cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
 | 
			
		||||
            cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
 | 
			
		||||
 | 
			
		||||
            return DoQuery(cmd);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -194,10 +194,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
 | 
			
		|||
            get { return null; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public uint GetFriendPerms(UUID principalID, UUID friendID)
 | 
			
		||||
        {
 | 
			
		||||
            if (!m_Friends.ContainsKey(principalID))
 | 
			
		||||
| 
						 | 
				
			
			@ -453,8 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
 | 
			
		|||
 | 
			
		||||
                // This user wants to be friends with the other user.
 | 
			
		||||
                // Let's add both relations to the DB, but one of them is inactive (-1)
 | 
			
		||||
                FriendsService.StoreFriend(principalID, friendID.ToString(), 1);
 | 
			
		||||
                FriendsService.StoreFriend(friendID, principalID.ToString(), -1);
 | 
			
		||||
                FriendsService.StoreFriend(principalID, friendID.ToString(), 0);
 | 
			
		||||
 | 
			
		||||
                // Now let's ask the other user to be friends with this user
 | 
			
		||||
                ForwardFriendshipOffer(principalID, friendID, im);
 | 
			
		||||
| 
						 | 
				
			
			@ -486,6 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
 | 
			
		|||
        private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
 | 
			
		||||
        {
 | 
			
		||||
            FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
 | 
			
		||||
            FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
 | 
			
		||||
            // update the local cache
 | 
			
		||||
            m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,19 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces
 | 
			
		|||
{
 | 
			
		||||
    public interface IFriendsModule
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Offer a friendship to a user from the server end rather than by direct initiation from a client.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="fromUserId">
 | 
			
		||||
        /// A user with this id must existing in the user data store, but need not be logged on.
 | 
			
		||||
        /// </param>
 | 
			
		||||
        /// <param name="toUserClient">
 | 
			
		||||
        /// An actually logged in client to which the offer is being made.
 | 
			
		||||
        /// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the 
 | 
			
		||||
        /// receiving user is not currently online. 
 | 
			
		||||
        /// </param>
 | 
			
		||||
        /// <param name="offerMessage"></param>
 | 
			
		||||
        void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
 | 
			
		||||
        uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
 | 
			
		||||
        void SendFriendsOnlineIfNeeded(IClientAPI client);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,7 +230,6 @@ namespace OpenSim.Services.LLLoginService
 | 
			
		|||
            SessionID = aCircuit.SessionID;
 | 
			
		||||
            SecureSessionID = aCircuit.SecureSessionID;
 | 
			
		||||
            Message = message;
 | 
			
		||||
            // While we don't have friends...
 | 
			
		||||
            BuddList = ConvertFriendListItem(friendsList);
 | 
			
		||||
            StartLocation = where;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -612,6 +611,8 @@ namespace OpenSim.Services.LLLoginService
 | 
			
		|||
            LLLoginResponse.BuddyList buddylistreturn = new LLLoginResponse.BuddyList();
 | 
			
		||||
            foreach (FriendInfo finfo in friendsList)
 | 
			
		||||
            {
 | 
			
		||||
                if (finfo.TheirFlags == -1)
 | 
			
		||||
                    continue;
 | 
			
		||||
                LLLoginResponse.BuddyList.BuddyInfo buddyitem = new LLLoginResponse.BuddyList.BuddyInfo(finfo.Friend);
 | 
			
		||||
                buddyitem.BuddyID = finfo.Friend;
 | 
			
		||||
                buddyitem.BuddyRightsHave = (int)finfo.TheirFlags;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue