public ChirperUserInfo ParseUserInfo(XElement nodeData) { var state = ChirperUserInfo.GetUserInfo( Int64.Parse(nodeData.Attribute("id").Value), nodeData.Elements(ns + "data").Single(e => e.Attribute("key").Value == customDataUserAliasValue).Value); return(state); }
public Task AddFollower(string alias, long userId, IChirperSubscriber follower) { ChirperUserInfo userInfo = ChirperUserInfo.GetUserInfo(userId, alias); if (State.Followers.ContainsKey(userInfo)) { State.Followers.Remove(userInfo); } State.Followers[userInfo] = follower; return(TaskDone.Done); }
private async Task UnfollowUser(long userId, string userAlias, IChirperPublisher userToUnfollow) { await userToUnfollow.RemoveFollower(State.UserAlias, this); ChirperUserInfo userInfo = ChirperUserInfo.GetUserInfo(userId, userAlias); State.Subscriptions.Remove(userInfo); // Notify any viewers that a subscription has been removed for this user viewers.Notify( v => v.SubscriptionRemoved(userInfo) ); }
private async Task FollowUser(long userId, string userAlias, IChirperPublisher userToFollow) { if (logger.IsVerbose) { logger.Verbose("{0} FollowUser({1}).", Me, userAlias); } await userToFollow.AddFollower(State.UserAlias, State.UserId, this); ChirperUserInfo userInfo = ChirperUserInfo.GetUserInfo(userId, userAlias); State.Subscriptions[userInfo] = userToFollow; // Notify any viewers that a subscription has been added for this user viewers.Notify( v => v.SubscriptionAdded(userInfo) ); }
private async Task AddChirperUser(ChirperUserInfo userData) { // Create Chirper account grain for this user long userId = userData.UserId; string userAlias = userData.UserAlias; IChirperAccount grain = GrainClient.GrainFactory.GetGrain <IChirperAccount>(userId); this.Users[userId] = grain; try { // Force creation of the grain by sending it a first message to set user alias ChirperUserInfo userInfo = ChirperUserInfo.GetUserInfo(userId, userAlias); await grain.SetUserDetails(userInfo); Interlocked.Increment(ref numUsers); } catch (Exception exc) { ReportError("Error creating user id " + userId, exc); throw exc.GetBaseException(); } }