{
instance.RLV.TryProcessCMD(e);
#if !DEBUG
- return;
+ if (!instance.RLV.EnabledDebugCommands) {
+ return;
+ }
#endif
}
public bool Enabled
{
-
get
{
if (instance.GlobalSettings["rlv_enabled"].Type == OSDType.Unknown)
}
}
+ public bool EnabledDebugCommands
+ {
+ get
+ {
+ if (instance.GlobalSettings["rlv_debugcommands"].Type == OSDType.Unknown)
+ {
+ instance.GlobalSettings["rlv_debugcommands"] = new OSDBoolean(false);
+ }
+
+ return instance.GlobalSettings["rlv_debugcommands"].AsBoolean();
+ }
+
+ set
+ {
+ if (EnabledDebugCommands != instance.GlobalSettings["rlv_debugcommands"].AsBoolean())
+ {
+ instance.GlobalSettings["rlv_debugcommands"] = new OSDBoolean(value);
+ }
+ }
+ }
+
RadegastInstance instance;
GridClient client { get { return instance.Client; } }
Regex rlv_regex = new Regex(@"(?<behaviour>[^:=]+)(:(?<option>[^=]*))?=(?<param>\w+)", RegexOptions.Compiled);
}
break;
+ case "findfolder":
+ if (int.TryParse(rule.Param, out chan) && chan > 0)
+ {
+ string[] keywordsArray = rule.Option.Split(new string[] {"&&"}, StringSplitOptions.None);
+ if (keywordsArray.Any())
+ {
+ InventoryNode target = FindFolderKeyword(keywordsArray);
+ if (target != null)
+ {
+ string path = FindFullInventoryPath(target, "");
+
+ // remove #RLV/ from the path
+ if (path.Substring(0, 5).ToLower() == @"#rlv/")
+ {
+ path = path.Substring(5);
+ Respond(chan, path);
+ }
+ }
+ }
+ }
+ break;
+
#endregion #RLV folder and outfit manipulation
}
}
-
return true;
}
return null;
}
+ public string FindFullInventoryPath(InventoryNode input, string pathConstruct)
+ {
+ if (input.Parent == null) {
+ return pathConstruct.TrimEnd('/');
+ } else {
+ pathConstruct = input.Data.Name + "/" + pathConstruct;
+ return FindFullInventoryPath (input.Parent, pathConstruct);
+ }
+ }
+
public InventoryNode FindFolder(string path)
{
var root = RLVRootFolder();
protected InventoryNode FindFolderInternal(InventoryNode currentNode, string currentPath, string desiredPath)
{
- if (desiredPath == currentPath)
+ if (desiredPath.ToLower() == currentPath.ToLower())
{
return currentNode;
}
return null;
}
+ public InventoryNode FindFolderKeyword(string[] keywords)
+ {
+ var root = RLVRootFolder();
+ if (root == null) return null;
+
+ return FindFolderKeywordsInternal (root, keywords);
+ }
+
+ protected InventoryNode FindFolderKeywordsInternal(InventoryNode currentNode, string[] keywords)
+ {
+ bool mustSkip = false;
+ foreach(string kw in keywords)
+ {
+ if (!mustSkip)
+ {
+ if (!currentNode.Data.Name.ToLower().Contains(kw.ToLower()))
+ {
+ mustSkip = true;
+ break;
+ }
+ }
+ }
+
+ if (!mustSkip)
+ {
+ return currentNode;
+ }
+
+ foreach (var n in currentNode.Nodes.Values)
+ {
+ if (n.Data.Name.StartsWith(".")) continue;
+
+ var res = FindFolderKeywordsInternal(n, keywords);
+ if (res != null)
+ {
+ return res;
+ }
+ }
+ return null;
+ }
+
public void Clear(UUID id)
{
lock (rules)
this.cbAutoReconnect = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.cbRLV = new System.Windows.Forms.CheckBox();
+ this.cbRLVDebug = new System.Windows.Forms.CheckBox();
this.cbMinToTrey = new System.Windows.Forms.CheckBox();
this.cbRadegastClientTag = new System.Windows.Forms.CheckBox();
this.cbSyntaxHighlight = new System.Windows.Forms.CheckBox();
this.cbMisc.Controls.Add(this.cbAutoReconnect);
this.cbMisc.Controls.Add(this.label2);
this.cbMisc.Controls.Add(this.cbRLV);
+ this.cbMisc.Controls.Add(this.cbRLVDebug);
this.cbMisc.Controls.Add(this.cbMinToTrey);
this.cbMisc.Controls.Add(this.cbRadegastClientTag);
this.cbMisc.Controls.Add(this.cbSyntaxHighlight);
this.cbMisc.Location = new System.Drawing.Point(270, 6);
this.cbMisc.Name = "cbMisc";
- this.cbMisc.Size = new System.Drawing.Size(236, 310);
+ this.cbMisc.Size = new System.Drawing.Size(236, 330);
this.cbMisc.TabIndex = 2;
this.cbMisc.TabStop = false;
//
this.cbRLV.UseVisualStyleBackColor = true;
this.cbRLV.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged);
//
+ // cbRLVDebug
+ //
+ this.cbRLVDebug.AutoSize = true;
+ this.cbRLVDebug.Location = new System.Drawing.Point(6, 300);
+ this.cbRLVDebug.Name = "cbRLVDebug";
+ this.cbRLVDebug.Size = new System.Drawing.Size(130, 17);
+ this.cbRLVDebug.TabIndex = 12;
+ this.cbRLVDebug.Text = "Output RLV commands";
+ this.cbRLVDebug.UseVisualStyleBackColor = true;
+ this.cbRLVDebug.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged);
+ //
// cbMinToTrey
//
this.cbMinToTrey.AutoSize = true;
public System.Windows.Forms.CheckBox cbAutoReconnect;
public System.Windows.Forms.CheckBox cbHideLoginGraphics;
public System.Windows.Forms.CheckBox cbRLV;
+ public System.Windows.Forms.CheckBox cbRLVDebug;
public System.Windows.Forms.CheckBox cbMUEmotes;
public System.Windows.Forms.CheckBox cbFriendsHighlight;
public System.Windows.Forms.CheckBox cbMinToTrey;
s["rlv_enabled"] = new OSDBoolean(false);
}
+ if (s["rlv_debugcommands"].Type == OSDType.Unknown)
+ {
+ s["rlv_debugcommands"] = new OSDBoolean(false);
+ }
+
if (s["mu_emotes"].Type == OSDType.Unknown)
{
s["mu_emotes"] = new OSDBoolean(false);
s["rlv_enabled"] = new OSDBoolean(cbRLV.Checked);
};
+ cbRLVDebug.Checked = s["rlv_debugcommands"].AsBoolean();
+ cbRLVDebug.CheckedChanged += (object sender, EventArgs e) =>
+ {
+ s["rlv_debugcommands"] = new OSDBoolean(cbRLVDebug.Checked);
+ };
+
cbMUEmotes.Checked = s["mu_emotes"].AsBoolean();
cbMUEmotes.CheckedChanged += (object sender, EventArgs e) =>
{