From 804d445347616b55b63dafcac6b4ce7b4ec1c91d Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 15 May 2011 16:23:01 +0000 Subject: [PATCH] RAD-224: Ability to set auto log in time between attempts git-svn-id: https://radegast.googlecode.com/svn/trunk@857 f7a694da-4d33-11de-9ad6-1127a62b9fcd --- Radegast/Core/PrimDeserializer.cs | 51 ++++++++++++++++-------- Radegast/GUI/Dialogs/MainForm.cs | 12 +----- Radegast/GUI/Dialogs/Settings.Designer.cs | 66 +++++++++++++++++++++---------- Radegast/GUI/Dialogs/Settings.cs | 29 +++++++++++++- 4 files changed, 109 insertions(+), 49 deletions(-) diff --git a/Radegast/Core/PrimDeserializer.cs b/Radegast/Core/PrimDeserializer.cs index 3f22399..89f6911 100644 --- a/Radegast/Core/PrimDeserializer.cs +++ b/Radegast/Core/PrimDeserializer.cs @@ -129,15 +129,19 @@ namespace Radegast { // Build an organized structure from the imported prims Dictionary linksets = new Dictionary(); - for (int i = 0; i < prims.Count; i++) { + for (int i = 0; i < prims.Count; i++) + { Primitive prim = prims[i]; - if (prim.ParentID == 0) { + if (prim.ParentID == 0) + { if (linksets.ContainsKey(prim.LocalID)) linksets[prim.LocalID].RootPrim = prim; else linksets[prim.LocalID] = new Linkset(prim); - } else { + } + else + { if (!linksets.ContainsKey(prim.ParentID)) linksets[prim.ParentID] = new Linkset(); @@ -148,8 +152,10 @@ namespace Radegast primsCreated = new List(); Console.WriteLine("Importing " + linksets.Count + " structures."); - foreach (Linkset linkset in linksets.Values) { - if (linkset.RootPrim.LocalID != 0) { + foreach (Linkset linkset in linksets.Values) + { + if (linkset.RootPrim.LocalID != 0) + { state = ImporterState.RezzingParent; currentPrim = linkset.RootPrim; // HACK: Import the structure just above our head @@ -165,7 +171,8 @@ namespace Radegast Client.Objects.AddPrim(Client.Network.CurrentSim, linkset.RootPrim.PrimData, Client.Self.ActiveGroup, linkset.RootPrim.Position, linkset.RootPrim.Scale, linkset.RootPrim.Rotation); - if (!primDone.WaitOne(25000, false)) { + if (!primDone.WaitOne(25000, false)) + { throw new Exception("Rez failed, timed out while creating the root prim."); } Client.Objects.SetPosition(Client.Network.CurrentSim, primsCreated[primsCreated.Count - 1].LocalID, currentPosition); @@ -173,25 +180,29 @@ namespace Radegast state = ImporterState.RezzingChildren; // Rez the child prims - foreach (Primitive prim in linkset.Children) { + foreach (Primitive prim in linkset.Children) + { currentPrim = prim; currentPosition = prim.Position + linkset.RootPrim.Position; Client.Objects.AddPrim(Client.Network.CurrentSim, prim.PrimData, UUID.Zero, currentPosition, prim.Scale, prim.Rotation); - if (!primDone.WaitOne(25000, false)) { + if (!primDone.WaitOne(25000, false)) + { throw new Exception("Rez failed, timed out while creating child prim."); } Client.Objects.SetPosition(Client.Network.CurrentSim, primsCreated[primsCreated.Count - 1].LocalID, currentPosition); // Client.Objects.SetRotation(Client.Network.CurrentSim, primsCreated[primsCreated.Count - 1].LocalID, prim.Rotation); } - if (linkset.Children.Count != 0) { + if (linkset.Children.Count != 0) + { // Create a list of the local IDs of the newly created prims List primIDs = new List(primsCreated.Count); primIDs.Add(rootLocalID); // Root prim is first in list. - foreach (Primitive prim in primsCreated) { + foreach (Primitive prim in primsCreated) + { if (prim.LocalID != rootLocalID) primIDs.Add(prim.LocalID); } @@ -203,14 +214,17 @@ namespace Radegast Client.Objects.LinkPrims(Client.Network.CurrentSim, linkQueue); Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation); - if (!primDone.WaitOne(5000, false)) { + if (!primDone.WaitOne(5000, false)) + { Logger.Log(String.Format("Warning: Failed to link {0} prims", linkQueue.Count), Helpers.LogLevel.Warning); } Client.Objects.SetPermissions(Client.Network.CurrentSim, primIDs, PermissionWho.NextOwner, PermissionMask.All, true); - } else { + } + else + { List primsForPerms = new List(); primsForPerms.Add(rootLocalID); Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation); @@ -219,7 +233,9 @@ namespace Radegast PermissionMask.All, true); } state = ImporterState.Idle; - } else { + } + else + { // Skip linksets with a missing root prim Logger.Log("WARNING: Skipping a linkset with a missing root prim", Helpers.LogLevel.Warning); } @@ -236,7 +252,8 @@ namespace Radegast if ((e.Prim.Flags & PrimFlags.CreateSelected) == 0) return; // We received an update for an object we didn't create - switch (state) { + switch (state) + { case ImporterState.RezzingParent: rootLocalID = e.Prim.LocalID; goto case ImporterState.RezzingChildren; @@ -263,11 +280,13 @@ namespace Radegast Client.Objects.SetSculpt(e.Simulator, e.Prim.LocalID, currentPrim.Sculpt); } - if (currentPrim.Properties != null && !String.IsNullOrEmpty(currentPrim.Properties.Name)) { + if (currentPrim.Properties != null && !String.IsNullOrEmpty(currentPrim.Properties.Name)) + { Client.Objects.SetName(e.Simulator, e.Prim.LocalID, currentPrim.Properties.Name); } - if (currentPrim.Properties != null && !String.IsNullOrEmpty(currentPrim.Properties.Description)) { + if (currentPrim.Properties != null && !String.IsNullOrEmpty(currentPrim.Properties.Description)) + { Client.Objects.SetDescription(e.Simulator, e.Prim.LocalID, currentPrim.Properties.Description); } diff --git a/Radegast/GUI/Dialogs/MainForm.cs b/Radegast/GUI/Dialogs/MainForm.cs index 26f52aa..ed5cf5c 100644 --- a/Radegast/GUI/Dialogs/MainForm.cs +++ b/Radegast/GUI/Dialogs/MainForm.cs @@ -165,16 +165,6 @@ namespace Radegast statusStrip1.LayoutStyle = ToolStripLayoutStyle.Table; } - // Config options - if (instance.GlobalSettings["transaction_notification_chat"].Type == OSDType.Unknown) - instance.GlobalSettings["transaction_notification_chat"] = OSD.FromBoolean(true); - - if (instance.GlobalSettings["transaction_notification_dialog"].Type == OSDType.Unknown) - instance.GlobalSettings["transaction_notification_dialog"] = OSD.FromBoolean(true); - - if (!instance.GlobalSettings.ContainsKey("minimize_to_tray")) - instance.GlobalSettings["minimize_to_tray"] = OSD.FromBoolean(false); - // Callbacks netcom.ClientLoginStatus += new EventHandler(netcom_ClientLoginStatus); netcom.ClientLoggedOut += new EventHandler(netcom_ClientLoggedOut); @@ -310,7 +300,7 @@ namespace Radegast } InAutoReconnect = true; - frmReconnect dialog = new frmReconnect(instance, 120); + frmReconnect dialog = new frmReconnect(instance, instance.GlobalSettings["reconnect_time"]); dialog.ShowDialog(this); dialog.Dispose(); dialog = null; diff --git a/Radegast/GUI/Dialogs/Settings.Designer.cs b/Radegast/GUI/Dialogs/Settings.Designer.cs index 6a117a2..1c26270 100644 --- a/Radegast/GUI/Dialogs/Settings.Designer.cs +++ b/Radegast/GUI/Dialogs/Settings.Designer.cs @@ -61,6 +61,8 @@ namespace Radegast System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tbpGeneral = new System.Windows.Forms.TabPage(); + this.txtReconnectTime = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); this.gbDisplayNames = new System.Windows.Forms.GroupBox(); this.rbDNOnlyDN = new System.Windows.Forms.RadioButton(); this.rbDNDandUsernme = new System.Windows.Forms.RadioButton(); @@ -108,6 +110,8 @@ namespace Radegast // // tbpGeneral // + this.tbpGeneral.Controls.Add(this.txtReconnectTime); + this.tbpGeneral.Controls.Add(this.label2); this.tbpGeneral.Controls.Add(this.gbDisplayNames); this.tbpGeneral.Controls.Add(this.cbSyntaxHighlight); this.tbpGeneral.Controls.Add(this.label1); @@ -132,6 +136,24 @@ namespace Radegast this.tbpGeneral.Text = "General"; this.tbpGeneral.UseVisualStyleBackColor = true; // + // txtReconnectTime + // + this.txtReconnectTime.Location = new System.Drawing.Point(139, 165); + this.txtReconnectTime.Name = "txtReconnectTime"; + this.txtReconnectTime.Size = new System.Drawing.Size(53, 20); + this.txtReconnectTime.TabIndex = 7; + this.txtReconnectTime.Text = "120"; + this.txtReconnectTime.TextChanged += new System.EventHandler(this.txtReconnectTime_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 167); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(125, 13); + this.label2.TabIndex = 16; + this.label2.Text = "Autoreconnect time (sec)"; + // // gbDisplayNames // this.gbDisplayNames.Controls.Add(this.rbDNOnlyDN); @@ -206,7 +228,7 @@ namespace Radegast // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 239); + this.label1.Location = new System.Drawing.Point(267, 190); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(73, 13); this.label1.TabIndex = 10; @@ -224,10 +246,10 @@ namespace Radegast "14", "16", "20"}); - this.cbFontSize.Location = new System.Drawing.Point(87, 236); + this.cbFontSize.Location = new System.Drawing.Point(346, 187); this.cbFontSize.Name = "cbFontSize"; this.cbFontSize.Size = new System.Drawing.Size(54, 21); - this.cbFontSize.TabIndex = 11; + this.cbFontSize.TabIndex = 16; this.cbFontSize.Text = "8.25"; this.cbFontSize.SelectedIndexChanged += new System.EventHandler(this.cbFontSize_SelectedIndexChanged); this.cbFontSize.Leave += new System.EventHandler(this.cbFontSize_Leave); @@ -258,10 +280,10 @@ namespace Radegast // cbMUEmotes // this.cbMUEmotes.AutoSize = true; - this.cbMUEmotes.Location = new System.Drawing.Point(8, 213); + this.cbMUEmotes.Location = new System.Drawing.Point(8, 235); this.cbMUEmotes.Name = "cbMUEmotes"; this.cbMUEmotes.Size = new System.Drawing.Size(108, 17); - this.cbMUEmotes.TabIndex = 9; + this.cbMUEmotes.TabIndex = 10; this.cbMUEmotes.Text = "MU* style emotes"; this.cbMUEmotes.UseVisualStyleBackColor = true; this.cbMUEmotes.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged); @@ -269,10 +291,10 @@ namespace Radegast // cbRLV // this.cbRLV.AutoSize = true; - this.cbRLV.Location = new System.Drawing.Point(8, 190); + this.cbRLV.Location = new System.Drawing.Point(8, 212); this.cbRLV.Name = "cbRLV"; this.cbRLV.Size = new System.Drawing.Size(85, 17); - this.cbRLV.TabIndex = 8; + this.cbRLV.TabIndex = 9; this.cbRLV.Text = "RLV support"; this.cbRLV.UseVisualStyleBackColor = true; this.cbRLV.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged); @@ -280,10 +302,10 @@ namespace Radegast // cbHideLoginGraphics // this.cbHideLoginGraphics.AutoSize = true; - this.cbHideLoginGraphics.Location = new System.Drawing.Point(8, 167); + this.cbHideLoginGraphics.Location = new System.Drawing.Point(8, 189); this.cbHideLoginGraphics.Name = "cbHideLoginGraphics"; this.cbHideLoginGraphics.Size = new System.Drawing.Size(141, 17); - this.cbHideLoginGraphics.TabIndex = 7; + this.cbHideLoginGraphics.TabIndex = 8; this.cbHideLoginGraphics.Text = "Hide login slpash screen"; this.cbHideLoginGraphics.UseVisualStyleBackColor = true; this.cbHideLoginGraphics.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged); @@ -471,18 +493,20 @@ namespace Radegast public System.Windows.Forms.CheckBox cbFriendsHighlight; public System.Windows.Forms.CheckBox cbMinToTrey; public System.Windows.Forms.CheckBox cbNoTyping; - private System.Windows.Forms.TabPage tbpAutoResponse; - private System.Windows.Forms.GroupBox gbAutoResponse; - private System.Windows.Forms.TextBox txtAutoResponse; - private System.Windows.Forms.RadioButton rbAutoAlways; - private System.Windows.Forms.RadioButton rbAutoNonFriend; - private System.Windows.Forms.RadioButton rbAutobusy; - private System.Windows.Forms.CheckBox cbSyntaxHighlight; - private System.Windows.Forms.GroupBox gbDisplayNames; - private System.Windows.Forms.RadioButton rbDNOnlyDN; - private System.Windows.Forms.RadioButton rbDNDandUsernme; - private System.Windows.Forms.RadioButton rbDNSmart; - private System.Windows.Forms.RadioButton rbDNOff; + public System.Windows.Forms.TextBox txtReconnectTime; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.TabPage tbpAutoResponse; + public System.Windows.Forms.GroupBox gbAutoResponse; + public System.Windows.Forms.TextBox txtAutoResponse; + public System.Windows.Forms.RadioButton rbAutoAlways; + public System.Windows.Forms.RadioButton rbAutoNonFriend; + public System.Windows.Forms.RadioButton rbAutobusy; + public System.Windows.Forms.CheckBox cbSyntaxHighlight; + public System.Windows.Forms.GroupBox gbDisplayNames; + public System.Windows.Forms.RadioButton rbDNOnlyDN; + public System.Windows.Forms.RadioButton rbDNDandUsernme; + public System.Windows.Forms.RadioButton rbDNSmart; + public System.Windows.Forms.RadioButton rbDNOff; } diff --git a/Radegast/GUI/Dialogs/Settings.cs b/Radegast/GUI/Dialogs/Settings.cs index 86ec151..93d573b 100644 --- a/Radegast/GUI/Dialogs/Settings.cs +++ b/Radegast/GUI/Dialogs/Settings.cs @@ -85,7 +85,7 @@ namespace Radegast if (!s.ContainsKey("script_syntax_highlight")) s["script_syntax_highlight"] = OSD.FromBoolean(true); - if (!s.ContainsKey("display_name_mode")) s["display_name_mode"] = (int)NameMode.Standard; + if (!s.ContainsKey("display_name_mode")) s["display_name_mode"] = (int)NameMode.Smart; // Convert legacy settings from first last name to username if (!s.ContainsKey("username") && (s.ContainsKey("first_name") && s.ContainsKey("last_name"))) @@ -94,6 +94,15 @@ namespace Radegast s.Remove("first_name"); s.Remove("last_name"); } + + if (!s.ContainsKey("reconnect_time")) s["reconnect_time"] = 120; + + if (!s.ContainsKey("transaction_notification_chat")) s["transaction_notification_chat"] = true; + + if (!s.ContainsKey("transaction_notification_dialog")) s["transaction_notification_dialog"] = true; + + if (!s.ContainsKey("minimize_to_tray")) s["minimize_to_tray"] = false; + } public frmSettings(RadegastInstance instance) @@ -104,6 +113,7 @@ namespace Radegast } InitializeComponent(); + s = instance.GlobalSettings; cbChatTimestamps.Checked = s["chat_timestamps"].AsBoolean(); @@ -190,6 +200,8 @@ namespace Radegast case NameMode.DisplayNameAndUserName: rbDNDandUsernme.Checked = true; break; case NameMode.OnlyDisplayName: rbDNOnlyDN.Checked = true; break; } + + txtReconnectTime.Text = s["reconnect_time"].AsInteger().ToString(); } void cbHideLoginGraphics_CheckedChanged(object sender, EventArgs e) @@ -300,5 +312,20 @@ namespace Radegast if (rbDNOnlyDN.Checked) s["display_name_mode"] = (int)NameMode.OnlyDisplayName; } + + private void txtReconnectTime_TextChanged(object sender, EventArgs e) + { + string input = System.Text.RegularExpressions.Regex.Replace(txtReconnectTime.Text, @"[^\d]", ""); + int t = 120; + int.TryParse(input, out t); + + if (txtReconnectTime.Text != t.ToString()) + { + txtReconnectTime.Text = t.ToString(); + txtReconnectTime.Select(txtReconnectTime.Text.Length, 0); + } + + s["reconnect_time"] = t; + } } } -- 2.11.0