Exemplo n.º 1
0
        private PresenceInfo UpdatePresenceInfo(UUID AgentID, PresenceInfo oldInfo, string ip, string version,
                                                string platform, string mac, string id0)
        {
            PresenceInfo info = new PresenceInfo();

            info.AgentID = AgentID;
            if (!string.IsNullOrEmpty(ip))
            {
                info.LastKnownIP = ip;
            }
            if (!string.IsNullOrEmpty(version))
            {
                info.LastKnownViewer = version;
            }
            if (!string.IsNullOrEmpty(platform))
            {
                info.Platform = platform;
            }
            if (!string.IsNullOrEmpty(mac))
            {
                info.LastKnownMac = mac;
            }
            if (!string.IsNullOrEmpty(id0))
            {
                info.LastKnownID0 = id0;
            }

            if (!oldInfo.KnownID0s.Contains(info.LastKnownID0))
            {
                oldInfo.KnownID0s.Add(info.LastKnownID0);
            }
            if (!oldInfo.KnownIPs.Contains(info.LastKnownIP))
            {
                oldInfo.KnownIPs.Add(info.LastKnownIP);
            }
            if (!oldInfo.KnownMacs.Contains(info.LastKnownMac))
            {
                oldInfo.KnownMacs.Add(info.LastKnownMac);
            }
            if (!oldInfo.KnownViewers.Contains(info.LastKnownViewer))
            {
                oldInfo.KnownViewers.Add(info.LastKnownViewer);
            }

            info.KnownViewers = oldInfo.KnownViewers;
            info.KnownMacs    = oldInfo.KnownMacs;
            info.KnownIPs     = oldInfo.KnownIPs;
            info.KnownID0s    = oldInfo.KnownID0s;
            info.KnownAlts    = oldInfo.KnownAlts;

            info.Flags = oldInfo.Flags;

            presenceInfo.UpdatePresenceInfo(info);

            return(info);
        }