OpenMetaverse.FriendsManager.OfflineNotificationHandler C# (CSharp) Method

OfflineNotificationHandler() private method

Handle notifications sent when a friends has gone offline.
private OfflineNotificationHandler ( Packet packet, Simulator simulator ) : void
packet OpenMetaverse.Packets.Packet
simulator Simulator
return void
        private void OfflineNotificationHandler(Packet packet, Simulator simulator)
        {
            if (packet.Type == PacketType.OfflineNotification)
            {
                OfflineNotificationPacket notification = ((OfflineNotificationPacket)packet);

                foreach (OfflineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend;

                    lock (FriendList)
                    {
                        if (!FriendList.ContainsKey(block.AgentID))
                            FriendList.Add(block.AgentID, new FriendInfo(block.AgentID, FriendRights.CanSeeOnline, FriendRights.CanSeeOnline));

                        friend = FriendList[block.AgentID];
                        friend.IsOnline = false;
                    }

                    if (OnFriendOffline != null)
                    {
                        try { OnFriendOffline(friend); }
                        catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                    }
                }
            }
        }