public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable hash = new Hashtable ();
hash["result"] = "false";
Hashtable requestData = (Hashtable)request.Params[0];
//string host = (string)requestData["host"];
//string portstr = (string)requestData["port"];
if (requestData.ContainsKey ("userID") && requestData.ContainsKey ("online"))
{
string userID_str = (string)requestData["userID"];
UUID userID = UUID.Zero;
UUID.TryParse (userID_str, out userID);
List<string> ids = new List<string> ();
foreach (object key in requestData.Keys)
{
if (key is string && ((string)key).StartsWith ("friend_") && requestData[key] != null)
ids.Add (requestData[key].ToString ());
}
bool online = false;
bool.TryParse (requestData["online"].ToString (), out online);
// let's spawn a thread for this, because it may take a long time...
List<UUID> friendsOnline = m_HomeUsersService.StatusNotification (ids, userID, online);
if (friendsOnline.Count > 0)
{
int i = 0;
foreach (UUID id in friendsOnline)
{
hash["friend_" + i.ToString ()] = id.ToString ();
i++;
}
}
else
hash["result"] = "No Friends Online";
}
XmlRpcResponse response = new XmlRpcResponse ();
response.Value = hash;
return response;
}