public void BeginLogin(LoginParams loginParams) { // FIXME: Now that we're using CAPS we could cancel the current login and start a new one if (CurrentContext != null) throw new Exception("Login already in progress"); LoginEvent.Reset(); CurrentContext = loginParams; BeginLogin(); }
private void cmdConnect_Click(object sender, EventArgs e) { if (cmdConnect.Text == "Connect") { cmdConnect.Text = "Disconnect"; txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = false; LoginParams lp = new LoginParams(); lp.FirstName = txtFirstName.Text; lp.LastName = txtLastName.Text; lp.Password = txtPassword.Text; lp.URI = Client.Settings.LOGIN_SERVER; lp.Start = "last"; cmdConnect.Enabled = false; Client.Network.BeginLogin(lp); return; } else { Client.Network.Logout(); cmdConnect.Text = "Connect"; txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; DisableUpload(); InitClient(); } }
/// <summary> /// Login that takes a struct of all the values that will be passed to /// the login server /// </summary> /// <param name="loginParams">The values that will be passed to the login /// server, all fields must be set even if they are String.Empty</param> /// <returns>Whether the login was successful or not. On failure the /// LoginErrorKey string will contain the error code and LoginMessage /// will contain a description of the error</returns> public bool Login(LoginParams loginParams) { BeginLogin(loginParams); LoginEvent.WaitOne(loginParams.Timeout, false); if (CurrentContext != null) { CurrentContext = null; // Will force any pending callbacks to bail out early InternalStatusCode = LoginStatus.Failed; InternalLoginMessage = "Timed out"; return false; } return (InternalStatusCode == LoginStatus.Success); }
/// <summary> /// /// </summary> /// <param name="firstName">Account first name</param> /// <param name="lastName">Account last name</param> /// <param name="password">Account password</param> /// <param name="userAgent">Client application name</param> /// <param name="userVersion">Client application version</param> /// <returns></returns> public LoginParams DefaultLoginParams(string firstName, string lastName, string password, string userAgent, string userVersion) { List<string> options = new List<string>(); //options.Add("gestures"); //options.Add("event_categories"); //options.Add("event_notifications"); //options.Add("classified_categories"); //options.Add("ui-config"); //options.Add("login-flags"); //options.Add("global-textures"); //options.Add("initial-outfit"); LoginParams loginParams = new LoginParams(); loginParams.URI = Client.Settings.LOGIN_SERVER; loginParams.Timeout = Client.Settings.LOGIN_TIMEOUT; loginParams.MethodName = "login_to_simulator"; loginParams.FirstName = firstName; loginParams.LastName = lastName; loginParams.Password = password; loginParams.Start = "last"; loginParams.Channel = userAgent + " (libsecondlife)"; loginParams.Version = userVersion; loginParams.Platform = GetPlatform(); loginParams.MAC = GetMAC(); loginParams.ViewerDigest = String.Empty; loginParams.Options = options; // workaround for bots being caught up in a global ban // This *should* be the hash of the first hard drive, // but any unique identifier works. loginParams.id0 = GetMAC(); return loginParams; }
public void BeginLogin(LoginParams loginParams) { if (CurrentContext != null) throw new Exception("Login already in progress"); LoginEvent.Reset(); CurrentContext = new LoginContext(); CurrentContext.Params = loginParams; BeginLogin(); }
/// <summary> /// /// </summary> /// <param name="firstName">Account first name</param> /// <param name="lastName">Account last name</param> /// <param name="password">Account password</param> /// <param name="userAgent">Client application name</param> /// <param name="userVersion">Client application version</param> /// <returns></returns> public LoginParams DefaultLoginParams(string firstName, string lastName, string password, string userAgent, string userVersion) { List<string> options = new List<string>(); options.Add("inventory-root"); options.Add("inventory-skeleton"); options.Add("inventory-lib-root"); options.Add("inventory-lib-owner"); options.Add("inventory-skel-lib"); options.Add("gestures"); options.Add("event_categories"); options.Add("event_notifications"); options.Add("classified_categories"); options.Add("buddy-list"); options.Add("ui-config"); options.Add("login-flags"); options.Add("global-textures"); // initial-outfit? LoginParams loginParams = new LoginParams(); loginParams.URI = Client.Settings.LOGIN_SERVER; loginParams.Timeout = Client.Settings.LOGIN_TIMEOUT; loginParams.MethodName = "login_to_simulator"; loginParams.FirstName = firstName; loginParams.LastName = lastName; loginParams.Password = password; loginParams.Start = "last"; loginParams.Channel = userAgent + " (libsecondlife)"; loginParams.Version = userVersion; loginParams.Platform = "Win"; loginParams.MAC = String.Empty; loginParams.ViewerDigest = String.Empty; loginParams.Options = options; return loginParams; }
/// <summary> /// Login that takes a struct of all the values that will be passed to /// the login server /// </summary> /// <param name="loginParams">The values that will be passed to the login /// server, all fields must be set even if they are String.Empty</param> /// <returns>Whether the login was successful or not. On failure the /// LoginErrorKey string will contain the error code and LoginMessage /// will contain a description of the error</returns> public bool Login(LoginParams loginParams) { BeginLogin(loginParams); LoginEvent.WaitOne(loginParams.Timeout, false); lock (LockObject) { if (CurrentContext != null) { if (CurrentContext.Request != null) CurrentContext.Request.Abort(); CurrentContext = null; // Will force any pending callbacks to bail out early InternalStatusCode = LoginStatus.Failed; InternalLoginMessage = "Timed out"; return false; } if (InternalStatusCode != LoginStatus.Success) return false; } return true; }