예제 #1
0
        public Task AddFollower(string alias, long userId, ISubscriber follower)
        {
            ConnectorInfo userInfo = ConnectorInfo.GetUserInfo(userId, alias);

            if (State.Followers.ContainsKey(userInfo))
            {
                State.Followers.Remove(userInfo);
            }
            State.Followers[userInfo] = follower;
            return(WriteStateAsync());
        }
예제 #2
0
        private async Task UnfollowUser(long userId, string userAlias, IMsgPublisher userToUnfollow)
        {
            await userToUnfollow.RemoveFollower(State.UserAlias, this);

            ConnectorInfo userInfo = ConnectorInfo.GetUserInfo(userId, userAlias);

            State.Subscriptions.Remove(userInfo);

            await WriteStateAsync();

            // Notify any viewers that a subscription has been removed for this user
            viewers.Notify(
                v => v.SubscriptionRemoved(userInfo)
                );
        }
예제 #3
0
        private async Task FollowUser(long userId, string userAlias, IMsgPublisher userToFollow)
        {
            if (logger.IsVerbose)
            {
                logger.Verbose("{0} FollowUser({1}).", Me, userAlias);
            }
            await userToFollow.AddFollower(State.UserAlias, State.UserId, this);

            ConnectorInfo userInfo = ConnectorInfo.GetUserInfo(userId, userAlias);

            State.Subscriptions[userInfo] = userToFollow;

            await WriteStateAsync();

            // Notify any viewers that a subscription has been added for this user
            viewers.Notify(
                v => v.SubscriptionAdded(userInfo)
                );
        }