aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-03-01 00:02:14 +0000
committerMelanie2010-03-01 00:02:14 +0000
commitbfcc57c0712170e3431617bcb09999bfbb96b8dd (patch)
tree137f22b0e6eb5f57487c297bbf4be5d197bd60d5
parentMerge branch 'presence-refactor' of melanie@opensimulator.org:/var/git/opensi... (diff)
downloadopensim-SC_OLD-bfcc57c0712170e3431617bcb09999bfbb96b8dd.zip
opensim-SC_OLD-bfcc57c0712170e3431617bcb09999bfbb96b8dd.tar.gz
opensim-SC_OLD-bfcc57c0712170e3431617bcb09999bfbb96b8dd.tar.bz2
opensim-SC_OLD-bfcc57c0712170e3431617bcb09999bfbb96b8dd.tar.xz
Change friends to handle offers as it was originally designed. This may
need to be changed in SQLite & MSSQL as well
-rw-r--r--OpenSim/Data/MySQL/MySQLFriendsData.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs13
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs3
4 files changed, 5 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs
index 7a43bb6..663fad6 100644
--- a/OpenSim/Data/MySQL/MySQLFriendsData.cs
+++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Data.MySQL
59 { 59 {
60 MySqlCommand cmd = new MySqlCommand(); 60 MySqlCommand cmd = new MySqlCommand();
61 61
62 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); 62 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);
63 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); 63 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
64 64
65 return DoQuery(cmd); 65 return DoQuery(cmd);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 3a86a46..32c2a43 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -194,10 +194,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
194 get { return null; } 194 get { return null; }
195 } 195 }
196 196
197 public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
198 {
199 }
200
201 public uint GetFriendPerms(UUID principalID, UUID friendID) 197 public uint GetFriendPerms(UUID principalID, UUID friendID)
202 { 198 {
203 if (!m_Friends.ContainsKey(principalID)) 199 if (!m_Friends.ContainsKey(principalID))
@@ -453,8 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
453 449
454 // This user wants to be friends with the other user. 450 // This user wants to be friends with the other user.
455 // Let's add both relations to the DB, but one of them is inactive (-1) 451 // Let's add both relations to the DB, but one of them is inactive (-1)
456 FriendsService.StoreFriend(principalID, friendID.ToString(), 1); 452 FriendsService.StoreFriend(principalID, friendID.ToString(), 0);
457 FriendsService.StoreFriend(friendID, principalID.ToString(), -1);
458 453
459 // Now let's ask the other user to be friends with this user 454 // Now let's ask the other user to be friends with this user
460 ForwardFriendshipOffer(principalID, friendID, im); 455 ForwardFriendshipOffer(principalID, friendID, im);
@@ -486,6 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
486 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 481 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
487 { 482 {
488 FriendsService.StoreFriend(agentID, friendID.ToString(), 1); 483 FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
484 FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
489 // update the local cache 485 // update the local cache
490 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); 486 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
491 487
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index a0a1e3a..0ff7dee 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -33,19 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface IFriendsModule 34 public interface IFriendsModule
35 { 35 {
36 /// <summary>
37 /// Offer a friendship to a user from the server end rather than by direct initiation from a client.
38 /// </summary>
39 /// <param name="fromUserId">
40 /// A user with this id must existing in the user data store, but need not be logged on.
41 /// </param>
42 /// <param name="toUserClient">
43 /// An actually logged in client to which the offer is being made.
44 /// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the
45 /// receiving user is not currently online.
46 /// </param>
47 /// <param name="offerMessage"></param>
48 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
49 uint GetFriendPerms(UUID PrincipalID, UUID FriendID); 36 uint GetFriendPerms(UUID PrincipalID, UUID FriendID);
50 void SendFriendsOnlineIfNeeded(IClientAPI client); 37 void SendFriendsOnlineIfNeeded(IClientAPI client);
51 } 38 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 11a7473..05f5b4c 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -230,7 +230,6 @@ namespace OpenSim.Services.LLLoginService
230 SessionID = aCircuit.SessionID; 230 SessionID = aCircuit.SessionID;
231 SecureSessionID = aCircuit.SecureSessionID; 231 SecureSessionID = aCircuit.SecureSessionID;
232 Message = message; 232 Message = message;
233 // While we don't have friends...
234 BuddList = ConvertFriendListItem(friendsList); 233 BuddList = ConvertFriendListItem(friendsList);
235 StartLocation = where; 234 StartLocation = where;
236 235
@@ -612,6 +611,8 @@ namespace OpenSim.Services.LLLoginService
612 LLLoginResponse.BuddyList buddylistreturn = new LLLoginResponse.BuddyList(); 611 LLLoginResponse.BuddyList buddylistreturn = new LLLoginResponse.BuddyList();
613 foreach (FriendInfo finfo in friendsList) 612 foreach (FriendInfo finfo in friendsList)
614 { 613 {
614 if (finfo.TheirFlags == -1)
615 continue;
615 LLLoginResponse.BuddyList.BuddyInfo buddyitem = new LLLoginResponse.BuddyList.BuddyInfo(finfo.Friend); 616 LLLoginResponse.BuddyList.BuddyInfo buddyitem = new LLLoginResponse.BuddyList.BuddyInfo(finfo.Friend);
616 buddyitem.BuddyID = finfo.Friend; 617 buddyitem.BuddyID = finfo.Friend;
617 buddyitem.BuddyRightsHave = (int)finfo.TheirFlags; 618 buddyitem.BuddyRightsHave = (int)finfo.TheirFlags;