diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index b168bb3..9969086 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | |||
@@ -82,12 +82,18 @@ namespace OpenSim.Server.Handlers.Friends | |||
82 | case "getfriends": | 82 | case "getfriends": |
83 | return GetFriends(request); | 83 | return GetFriends(request); |
84 | 84 | ||
85 | case "getfriends_string": | ||
86 | return GetFriendsString(request); | ||
87 | |||
85 | case "storefriend": | 88 | case "storefriend": |
86 | return StoreFriend(request); | 89 | return StoreFriend(request); |
87 | 90 | ||
88 | case "deletefriend": | 91 | case "deletefriend": |
89 | return DeleteFriend(request); | 92 | return DeleteFriend(request); |
90 | 93 | ||
94 | case "deletefriend_string": | ||
95 | return DeleteFriendString(request); | ||
96 | |||
91 | } | 97 | } |
92 | m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); | 98 | m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); |
93 | } | 99 | } |
@@ -111,7 +117,25 @@ namespace OpenSim.Server.Handlers.Friends | |||
111 | m_log.WarnFormat("[FRIENDS HANDLER]: no principalID in request to get friends"); | 117 | m_log.WarnFormat("[FRIENDS HANDLER]: no principalID in request to get friends"); |
112 | 118 | ||
113 | FriendInfo[] finfos = m_FriendsService.GetFriends(principalID); | 119 | FriendInfo[] finfos = m_FriendsService.GetFriends(principalID); |
114 | //m_log.DebugFormat("[FRIENDS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | 120 | |
121 | return PackageFriends(finfos); | ||
122 | } | ||
123 | |||
124 | byte[] GetFriendsString(Dictionary<string, object> request) | ||
125 | { | ||
126 | string principalID = string.Empty; | ||
127 | if (request.ContainsKey("PRINCIPALID")) | ||
128 | principalID = request["PRINCIPALID"].ToString(); | ||
129 | else | ||
130 | m_log.WarnFormat("[FRIENDS HANDLER]: no principalID in request to get friends"); | ||
131 | |||
132 | FriendInfo[] finfos = m_FriendsService.GetFriends(principalID); | ||
133 | |||
134 | return PackageFriends(finfos); | ||
135 | } | ||
136 | |||
137 | private byte[] PackageFriends(FriendInfo[] finfos) | ||
138 | { | ||
115 | 139 | ||
116 | Dictionary<string, object> result = new Dictionary<string, object>(); | 140 | Dictionary<string, object> result = new Dictionary<string, object>(); |
117 | if ((finfos == null) || ((finfos != null) && (finfos.Length == 0))) | 141 | if ((finfos == null) || ((finfos != null) && (finfos.Length == 0))) |
@@ -138,7 +162,7 @@ namespace OpenSim.Server.Handlers.Friends | |||
138 | { | 162 | { |
139 | FriendInfo friend = new FriendInfo(request); | 163 | FriendInfo friend = new FriendInfo(request); |
140 | 164 | ||
141 | bool success = m_FriendsService.StoreFriend(friend.PrincipalID, friend.Friend, friend.MyFlags); | 165 | bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, friend.MyFlags); |
142 | 166 | ||
143 | if (success) | 167 | if (success) |
144 | return SuccessResult(); | 168 | return SuccessResult(); |
@@ -163,7 +187,25 @@ namespace OpenSim.Server.Handlers.Friends | |||
163 | else | 187 | else |
164 | return FailureResult(); | 188 | return FailureResult(); |
165 | } | 189 | } |
166 | 190 | ||
191 | byte[] DeleteFriendString(Dictionary<string, object> request) | ||
192 | { | ||
193 | string principalID = string.Empty; | ||
194 | if (request.ContainsKey("PRINCIPALID")) | ||
195 | principalID = request["PRINCIPALID"].ToString(); | ||
196 | else | ||
197 | m_log.WarnFormat("[FRIENDS HANDLER]: no principalID in request to delete friend"); | ||
198 | string friend = string.Empty; | ||
199 | if (request.ContainsKey("FRIEND")) | ||
200 | friend = request["FRIEND"].ToString(); | ||
201 | |||
202 | bool success = m_FriendsService.Delete(principalID, friend); | ||
203 | if (success) | ||
204 | return SuccessResult(); | ||
205 | else | ||
206 | return FailureResult(); | ||
207 | } | ||
208 | |||
167 | #endregion | 209 | #endregion |
168 | 210 | ||
169 | #region Misc | 211 | #region Misc |