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/Communication | |
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/Communication')
-rw-r--r-- | ExportBot/Commands/Communication/EchoMasterCommand.cs | 42 | ||||
-rw-r--r-- | ExportBot/Commands/Communication/IMCommand.cs | 71 | ||||
-rw-r--r-- | ExportBot/Commands/Communication/SayCommand.cs | 44 | ||||
-rw-r--r-- | ExportBot/Commands/Communication/ShoutCommand.cs | 49 | ||||
-rw-r--r-- | ExportBot/Commands/Communication/WhisperCommand.cs | 49 |
5 files changed, 0 insertions, 255 deletions
diff --git a/ExportBot/Commands/Communication/EchoMasterCommand.cs b/ExportBot/Commands/Communication/EchoMasterCommand.cs deleted file mode 100644 index 2e426a8..0000000 --- a/ExportBot/Commands/Communication/EchoMasterCommand.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class EchoMasterCommand: Command | ||
10 | { | ||
11 | public EchoMasterCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "echoMaster"; | ||
14 | Description = "Repeat everything that master says."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | if (!Active) | ||
20 | { | ||
21 | Active = true; | ||
22 | Client.Self.OnChat += new MainAvatar.ChatCallback(Self_OnChat); | ||
23 | return "Echoing is now on."; | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | Active = false; | ||
28 | Client.Self.OnChat -= new MainAvatar.ChatCallback(Self_OnChat); | ||
29 | return "Echoing is now off."; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | void Self_OnChat(string message, MainAvatar.ChatAudibleLevel audible, MainAvatar.ChatType type, | ||
34 | MainAvatar.ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) | ||
35 | { | ||
36 | if (message.Length > 0 && Client.MasterKey == id) | ||
37 | { | ||
38 | Client.Self.Chat(message, 0, MainAvatar.ChatType.Normal); | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/ExportBot/Commands/Communication/IMCommand.cs b/ExportBot/Commands/Communication/IMCommand.cs deleted file mode 100644 index 32d7fff..0000000 --- a/ExportBot/Commands/Communication/IMCommand.cs +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Threading; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class ImCommand : Command | ||
10 | { | ||
11 | string ToAvatarName = String.Empty; | ||
12 | ManualResetEvent NameSearchEvent = new ManualResetEvent(false); | ||
13 | Dictionary<string, LLUUID> Name2Key = new Dictionary<string, LLUUID>(); | ||
14 | |||
15 | public ImCommand(TestClient testClient) | ||
16 | { | ||
17 | testClient.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); | ||
18 | |||
19 | Name = "im"; | ||
20 | Description = "Instant message someone. Usage: im [firstname] [lastname] [message]"; | ||
21 | } | ||
22 | |||
23 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
24 | { | ||
25 | if (args.Length < 3) | ||
26 | return "Usage: im [firstname] [lastname] [message]"; | ||
27 | |||
28 | ToAvatarName = args[0] + " " + args[1]; | ||
29 | |||
30 | // Build the message | ||
31 | string message = String.Empty; | ||
32 | for (int ct = 2; ct < args.Length; ct++) | ||
33 | message += args[ct] + " "; | ||
34 | message = message.TrimEnd(); | ||
35 | if (message.Length > 1023) message = message.Remove(1023); | ||
36 | |||
37 | if (!Name2Key.ContainsKey(ToAvatarName.ToLower())) | ||
38 | { | ||
39 | // Send the Query | ||
40 | Client.Avatars.RequestAvatarNameSearch(ToAvatarName, LLUUID.Random()); | ||
41 | |||
42 | NameSearchEvent.WaitOne(6000, false); | ||
43 | } | ||
44 | |||
45 | if (Name2Key.ContainsKey(ToAvatarName.ToLower())) | ||
46 | { | ||
47 | LLUUID id = Name2Key[ToAvatarName.ToLower()]; | ||
48 | |||
49 | Client.Self.InstantMessage(id, message, id); | ||
50 | return "Instant Messaged " + id.ToStringHyphenated() + " with message: " + message; | ||
51 | } | ||
52 | else | ||
53 | { | ||
54 | return "Name lookup for " + ToAvatarName + " failed"; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void Avatars_OnAvatarNameSearch(LLUUID queryID, Dictionary<LLUUID, string> avatars) | ||
59 | { | ||
60 | foreach (KeyValuePair<LLUUID, string> kvp in avatars) | ||
61 | { | ||
62 | if (kvp.Value.ToLower() == ToAvatarName.ToLower()) | ||
63 | { | ||
64 | Name2Key[ToAvatarName.ToLower()] = kvp.Key; | ||
65 | NameSearchEvent.Set(); | ||
66 | return; | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/ExportBot/Commands/Communication/SayCommand.cs b/ExportBot/Commands/Communication/SayCommand.cs deleted file mode 100644 index d5717a6..0000000 --- a/ExportBot/Commands/Communication/SayCommand.cs +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace libsecondlife.TestClient | ||
7 | { | ||
8 | public class SayCommand: Command | ||
9 | { | ||
10 | public SayCommand(TestClient testClient) | ||
11 | { | ||
12 | Name = "say"; | ||
13 | Description = "Say something. (usage: say (optional channel) whatever)"; | ||
14 | } | ||
15 | |||
16 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
17 | { | ||
18 | int channel = 0; | ||
19 | int startIndex = 0; | ||
20 | |||
21 | if (args.Length < 1) | ||
22 | { | ||
23 | return "usage: say (optional channel) whatever"; | ||
24 | } | ||
25 | else if (args.Length > 1) | ||
26 | { | ||
27 | if (Int32.TryParse(args[0], out channel)) | ||
28 | startIndex = 1; | ||
29 | } | ||
30 | |||
31 | StringBuilder message = new StringBuilder(); | ||
32 | |||
33 | for (int i = startIndex; i < args.Length; i++) | ||
34 | { | ||
35 | message.Append(args[i]); | ||
36 | if (i != args.Length - 1) message.Append(" "); | ||
37 | } | ||
38 | |||
39 | Client.Self.Chat(message.ToString(), channel, MainAvatar.ChatType.Normal); | ||
40 | |||
41 | return "Said " + message.ToString(); | ||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/ExportBot/Commands/Communication/ShoutCommand.cs b/ExportBot/Commands/Communication/ShoutCommand.cs deleted file mode 100644 index cf4b6c5..0000000 --- a/ExportBot/Commands/Communication/ShoutCommand.cs +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class ShoutCommand : Command | ||
10 | { | ||
11 | public ShoutCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "shout"; | ||
14 | Description = "Shout something."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | int channel = 0; | ||
20 | int startIndex = 0; | ||
21 | string message = String.Empty; | ||
22 | if (args.Length < 1) | ||
23 | { | ||
24 | return "usage: shout (optional channel) whatever"; | ||
25 | } | ||
26 | else if (args.Length > 1) | ||
27 | { | ||
28 | try | ||
29 | { | ||
30 | channel = Convert.ToInt32(args[0]); | ||
31 | startIndex = 1; | ||
32 | } | ||
33 | catch (FormatException) | ||
34 | { | ||
35 | channel = 0; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | for (int i = startIndex; i < args.Length; i++) | ||
40 | { | ||
41 | message += args[i] + " "; | ||
42 | } | ||
43 | |||
44 | Client.Self.Chat(message, channel, MainAvatar.ChatType.Shout); | ||
45 | |||
46 | return "Shouted " + message; | ||
47 | } | ||
48 | } | ||
49 | } | ||
diff --git a/ExportBot/Commands/Communication/WhisperCommand.cs b/ExportBot/Commands/Communication/WhisperCommand.cs deleted file mode 100644 index 89ba0f3..0000000 --- a/ExportBot/Commands/Communication/WhisperCommand.cs +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace libsecondlife.TestClient | ||
8 | { | ||
9 | public class WhisperCommand : Command | ||
10 | { | ||
11 | public WhisperCommand(TestClient testClient) | ||
12 | { | ||
13 | Name = "whisper"; | ||
14 | Description = "Whisper something."; | ||
15 | } | ||
16 | |||
17 | public override string Execute(string[] args, LLUUID fromAgentID) | ||
18 | { | ||
19 | int channel = 0; | ||
20 | int startIndex = 0; | ||
21 | string message = String.Empty; | ||
22 | if (args.Length < 1) | ||
23 | { | ||
24 | return "usage: whisper (optional channel) whatever"; | ||
25 | } | ||
26 | else if (args.Length > 1) | ||
27 | { | ||
28 | try | ||
29 | { | ||
30 | channel = Convert.ToInt32(args[0]); | ||
31 | startIndex = 1; | ||
32 | } | ||
33 | catch (FormatException) | ||
34 | { | ||
35 | channel = 0; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | for (int i = startIndex; i < args.Length; i++) | ||
40 | { | ||
41 | message += args[i] + " "; | ||
42 | } | ||
43 | |||
44 | Client.Self.Chat(message, channel, MainAvatar.ChatType.Whisper); | ||
45 | |||
46 | return "Whispered " + message; | ||
47 | } | ||
48 | } | ||
49 | } | ||