diff options
author | gareth | 2007-05-14 03:13:47 +0000 |
---|---|---|
committer | gareth | 2007-05-14 03:13:47 +0000 |
commit | 64a98c736848de6099254f23483058668273c1a5 (patch) | |
tree | a8f2624277e48814531750db0ec07a8d64c1f740 /ExportBot/Commands/SetMasterCommand.cs | |
parent | Added skeleton for grid management agent (diff) | |
download | opensim-SC_OLD-64a98c736848de6099254f23483058668273c1a5.zip opensim-SC_OLD-64a98c736848de6099254f23483058668273c1a5.tar.gz opensim-SC_OLD-64a98c736848de6099254f23483058668273c1a5.tar.bz2 opensim-SC_OLD-64a98c736848de6099254f23483058668273c1a5.tar.xz |
Finished off adding the new management API to gridserver
Updated VersionInfo.cs finally
Updated prebuild and rebuilt nant build files
Completed Management agent basics
Diffstat (limited to 'ExportBot/Commands/SetMasterCommand.cs')
-rw-r--r-- | ExportBot/Commands/SetMasterCommand.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/ExportBot/Commands/SetMasterCommand.cs b/ExportBot/Commands/SetMasterCommand.cs deleted file mode 100644 index a6ecbdc..0000000 --- a/ExportBot/Commands/SetMasterCommand.cs +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Threading; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | |||
8 | namespace libsecondlife.TestClient | ||
9 | { | ||
10 | public class SetMasterCommand: Command | ||
11 | { | ||
12 | public DateTime Created = DateTime.Now; | ||
13 | private LLUUID resolvedMasterKey = LLUUID.Zero; | ||
14 | private ManualResetEvent keyResolution = new ManualResetEvent(false); | ||
15 | private LLUUID query = LLUUID.Zero; | ||
16 | |||
17 | public SetMasterCommand(TestClient testClient) | ||
18 | { | ||
19 | Name = "setMaster"; | ||
20 | Description = "Sets the user name of the master user. The master user can IM to run commands."; | ||
21 | |||
22 | } | ||
23 | |||
24 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
25 | { | ||
26 | string masterName = String.Empty; | ||
27 | for (int ct = 0; ct < args.Length;ct++) | ||
28 | masterName = masterName + args[ct] + " "; | ||
29 | masterName = masterName.TrimEnd(); | ||
30 | |||
31 | if (masterName.Length == 0) | ||
32 | return "Usage setMaster name"; | ||
33 | |||
34 | DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler); | ||
35 | Client.Directory.OnDirPeopleReply += callback; | ||
36 | query = Client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, masterName); | ||
37 | if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false)) | ||
38 | { | ||
39 | Client.MasterKey = resolvedMasterKey; | ||
40 | keyResolution.Reset(); | ||
41 | Client.Directory.OnDirPeopleReply -= callback; | ||
42 | } | ||
43 | else | ||
44 | { | ||
45 | keyResolution.Reset(); | ||
46 | Client.Directory.OnDirPeopleReply -= callback; | ||
47 | return "Unable to obtain UUID for \"" + masterName + "\". Master unchanged."; | ||
48 | } | ||
49 | |||
50 | |||
51 | foreach (Avatar av in Client.AvatarList.Values) | ||
52 | { | ||
53 | if (av.ID == Client.MasterKey) | ||
54 | { | ||
55 | Client.Self.InstantMessage(av.ID, "You are now my master. IM me with \"help\" for a command list."); | ||
56 | break; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | return "Master set to " + masterName + " (" + Client.MasterKey.ToStringHyphenated() + ")"; | ||
61 | } | ||
62 | |||
63 | private void KeyResolvHandler(LLUUID queryid, List<DirectoryManager.AgentSearchData> matches) | ||
64 | { | ||
65 | if (query != queryid) | ||
66 | return; | ||
67 | // We can't handle ambiguities here as nicely as we can in ClientManager. | ||
68 | resolvedMasterKey = matches[0].AgentID; | ||
69 | keyResolution.Set(); | ||
70 | query = LLUUID.Zero; | ||
71 | } | ||
72 | } | ||
73 | } | ||