protected override AuthenticateResult OnAuthenticate(UserInfo userInfo)
        {
            try
            {
                AuthenticateResult authResult = CurrentServer.Authentication.Authenticate(CurrentServer, this, userInfo);
                TwitterAuthenticateResult twitterAuthResult = authResult as TwitterAuthenticateResult;
                if (twitterAuthResult != null && authResult.IsAuthenticated)
                {
                    TwitterUser = twitterAuthResult.User;
                    Identity = twitterAuthResult.Identity;
                }

                if (authResult is OAuthContinueAuthenticationResult)
                    IsOAuthSettingMode = true;

                return authResult;
            }
            catch (Exception ex)
            {
                SendServerErrorMessage(ex.Message);
                return new AuthenticateResult(ErrorReply.ERR_PASSWDMISMATCH, "Password Incorrect");
            }
        }
 public SessionBase GetOrCreateSession(User user)
 {
     return GetOrCreateSession(user.Id.ToString(), (server, sessionId) => new Session(user, this));
 }
 public TwitterAuthenticateResult(User user, TwitterIdentity identity)
     : base()
 {
     User = user;
     Identity = identity;
 }
 public TwitterAuthenticateResult(User user)
     : this(user, null)
 {
 }
        void xmppConnection_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            //Trace.WriteLine(msg.ToString());
            if (msg.From.Bare != ServiceSender)
                return;

            Element entryE = msg.SelectSingleElement("entry");
            Element sourceE = entryE.SelectSingleElement("source");
            Element authorE = sourceE.SelectSingleElement("author");

            User user = new User
            {
                Description = authorE.GetTag("description"),
                Id = authorE.GetTagInt("twitter_id"),
                Location = authorE.GetTag("location"),
                Protected = authorE.GetTagBool("protected"),
                Name = authorE.GetTag("name"),
                ScreenName = authorE.GetTag("screen_name"),
                Url = authorE.GetTag("url"),
                ProfileImageUrl = authorE.GetTag("profile_image_url")
            };

            String body = msg.Body;
            if (body.IndexOf(": ") > -1)
                body = body.Substring(body.IndexOf(": ") + 2);

            Status status = new Status
            {
                CreatedAt = DateTime.Parse(entryE.GetTag("published")),
                Text = body,
                User = user,
                Id = entryE.GetTagInt((entryE.GetTagInt("twitter_id") == 0 ? "status_id" : "twitter_id")) // HACK: 何故かどっちかでくる
            };

            OnStatusUpdateReceived(status);
        }
 public SessionStartedEventArgs(String userName, User user, IPEndPoint endPoint)
 {
     UserName = userName;
     User = user;
     EndPoint = endPoint;
 }
Exemple #7
0
 public static GroongaLoggerUser FromUser(User user)
 {
     return new GroongaLoggerUser()
     {
         Id = user.Id.ToString(),
         Name = GroongaLoggerUtility.ValueOrDefault(user.Name, String.Empty),
         ScreenName = GroongaLoggerUtility.ValueOrDefault(user.ScreenName, String.Empty),
         Location = GroongaLoggerUtility.ValueOrDefault(user.Location, String.Empty),
         Description = GroongaLoggerUtility.ValueOrDefault(user.Description, String.Empty),
         ProfileImageUrl = GroongaLoggerUtility.ValueOrDefault(user.ProfileImageUrl, String.Empty),
         Url = GroongaLoggerUtility.ValueOrDefault(user.Url, String.Empty),
         Protected = user.Protected,
     };
 }