private void netcom_InstantMessageSent(object sender, InstantMessageSentEventArgs e)
{
if (e.SessionID != sessionID) return;
-
+
textBuffer.Add(e);
ProcessIM(e);
}
private void ProcessIncomingIM(InstantMessageEventArgs e)
{
string msg = e.IM.Message;
-
+
if (instance.RLV.RestictionActive("recvim", e.IM.FromAgentID.ToString()))
{
msg = "*** IM blocked by your viewer";
}
PrintIM(DateTime.Now, e.IM.FromAgentName, msg);
+
+ if (Type == IMTextManagerType.Agent && e.IM.FromAgentID != UUID.Zero)
+ {
+ bool autoRespond = false;
+ AutoResponseType art = (AutoResponseType)instance.GlobalSettings["auto_response_type"].AsInteger();
+
+ switch (art)
+ {
+ case AutoResponseType.WhenBusy: autoRespond = instance.State.IsBusy; break;
+ case AutoResponseType.WhenFromNonFriend: autoRespond = !instance.Client.Friends.FriendList.ContainsKey(e.IM.FromAgentID); break;
+ case AutoResponseType.Always: autoRespond = true; break;
+ }
+
+ if (autoRespond)
+ {
+ instance.Client.Self.InstantMessage(instance.Client.Self.Name,
+ e.IM.FromAgentID,
+ instance.GlobalSettings["auto_response_text"].AsString(),
+ e.IM.IMSessionID,
+ InstantMessageDialog.BusyAutoResponse,
+ InstantMessageOnline.Online,
+ instance.Client.Self.RelativePosition,
+ instance.Client.Network.CurrentSim.ID,
+ null);
+
+ PrintIM(DateTime.Now, instance.Client.Self.Name, instance.GlobalSettings["auto_response_text"].AsString());
+ }
+ }
}
private void PrintIM(DateTime timestamp, string fromName, string message)
this.tbpGeneral = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.cbFontSize = new System.Windows.Forms.ComboBox();
+ this.cbNoTyping = new System.Windows.Forms.CheckBox();
this.cbMinToTrey = new System.Windows.Forms.CheckBox();
this.cbMUEmotes = new System.Windows.Forms.CheckBox();
this.cbRLV = new System.Windows.Forms.CheckBox();
this.cbTrasactDialog = new System.Windows.Forms.CheckBox();
this.cbIMTimeStamps = new System.Windows.Forms.CheckBox();
this.cbChatTimestamps = new System.Windows.Forms.CheckBox();
- this.cbNoTyping = new System.Windows.Forms.CheckBox();
+ this.tbpAutoResponse = new System.Windows.Forms.TabPage();
+ this.txtAutoResponse = new System.Windows.Forms.TextBox();
+ this.gbAutoResponse = new System.Windows.Forms.GroupBox();
+ this.rbAutoAlways = new System.Windows.Forms.RadioButton();
+ this.rbAutoNonFriend = new System.Windows.Forms.RadioButton();
+ this.rbAutobusy = new System.Windows.Forms.RadioButton();
this.tabControl1.SuspendLayout();
this.tbpGeneral.SuspendLayout();
+ this.tbpAutoResponse.SuspendLayout();
+ this.gbAutoResponse.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tbpGeneral);
+ this.tabControl1.Controls.Add(this.tbpAutoResponse);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Multiline = true;
this.cbFontSize.Leave += new System.EventHandler(this.cbFontSize_Leave);
this.cbFontSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbFontSize_KeyDown);
//
+ // cbNoTyping
+ //
+ this.cbNoTyping.AutoSize = true;
+ this.cbNoTyping.Location = new System.Drawing.Point(8, 286);
+ this.cbNoTyping.Name = "cbNoTyping";
+ this.cbNoTyping.Size = new System.Drawing.Size(150, 17);
+ this.cbNoTyping.TabIndex = 13;
+ this.cbNoTyping.Text = "Don\'t use typing animation";
+ this.cbNoTyping.UseVisualStyleBackColor = true;
+ this.cbNoTyping.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged);
+ //
// cbMinToTrey
//
this.cbMinToTrey.AutoSize = true;
this.cbChatTimestamps.Text = "Show timestamps in chat";
this.cbChatTimestamps.UseVisualStyleBackColor = true;
//
- // cbNoTyping
- //
- this.cbNoTyping.AutoSize = true;
- this.cbNoTyping.Location = new System.Drawing.Point(8, 286);
- this.cbNoTyping.Name = "cbNoTyping";
- this.cbNoTyping.Size = new System.Drawing.Size(150, 17);
- this.cbNoTyping.TabIndex = 13;
- this.cbNoTyping.Text = "Don\'t use typing animation";
- this.cbNoTyping.UseVisualStyleBackColor = true;
- this.cbNoTyping.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged);
+ // tbpAutoResponse
+ //
+ this.tbpAutoResponse.Controls.Add(this.txtAutoResponse);
+ this.tbpAutoResponse.Controls.Add(this.gbAutoResponse);
+ this.tbpAutoResponse.Location = new System.Drawing.Point(4, 22);
+ this.tbpAutoResponse.Name = "tbpAutoResponse";
+ this.tbpAutoResponse.Padding = new System.Windows.Forms.Padding(3);
+ this.tbpAutoResponse.Size = new System.Drawing.Size(456, 320);
+ this.tbpAutoResponse.TabIndex = 2;
+ this.tbpAutoResponse.Text = "Auto Response";
+ this.tbpAutoResponse.UseVisualStyleBackColor = true;
+ //
+ // txtAutoResponse
+ //
+ this.txtAutoResponse.AccessibleName = "Auto response text";
+ this.txtAutoResponse.Location = new System.Drawing.Point(8, 63);
+ this.txtAutoResponse.Multiline = true;
+ this.txtAutoResponse.Name = "txtAutoResponse";
+ this.txtAutoResponse.Size = new System.Drawing.Size(282, 87);
+ this.txtAutoResponse.TabIndex = 1;
+ //
+ // gbAutoResponse
+ //
+ this.gbAutoResponse.Controls.Add(this.rbAutoAlways);
+ this.gbAutoResponse.Controls.Add(this.rbAutoNonFriend);
+ this.gbAutoResponse.Controls.Add(this.rbAutobusy);
+ this.gbAutoResponse.Location = new System.Drawing.Point(3, 6);
+ this.gbAutoResponse.Name = "gbAutoResponse";
+ this.gbAutoResponse.Size = new System.Drawing.Size(287, 51);
+ this.gbAutoResponse.TabIndex = 0;
+ this.gbAutoResponse.TabStop = false;
+ this.gbAutoResponse.Text = "Send auto response when:";
+ //
+ // rbAutoAlways
+ //
+ this.rbAutoAlways.AutoSize = true;
+ this.rbAutoAlways.Location = new System.Drawing.Point(216, 19);
+ this.rbAutoAlways.Name = "rbAutoAlways";
+ this.rbAutoAlways.Size = new System.Drawing.Size(58, 17);
+ this.rbAutoAlways.TabIndex = 2;
+ this.rbAutoAlways.Text = "Always";
+ this.rbAutoAlways.UseVisualStyleBackColor = true;
+ this.rbAutoAlways.CheckedChanged += new System.EventHandler(this.rbAutoAlways_CheckedChanged);
+ //
+ // rbAutoNonFriend
+ //
+ this.rbAutoNonFriend.AutoSize = true;
+ this.rbAutoNonFriend.Location = new System.Drawing.Point(100, 19);
+ this.rbAutoNonFriend.Name = "rbAutoNonFriend";
+ this.rbAutoNonFriend.Size = new System.Drawing.Size(110, 17);
+ this.rbAutoNonFriend.TabIndex = 1;
+ this.rbAutoNonFriend.Text = "IM from non-friend";
+ this.rbAutoNonFriend.UseVisualStyleBackColor = true;
+ this.rbAutoNonFriend.CheckedChanged += new System.EventHandler(this.rbAutoNonFriend_CheckedChanged);
+ //
+ // rbAutobusy
+ //
+ this.rbAutobusy.AutoSize = true;
+ this.rbAutobusy.Checked = true;
+ this.rbAutobusy.Location = new System.Drawing.Point(6, 19);
+ this.rbAutobusy.Name = "rbAutobusy";
+ this.rbAutobusy.Size = new System.Drawing.Size(88, 17);
+ this.rbAutobusy.TabIndex = 0;
+ this.rbAutobusy.TabStop = true;
+ this.rbAutobusy.Text = "In busy mode";
+ this.rbAutobusy.UseVisualStyleBackColor = true;
+ this.rbAutobusy.CheckedChanged += new System.EventHandler(this.rbAutobusy_CheckedChanged);
//
// frmSettings
//
this.tabControl1.ResumeLayout(false);
this.tbpGeneral.ResumeLayout(false);
this.tbpGeneral.PerformLayout();
+ this.tbpAutoResponse.ResumeLayout(false);
+ this.tbpAutoResponse.PerformLayout();
+ this.gbAutoResponse.ResumeLayout(false);
+ this.gbAutoResponse.PerformLayout();
this.ResumeLayout(false);
}
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;
}
namespace Radegast
{
+ public enum AutoResponseType: int
+ {
+ WhenBusy = 0,
+ WhenFromNonFriend = 1,
+ Always = 2
+ }
+
public partial class frmSettings : RadegastForm
{
private Settings s;
+ private static bool settingInitialized = false;
+
+ public static void InitSettigs(Settings s)
+ {
+ if (s["im_timestamps"].Type == OSDType.Unknown)
+ {
+ s["im_timestamps"] = OSD.FromBoolean(true);
+ }
+
+ if (s["rlv_enabled"].Type == OSDType.Unknown)
+ {
+ s["rlv_enabled"] = new OSDBoolean(false);
+ }
+
+ if (s["mu_emotes"].Type == OSDType.Unknown)
+ {
+ s["mu_emotes"] = new OSDBoolean(false);
+ }
+
+ if (s["friends_notification_highlight"].Type == OSDType.Unknown)
+ {
+ s["friends_notification_highlight"] = new OSDBoolean(true);
+ }
+
+ if (!s.ContainsKey("no_typing_anim")) s["no_typing_anim"] = OSD.FromBoolean(false);
+
+ if (!s.ContainsKey("auto_response_type"))
+ {
+ s["auto_response_type"] = (int)AutoResponseType.WhenBusy;
+ s["auto_response_text"] = "The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.";
+ }
+
+ }
public frmSettings(RadegastInstance instance)
{
+ if (settingInitialized)
+ {
+ frmSettings.InitSettigs(instance.GlobalSettings);
+ }
+
InitializeComponent();
s = instance.GlobalSettings;
cbChatTimestamps.Checked = s["chat_timestamps"].AsBoolean();
- if (s["im_timestamps"].Type == OSDType.Unknown)
- s["im_timestamps"] = OSD.FromBoolean(true);
-
cbIMTimeStamps.Checked = s["im_timestamps"].AsBoolean();
cbChatTimestamps.CheckedChanged += new EventHandler(cbChatTimestamps_CheckedChanged);
cbHideLoginGraphics.Checked = s["hide_login_graphics"].AsBoolean();
cbHideLoginGraphics.CheckedChanged += new EventHandler(cbHideLoginGraphics_CheckedChanged);
- if (s["rlv_enabled"].Type == OSDType.Unknown)
- {
- s["rlv_enabled"] = new OSDBoolean(false);
- }
-
cbRLV.Checked = s["rlv_enabled"].AsBoolean();
cbRLV.CheckedChanged += (object sender, EventArgs e) =>
{
s["rlv_enabled"] = new OSDBoolean(cbRLV.Checked);
};
- if (s["mu_emotes"].Type == OSDType.Unknown)
- {
- s["mu_emotes"] = new OSDBoolean(false);
- }
-
cbMUEmotes.Checked = s["mu_emotes"].AsBoolean();
cbMUEmotes.CheckedChanged += (object sender, EventArgs e) =>
{
s["mu_emotes"] = new OSDBoolean(cbMUEmotes.Checked);
};
-
- if (s["friends_notification_highlight"].Type == OSDType.Unknown)
- {
- s["friends_notification_highlight"] = new OSDBoolean(true);
- }
-
cbFriendsHighlight.Checked = s["friends_notification_highlight"].AsBoolean();
cbFriendsHighlight.CheckedChanged += (object sender, EventArgs e) =>
{
};
- if (!s.ContainsKey("no_typing_anim")) s["no_typing_anim"] = OSD.FromBoolean(false);
cbNoTyping.Checked = s["no_typing_anim"].AsBoolean();
cbNoTyping.CheckedChanged += (object sender, EventArgs e) =>
{
s["no_typing_anim"] = OSD.FromBoolean(cbNoTyping.Checked);
};
+ txtAutoResponse.Text = s["auto_response_text"];
+ txtAutoResponse.TextChanged += (object sender, EventArgs e) =>
+ {
+ s["auto_response_text"] = txtAutoResponse.Text;
+ };
+ AutoResponseType art = (AutoResponseType)s["auto_response_type"].AsInteger();
+ switch (art)
+ {
+ case AutoResponseType.WhenBusy: rbAutobusy.Checked = true; break;
+ case AutoResponseType.WhenFromNonFriend: rbAutoNonFriend.Checked = true; break;
+ case AutoResponseType.Always: rbAutoAlways.Checked = true; break;
+ }
}
{
double f = 8.25;
double existing = s["chat_font_size"].AsReal();
-
+
if (!double.TryParse(cbFontSize.Text, out f))
{
cbFontSize.Text = s["chat_font_size"].AsReal().ToString(System.Globalization.CultureInfo.InvariantCulture);
{
UpdateFontSize();
}
+
+ private void rbAutobusy_CheckedChanged(object sender, EventArgs e)
+ {
+ s["auto_response_type"] = (int)AutoResponseType.WhenBusy;
+ }
+
+ private void rbAutoNonFriend_CheckedChanged(object sender, EventArgs e)
+ {
+ s["auto_response_type"] = (int)AutoResponseType.WhenFromNonFriend;
+ }
+
+ private void rbAutoAlways_CheckedChanged(object sender, EventArgs e)
+ {
+ s["auto_response_type"] = (int)AutoResponseType.Always;
+ }
}
}