private OSDMap RecentlyOnlineUsers(OSDMap map)
{
OSDMap resp = new OSDMap();
uint secondsAgo = map.ContainsKey("secondsAgo") ? uint.Parse(map["secondsAgo"]) : 0;
bool stillOnline = map.ContainsKey("stillOnline") ? uint.Parse(map["stillOnline"]) == 1 : false;
uint start = map.ContainsKey("Start") ? map["Start"].AsUInteger() : 0;
uint count = map.ContainsKey("Count") ? map["Count"].AsUInteger() : 10;
IAgentInfoConnector userInfoService = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>();
if (userInfoService == null)
{
resp["Failed"] = new OSDString("Could not get IAgentInfoConnector");
}
else
{
resp["Start"] = OSD.FromInteger((int)start);
resp["Count"] = OSD.FromInteger((int)count);
resp["Total"] = OSD.FromInteger((int)userInfoService.RecentlyOnline(secondsAgo, stillOnline));
OSDArray Users = new OSDArray();
Dictionary<string, bool> sort = new Dictionary<string, bool>(1);
sort["LastSeen"] = true;
List<UserInfo> users = userInfoService.RecentlyOnline(secondsAgo, stillOnline, sort, start, count);
foreach (UserInfo userinfo in users)
{
Users.Add(UserInfo2InfoWebOSD(userinfo));
}
resp["Users"] = Users;
}
return resp;
}