From a4472ceeac7d95997d9a143bfc002da22de416c6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 27 Feb 2010 15:50:41 +0000 Subject: Implement the requestonlinenotification method --- .../Avatar/InstantMessage/PresenceModule.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index 5f51ce1..4e57394 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs @@ -38,6 +38,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { @@ -118,6 +119,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public void OnRequestOnlineNotification(Object sender, string method, List args) { + if (!(sender is IClientAPI)) + return; + + IClientAPI client = (IClientAPI)sender; + + PresenceInfo[] status = PresenceService.GetAgents(args.ToArray()); + + List online = new List(); + List offline = new List(); + + foreach (PresenceInfo pi in status) + { + if (pi.Online) + online.Add(new UUID(pi.UserID)); + else + offline.Add(new UUID(pi.UserID)); + } + + if (online.Count > 0) + client.SendAgentOnline(online.ToArray()); + if (offline.Count > 0) + client.SendAgentOffline(offline.ToArray()); } } } -- cgit v1.1