aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs17
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs37
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs18
3 files changed, 40 insertions, 32 deletions
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 52b80e1..d1afea2 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors.Friends
84 84
85 85
86 #region IFriendsService 86 #region IFriendsService
87 87
88 public FriendInfo[] GetFriends(UUID PrincipalID) 88 public FriendInfo[] GetFriends(UUID PrincipalID)
89 { 89 {
90 Dictionary<string, object> sendData = new Dictionary<string, object>(); 90 Dictionary<string, object> sendData = new Dictionary<string, object>();
@@ -92,6 +92,21 @@ namespace OpenSim.Services.Connectors.Friends
92 sendData["PRINCIPALID"] = PrincipalID.ToString(); 92 sendData["PRINCIPALID"] = PrincipalID.ToString();
93 sendData["METHOD"] = "getfriends"; 93 sendData["METHOD"] = "getfriends";
94 94
95 return GetFriends(sendData, PrincipalID.ToString());
96 }
97
98 public FriendInfo[] GetFriends(string PrincipalID)
99 {
100 Dictionary<string, object> sendData = new Dictionary<string, object>();
101
102 sendData["PRINCIPALID"] = PrincipalID;
103 sendData["METHOD"] = "getfriends_string";
104
105 return GetFriends(sendData, PrincipalID);
106 }
107
108 protected FriendInfo[] GetFriends(Dictionary<string, object> sendData, string PrincipalID)
109 {
95 string reqString = ServerUtils.BuildQueryString(sendData); 110 string reqString = ServerUtils.BuildQueryString(sendData);
96 111
97 try 112 try
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
index 76f5f19..f823889 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
@@ -63,12 +63,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
63 63
64 #region IFriendsService 64 #region IFriendsService
65 65
66 public FriendInfo[] GetFriends(UUID PrincipalID) 66 public uint GetFriendPerms(UUID PrincipalID, UUID friendID)
67 { 67 {
68 Dictionary<string, object> sendData = new Dictionary<string, object>(); 68 Dictionary<string, object> sendData = new Dictionary<string, object>();
69 69
70 sendData["PRINCIPALID"] = PrincipalID.ToString(); 70 sendData["PRINCIPALID"] = PrincipalID.ToString();
71 sendData["METHOD"] = "getfriends"; 71 sendData["FRIENDID"] = friendID.ToString();
72 sendData["METHOD"] = "getfriendperms";
72 sendData["KEY"] = m_ServiceKey; 73 sendData["KEY"] = m_ServiceKey;
73 sendData["SESSIONID"] = m_SessionID.ToString(); 74 sendData["SESSIONID"] = m_SessionID.ToString();
74 75
@@ -83,34 +84,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
83 { 84 {
84 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 85 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
85 86
86 if (replyData != null) 87 if ((replyData != null) && replyData.ContainsKey("Value") && (replyData["Value"] != null))
87 { 88 {
88 if (replyData.ContainsKey("result") && (replyData["result"].ToString().ToLower() == "null")) 89 uint perms = 0;
89 { 90 uint.TryParse(replyData["Value"].ToString(), out perms);
90 return new FriendInfo[0]; 91 return perms;
91 }
92
93 List<FriendInfo> finfos = new List<FriendInfo>();
94 Dictionary<string, object>.ValueCollection finfosList = replyData.Values;
95 //m_log.DebugFormat("[FRIENDS CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
96 foreach (object f in finfosList)
97 {
98 if (f is Dictionary<string, object>)
99 {
100 FriendInfo finfo = new FriendInfo((Dictionary<string, object>)f);
101 finfos.Add(finfo);
102 }
103 else
104 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: GetFriends {0} received invalid response type {1}",
105 PrincipalID, f.GetType());
106 }
107
108 // Success
109 return finfos.ToArray();
110 } 92 }
111
112 else 93 else
113 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: GetFriends {0} received null response", 94 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: GetFriendPerms {0} received null response",
114 PrincipalID); 95 PrincipalID);
115 96
116 } 97 }
@@ -120,7 +101,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
120 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message); 101 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
121 } 102 }
122 103
123 return new FriendInfo[0]; 104 return 0;
124 105
125 } 106 }
126 107
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index f61ab29..b1c34dd 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -78,6 +78,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
78 78
79 public FriendInfo[] GetFriends(UUID principalID) 79 public FriendInfo[] GetFriends(UUID principalID)
80 { 80 {
81 return GetFriends(principalID.ToString());
82 }
83
84 public FriendInfo[] GetFriends(string principalID)
85 {
81 if (String.IsNullOrEmpty(m_serverUrl)) 86 if (String.IsNullOrEmpty(m_serverUrl))
82 return new FriendInfo[0]; 87 return new FriendInfo[0];
83 88
@@ -95,7 +100,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
95 UUID friendID = friendEntry["Key"].AsUUID(); 100 UUID friendID = friendEntry["Key"].AsUUID();
96 101
97 FriendInfo friend = new FriendInfo(); 102 FriendInfo friend = new FriendInfo();
98 friend.PrincipalID = principalID; 103 if (!UUID.TryParse(principalID, out friend.PrincipalID))
104 {
105 string tmp = string.Empty;
106 if (!Util.ParseUniversalUserIdentifier(principalID, out friend.PrincipalID, out tmp, out tmp, out tmp))
107 // bad record. ignore this entry
108 continue;
109 }
110
99 friend.Friend = friendID.ToString(); 111 friend.Friend = friendID.ToString();
100 friend.MyFlags = friendEntry["Value"].AsInteger(); 112 friend.MyFlags = friendEntry["Value"].AsInteger();
101 friend.TheirFlags = -1; 113 friend.TheirFlags = -1;
@@ -174,7 +186,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
174 186
175 #endregion IFriendsService 187 #endregion IFriendsService
176 188
177 private OSDArray GetFriended(UUID ownerID) 189 private OSDArray GetFriended(string ownerID)
178 { 190 {
179 NameValueCollection requestArgs = new NameValueCollection 191 NameValueCollection requestArgs = new NameValueCollection
180 { 192 {
@@ -195,7 +207,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
195 } 207 }
196 } 208 }
197 209
198 private OSDArray GetFriendedBy(UUID ownerID) 210 private OSDArray GetFriendedBy(string ownerID)
199 { 211 {
200 NameValueCollection requestArgs = new NameValueCollection 212 NameValueCollection requestArgs = new NameValueCollection
201 { 213 {