Exemple #1
0
    public override bool UpdateEntry(string userId, FriendEntryBase.Model model)
    {
        if (!base.UpdateEntry(userId, model))
        {
            //Replace the queued model for creation for the updated one.
            if (creationQueue.ContainsKey(userId))
            {
                creationQueue[userId] = model;
            }
            return(false);
        }

        var entry = entries[userId];

        if (model.status == PresenceStatus.ONLINE)
        {
            offlineFriendsList.Remove(userId);
            onlineFriendsList.Add(userId, entry);

            var removedTimestamp = offlineFriendsList.RemoveLastTimestamp(userId);
            onlineFriendsList.AddOrUpdateLastTimestamp(removedTimestamp);
        }
        else
        {
            onlineFriendsList.Remove(userId);
            offlineFriendsList.Add(userId, entry);

            var removedTimestamp = onlineFriendsList.RemoveLastTimestamp(userId);
            offlineFriendsList.AddOrUpdateLastTimestamp(removedTimestamp);
        }

        return(true);
    }
Exemple #2
0
    public override bool UpdateEntry(string userId, FriendEntryBase.Model model)
    {
        if (!base.UpdateEntry(userId, model))
        {
            return(false);
        }

        var entry = entries[userId];

        if (model.status == PresenceStatus.ONLINE)
        {
            offlineFriendsList.Remove(userId);
            onlineFriendsList.Add(userId, entry);

            var removedTimestamp = offlineFriendsList.RemoveLastTimestamp(userId);
            onlineFriendsList.AddOrUpdateLastTimestamp(removedTimestamp);
        }
        else
        {
            onlineFriendsList.Remove(userId);
            offlineFriendsList.Add(userId, entry);

            var removedTimestamp = onlineFriendsList.RemoveLastTimestamp(userId);
            offlineFriendsList.AddOrUpdateLastTimestamp(removedTimestamp);
        }

        return(true);
    }