diff --git a/libsecondlife/examples/TestClient/ClientManager.cs b/libsecondlife/examples/TestClient/ClientManager.cs index ba02b480..5c36d7f8 100644 --- a/libsecondlife/examples/TestClient/ClientManager.cs +++ b/libsecondlife/examples/TestClient/ClientManager.cs @@ -14,6 +14,7 @@ namespace libsecondlife.TestClient public string LastName; public string Password; public string StartLocation; + public bool GroupCommands; public string MasterName; public LLUUID MasterKey; public string URI; @@ -93,6 +94,7 @@ namespace libsecondlife.TestClient client.Throttle.Land = 1000000; client.Throttle.Task = 1000000; + client.GroupCommands = account.GroupCommands; client.MasterName = account.MasterName; client.MasterKey = account.MasterKey; diff --git a/libsecondlife/examples/TestClient/Program.cs b/libsecondlife/examples/TestClient/Program.cs index 6c672409..32f21136 100644 --- a/libsecondlife/examples/TestClient/Program.cs +++ b/libsecondlife/examples/TestClient/Program.cs @@ -24,6 +24,7 @@ namespace libsecondlife.TestClient ClientManager manager; List accounts = new List(); LoginDetails account; + bool groupCommands = false; string masterName = String.Empty; LLUUID masterKey = LLUUID.Zero; string file = String.Empty; @@ -31,6 +32,11 @@ namespace libsecondlife.TestClient try { + if (arguments["groupcommands"] != null) + { + groupCommands = true; + } + if (arguments["masterkey"] != null) { masterKey = LLUUID.Parse(arguments["masterkey"]); @@ -121,6 +127,7 @@ namespace libsecondlife.TestClient foreach (LoginDetails a in accounts) { + a.GroupCommands = groupCommands; a.MasterName = masterName; a.MasterKey = masterKey; a.URI = loginuri; diff --git a/libsecondlife/examples/TestClient/TestClient.cs b/libsecondlife/examples/TestClient/TestClient.cs index 747f6c8b..b74fb963 100644 --- a/libsecondlife/examples/TestClient/TestClient.cs +++ b/libsecondlife/examples/TestClient/TestClient.cs @@ -14,6 +14,7 @@ namespace libsecondlife.TestClient public Dictionary Appearances = new Dictionary(); public Dictionary Commands = new Dictionary(); public bool Running = true; + public bool GroupCommands = false; public string MasterName = String.Empty; public LLUUID MasterKey = LLUUID.Zero; public ClientManager ClientManager; @@ -191,38 +192,35 @@ namespace libsecondlife.TestClient private void Self_OnInstantMessage(InstantMessage im, Simulator simulator) { - if (MasterKey != LLUUID.Zero) + + bool groupIM = im.GroupIM && GroupMembers != null && GroupMembers.ContainsKey(im.FromAgentID) ? true : false; + + if (im.FromAgentID == MasterKey || (GroupCommands && groupIM)) { - if (im.FromAgentID != MasterKey) + // Received an IM from someone that is authenticated + Console.WriteLine("<{0} ({1})> {2}: {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message, im.RegionID, im.Position); + + if (im.Dialog == InstantMessageDialog.RequestTeleport) { - // Received an IM from someone that is not the bot's master, ignore - Console.WriteLine("<{0} ({1})> {2} (not master): {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message, - im.RegionID, im.Position); - return; + Console.WriteLine("Accepting teleport lure."); + Self.TeleportLureRespond(im.FromAgentID, true); + } + else if ( + im.Dialog == InstantMessageDialog.MessageFromAgent || + im.Dialog == InstantMessageDialog.MessageFromObject) + { + DoCommand(im.Message, im.FromAgentID); } } - else if (GroupMembers != null && !GroupMembers.ContainsKey(im.FromAgentID)) + + else { - // Received an IM from someone outside the bot's group, ignore - Console.WriteLine("<{0} ({1})> {2} (not in group): {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, - im.Message, im.RegionID, im.Position); + // Received an IM from someone that is not the bot's master, ignore + Console.WriteLine("<{0} ({1})> {2} (not master): {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message, + im.RegionID, im.Position); return; } - // Received an IM from someone that is authenticated - Console.WriteLine("<{0} ({1})> {2}: {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message, im.RegionID, im.Position); - - if (im.Dialog == InstantMessageDialog.RequestTeleport) - { - Console.WriteLine("Accepting teleport lure."); - Self.TeleportLureRespond(im.FromAgentID, true); - } - else if ( - im.Dialog == InstantMessageDialog.MessageFromAgent || - im.Dialog == InstantMessageDialog.MessageFromObject) - { - DoCommand(im.Message, im.FromAgentID); - } } private bool Inventory_OnInventoryObjectReceived(LLUUID fromAgentID, string fromAgentName,