aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot
diff options
context:
space:
mode:
authorgareth2007-05-08 09:56:20 +0000
committergareth2007-05-08 09:56:20 +0000
commitcbf492109ccda213971c09d1048e9d26d09d9b37 (patch)
treec8ab5c60740acf20033c9241410a94854513d029 /ExportBot
parentRemoved libsl nant build file (diff)
downloadopensim-SC-cbf492109ccda213971c09d1048e9d26d09d9b37.zip
opensim-SC-cbf492109ccda213971c09d1048e9d26d09d9b37.tar.gz
opensim-SC-cbf492109ccda213971c09d1048e9d26d09d9b37.tar.bz2
opensim-SC-cbf492109ccda213971c09d1048e9d26d09d9b37.tar.xz
Fixed nant build files
Added ExportBot code (ZOMG! IMPORTED THE EXPORT BOT!) Fixed ExportBot's build
Diffstat (limited to 'ExportBot')
-rw-r--r--ExportBot/ClientManager.cs12
-rw-r--r--ExportBot/Commands/CloneProfileCommand.cs25
-rw-r--r--ExportBot/Commands/Communication/TtsCommand.cs51
-rw-r--r--ExportBot/ExportBot.build67
-rw-r--r--ExportBot/ExportBot.exe.build98
-rw-r--r--ExportBot/Program.cs28
-rw-r--r--ExportBot/TestClient.cs12
7 files changed, 216 insertions, 77 deletions
diff --git a/ExportBot/ClientManager.cs b/ExportBot/ClientManager.cs
index 0e43142..65c01ee 100644
--- a/ExportBot/ClientManager.cs
+++ b/ExportBot/ClientManager.cs
@@ -70,6 +70,18 @@ namespace libsecondlife.TestClient
70 Login(account); 70 Login(account);
71 } 71 }
72 } 72 }
73
74 public string ExportAvatarRestMethod( string request, string path, string param )
75 {
76 Console.WriteLine("Got a request to export an avatar!");
77 Console.WriteLine("Executing cloneprofile " + param);
78 DoCommandAll("cloneprofile " + param, null, null);
79 DoCommandAll("say copied avatar, preparing to upload to remote server...", null, null);
80 return "OK";
81
82 }
83
84
73 /// <summary> 85 /// <summary>
74 /// 86 ///
75 /// </summary> 87 /// </summary>
diff --git a/ExportBot/Commands/CloneProfileCommand.cs b/ExportBot/Commands/CloneProfileCommand.cs
index d7fb5fc..d608318 100644
--- a/ExportBot/Commands/CloneProfileCommand.cs
+++ b/ExportBot/Commands/CloneProfileCommand.cs
@@ -10,6 +10,7 @@ namespace libsecondlife.TestClient
10 { 10 {
11 Avatar.AvatarProperties Properties; 11 Avatar.AvatarProperties Properties;
12 Avatar.Interests Interests; 12 Avatar.Interests Interests;
13 private Dictionary<LLUUID,ulong> Avatars = new Dictionary<LLUUID,ulong>();
13 List<LLUUID> Groups = new List<LLUUID>(); 14 List<LLUUID> Groups = new List<LLUUID>();
14 bool ReceivedProperties = false; 15 bool ReceivedProperties = false;
15 bool ReceivedInterests = false; 16 bool ReceivedInterests = false;
@@ -23,12 +24,22 @@ namespace libsecondlife.TestClient
23 testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups); 24 testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups);
24 testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup); 25 testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup);
25 26
27 testClient.Self.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(AvatarSeen);
28
26 Name = "cloneprofile"; 29 Name = "cloneprofile";
27 Description = "Clones another avatars profile as closely as possible. WARNING: This command will " + 30 Description = "Clones another avatars profile as closely as possible. WARNING: This command will " +
28 "destroy your existing profile! Usage: cloneprofile [targetuuid]"; 31 "destroy your existing profile! Usage: cloneprofile [targetuuid]";
29 } 32 }
30 33
31 public override string Execute(string[] args, LLUUID fromAgentID) 34 void AvatarSeen(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
35 {
36 lock (Avatars)
37 {
38 Avatars.Add(avatar.UUID,avatar.LocalID);
39 }
40 }
41
42 public override string Execute(string[] args, LLUUID fromAgentID)
32 { 43 {
33 if (args.Length != 1) 44 if (args.Length != 1)
34 return Description; 45 return Description;
@@ -58,20 +69,8 @@ namespace libsecondlife.TestClient
58 if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups) 69 if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
59 return "Failed to retrieve a complete profile for that UUID"; 70 return "Failed to retrieve a complete profile for that UUID";
60 71
61 // Synchronize our profile
62 Client.Self.ProfileInterests = Interests;
63 Client.Self.ProfileProperties = Properties;
64 Client.Self.SetAvatarInformation(); 72 Client.Self.SetAvatarInformation();
65 73
66 // TODO: Leave all the groups we're currently a member of? This could
67 // break TestClient connectivity that might be relying on group authentication
68
69 // Attempt to join all the groups
70 foreach (LLUUID groupID in Groups)
71 {
72 Client.Self.RequestJoinGroup(groupID);
73 }
74
75 return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated(); 74 return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated();
76 } 75 }
77 76
diff --git a/ExportBot/Commands/Communication/TtsCommand.cs b/ExportBot/Commands/Communication/TtsCommand.cs
deleted file mode 100644
index e8bd122..0000000
--- a/ExportBot/Commands/Communication/TtsCommand.cs
+++ /dev/null
@@ -1,51 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Speech.Synthesis;
5using libsecondlife;
6using libsecondlife.Packets;
7using libsecondlife.AssetSystem;
8
9
10// Since this requires .Net 3.0 I've left it out of the project by default.
11// To use this: include it in the project and add a reference to the System.Speech.dll
12
13namespace libsecondlife.TestClient
14{
15 public class TtsCommand : Command
16 {
17 SpeechSynthesizer _speechSynthesizer;
18
19 public TtsCommand(TestClient testClient)
20 {
21 Name = "tts";
22 Description = "Text To Speech. When activated, client will echo all recieved chat messages out thru the computer's speakers.";
23 }
24
25 public override string Execute(string[] args, LLUUID fromAgentID)
26 {
27 if (!Active)
28 {
29 if (_speechSynthesizer == null)
30 _speechSynthesizer = new SpeechSynthesizer();
31 Active = true;
32 Client.Self.OnChat += new MainAvatar.ChatCallback(Self_OnChat);
33 return "TTS is now on.";
34 }
35 else
36 {
37 Active = false;
38 Client.Self.OnChat -= new MainAvatar.ChatCallback(Self_OnChat);
39 return "TTS is now off.";
40 }
41 }
42
43 void Self_OnChat(string message, byte audible, byte type, byte sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
44 {
45 if (message.Length > 0)
46 {
47 _speechSynthesizer.SpeakAsync(message);
48 }
49 }
50 }
51} \ No newline at end of file
diff --git a/ExportBot/ExportBot.build b/ExportBot/ExportBot.build
new file mode 100644
index 0000000..033a149
--- /dev/null
+++ b/ExportBot/ExportBot.build
@@ -0,0 +1,67 @@
1<?xml version="1.0" ?>
2<project name="ExportBot" default="build">
3 <echo message="Using '${nant.settings.currentframework}' Framework"/>
4
5 <property name="bin.dir" value="bin" />
6 <property name="obj.dir" value="obj" />
7 <property name="doc.dir" value="doc" />
8 <property name="project.main.dir" value="${project::get-base-directory()}" />
9 <property name="project.config" value="Release" />
10
11 <target name="Release" description="">
12 <property name="project.config" value="Release" />
13 <property name="build.debug" value="false" />
14 </target>
15
16
17 <target name="Debug" description="">
18 <property name="project.config" value="Debug" />
19 <property name="build.debug" value="true" />
20 </target>
21
22 <target name="net-1.1" description="Sets framework to .NET 1.1">
23 <property name="nant.settings.currentframework" value="net-1.1" />
24 </target>
25
26 <target name="net-2.0" description="Sets framework to .NET 2.0">
27 <property name="nant.settings.currentframework" value="net-2.0" />
28 </target>
29
30 <target name="mono-2.0" description="Sets framework to mono 2.0">
31 <property name="nant.settings.currentframework" value="mono-2.0" />
32 </target>
33
34 <target name="mono-1.0" description="Sets framework to mono 1.0">
35 <property name="nant.settings.currentframework" value="mono-1.0" />
36 </target>
37
38 <target name="init" description="">
39 <call target="${project.config}" />
40 <sysinfo />
41 <echo message="Platform ${sys.os.platform}" />
42 <property name="build.dir" value="${bin.dir}/${project.config}" />
43 </target>
44
45 <target name="clean" description="">
46 <echo message="Deleting all builds from all configurations" />
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 <nant buildfile="./ExportBot.exe.build" target="clean" />
50 </target>
51
52 <target name="build" depends="init" description="">
53 <nant buildfile="./ExportBot.exe.build" target="build" />
54 </target>
55
56 <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
57
58 <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
59
60 <target name="package" depends="clean, doc" description="Builds all" />
61
62 <target name="doc" depends="build-release">
63 <echo message="Generating all documentation from all builds" />
64 <nant buildfile="./ExportBot.exe.build" target="doc" />
65 </target>
66
67</project>
diff --git a/ExportBot/ExportBot.exe.build b/ExportBot/ExportBot.exe.build
new file mode 100644
index 0000000..9181aa4
--- /dev/null
+++ b/ExportBot/ExportBot.exe.build
@@ -0,0 +1,98 @@
1<?xml version="1.0" ?>
2<project name="ExportBot" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="ExportBot" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Arguments.cs" />
15 <include name="ClientManager.cs" />
16 <include name="Command.cs" />
17 <include name="Parsing.cs" />
18 <include name="Program.cs" />
19 <include name="TestClient.cs" />
20 <include name="Commands/AppearanceCommand.cs" />
21 <include name="Commands/CloneProfileCommand.cs" />
22 <include name="Commands/DebugCommand.cs" />
23 <include name="Commands/DilationCommand.cs" />
24 <include name="Commands/DumpOutfitCommand.cs" />
25 <include name="Commands/ExportCommand.cs" />
26 <include name="Commands/ExportOutfitCommand.cs" />
27 <include name="Commands/ExportParticlesCommand.cs" />
28 <include name="Commands/FindSimCommand.cs" />
29 <include name="Commands/HelpCommand.cs" />
30 <include name="Commands/ImportCommand.cs" />
31 <include name="Commands/ImportOutfitCommand.cs" />
32 <include name="Commands/LoadCommand.cs" />
33 <include name="Commands/LoginCommand.cs" />
34 <include name="Commands/LogoutCommand.cs" />
35 <include name="Commands/MD5Command.cs" />
36 <include name="Commands/PacketLogCommand.cs" />
37 <include name="Commands/ParcelInfoCommand.cs" />
38 <include name="Commands/PrimCountCommand.cs" />
39 <include name="Commands/QuitCommand.cs" />
40 <include name="Commands/RegionInfoCommand.cs" />
41 <include name="Commands/SetMasterCommand.cs" />
42 <include name="Commands/SetMasterKeyCommand.cs" />
43 <include name="Commands/ShowEffectsCommand.cs" />
44 <include name="Commands/StatsCommand.cs" />
45 <include name="Commands/TouchCommand.cs" />
46 <include name="Commands/TreeCommand.cs" />
47 <include name="Commands/UptimeCommand.cs" />
48 <include name="Commands/WhoCommand.cs" />
49 <include name="Commands/Communication/EchoMasterCommand.cs" />
50 <include name="Commands/Communication/IMCommand.cs" />
51 <include name="Commands/Communication/SayCommand.cs" />
52 <include name="Commands/Communication/ShoutCommand.cs" />
53 <include name="Commands/Communication/WhisperCommand.cs" />
54 <include name="Commands/Inventory/BalanceCommand.cs" />
55 <include name="Commands/Inventory/DeleteFolderCommand.cs" />
56 <include name="Commands/Inventory/GiveAllCommand.cs" />
57 <include name="Commands/Inventory/InventoryCommand.cs" />
58 <include name="Commands/Inventory/WearCommand.cs" />
59 <include name="Commands/Movement/FollowCommand.cs" />
60 <include name="Commands/Movement/GotoCommand.cs" />
61 <include name="Commands/Movement/JumpCommand.cs" />
62 <include name="Commands/Movement/LocationCommand.cs" />
63 <include name="Commands/Movement/MoveToCommand.cs" />
64 <include name="Commands/Movement/SitCommand.cs" />
65 <include name="Commands/Movement/SitOnCommand.cs" />
66 <include name="Commands/Movement/StandCommand.cs" />
67 <include name="Properties/AssemblyInfo.cs" />
68 </sources>
69 <references basedir="${project::get-base-directory()}">
70 <lib>
71 <include name="${project::get-base-directory()}" />
72 <include name="${project::get-base-directory()}/${build.dir}" />
73 </lib>
74 <include name="System.dll" />
75 <include name="System.Xml.dll" />
76 <include name="../bin/libsecondlife.dll" />
77 <include name="../bin/openjpegnet.dll" />
78 <include name="../bin/OpenSim.Framework.dll" />
79 <include name="../bin/OpenSim.Framework.Console.dll" />
80 <include name="../bin/OpenSim.Servers.dll" />
81 </references>
82 </csc>
83 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
84 <mkdir dir="${project::get-base-directory()}/../bin/"/>
85 <copy todir="${project::get-base-directory()}/../bin/">
86 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
87 <include name="*.dll"/>
88 <include name="*.exe"/>
89 </fileset>
90 </copy>
91 </target>
92 <target name="clean">
93 <delete dir="${bin.dir}" failonerror="false" />
94 <delete dir="${obj.dir}" failonerror="false" />
95 </target>
96 <target name="doc" description="Creates documentation.">
97 </target>
98</project>
diff --git a/ExportBot/Program.cs b/ExportBot/Program.cs
index 705cf90..8855be1 100644
--- a/ExportBot/Program.cs
+++ b/ExportBot/Program.cs
@@ -1,21 +1,28 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO; 3using System.IO;
4using System.Threading;
4using CommandLine.Utility; 5using CommandLine.Utility;
6using OpenSim.Framework;
7using OpenSim.Framework.Console;
8using OpenSim.Servers;
5 9
6namespace libsecondlife.TestClient 10namespace libsecondlife.TestClient
7{ 11{
8 public class Program 12 public class Program : conscmd_callback
9 { 13 {
10 private static void Usage() 14 private static void Usage()
11 { 15 {
12 Console.WriteLine("Usage: " + Environment.NewLine +
13 "TestClient.exe --first firstname --last lastname --pass password --contact \"youremail\" [--startpos \"sim/x/y/z\"] [--master \"master name\"] [--masterkey \"master uuid\"]" +
14 Environment.NewLine + "TestClient.exe --file filename --contact \"youremail\" [--master \"master name\"] [--masterkey \"master uuid\"]");
15 } 16 }
16 17
18 public void RunCmd(string cmd, string[] cmdparams) {}
19 public void Show(string ShowWhat) {}
20
17 static void Main(string[] args) 21 static void Main(string[] args)
18 { 22 {
23 ConsoleBase m_console = new ConsoleBase("exportbot-console.log", "ExportBot", new Program() , false);
24 MainConsole.Instance = m_console;
25
19 Arguments arguments = new Arguments(args); 26 Arguments arguments = new Arguments(args);
20 27
21 ClientManager manager; 28 ClientManager manager;
@@ -115,13 +122,20 @@ namespace libsecondlife.TestClient
115 } 122 }
116 123
117 // Login the accounts and run the input loop 124 // Login the accounts and run the input loop
118 if ( arguments["start"] != null ) { 125 manager = new ClientManager(accounts, contact, "Theta/16/229/25");
126/* if ( arguments["start"] != null ) {
119 manager = new ClientManager(accounts, contact, arguments["start"]); 127 manager = new ClientManager(accounts, contact, arguments["start"]);
120 } else { 128 } else {
121 manager = new ClientManager(accounts, contact); 129 manager = new ClientManager(accounts, contact);
122 } 130 }*/
131
132 Console.WriteLine("Starting the HTTP listener");
133 BaseHttpServer httpServer = new BaseHttpServer(12035);
134 httpServer.AddRestHandler("GET", "/exportaccount/", manager.ExportAvatarRestMethod);
135 httpServer.Start();
136
123 manager.Run(); 137 manager.Run();
124 138
125 } 139 }
126 } 140 }
127} 141}
diff --git a/ExportBot/TestClient.cs b/ExportBot/TestClient.cs
index cf8783e..f939aa0 100644
--- a/ExportBot/TestClient.cs
+++ b/ExportBot/TestClient.cs
@@ -18,12 +18,12 @@ namespace libsecondlife.TestClient
18 public LLUUID GroupID = LLUUID.Zero; 18 public LLUUID GroupID = LLUUID.Zero;
19 public Dictionary<LLUUID, GroupMember> GroupMembers; 19 public Dictionary<LLUUID, GroupMember> GroupMembers;
20 public Dictionary<uint, Avatar> AvatarList = new Dictionary<uint,Avatar>(); 20 public Dictionary<uint, Avatar> AvatarList = new Dictionary<uint,Avatar>();
21 public Dictionary<LLUUID, AvatarAppearancePacket> Appearances = new Dictionary<LLUUID, AvatarAppearancePacket>(); 21 public Dictionary<LLUUID, AvatarAppearancePacket> Appearances = new Dictionary<LLUUID, AvatarAppearancePacket>();
22 public Dictionary<string, Command> Commands = new Dictionary<string,Command>(); 22 public Dictionary<string, Command> Commands = new Dictionary<string,Command>();
23 public bool Running = true; 23 public bool Running = true;
24 public string MasterName = String.Empty; 24 public string MasterName = String.Empty;
25 public LLUUID MasterKey = LLUUID.Zero; 25 public LLUUID MasterKey = LLUUID.Zero;
26 public ClientManager ClientManager; 26 public ClientManager ClientManager;
27 public int regionX; 27 public int regionX;
28 public int regionY; 28 public int regionY;
29 29
@@ -41,7 +41,7 @@ namespace libsecondlife.TestClient
41 /// </summary> 41 /// </summary>
42 public TestClient(ClientManager manager) 42 public TestClient(ClientManager manager)
43 { 43 {
44 ClientManager = manager; 44 ClientManager = manager;
45 45
46 updateTimer = new System.Timers.Timer(1000); 46 updateTimer = new System.Timers.Timer(1000);
47 updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed); 47 updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);
@@ -57,7 +57,7 @@ namespace libsecondlife.TestClient
57 Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim); 57 Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim);
58 Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated); 58 Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
59 Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled); 59 Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled);
60 Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar); 60 Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar);
61 Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage); 61 Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage);
62 Groups.OnGroupMembers += new GroupManager.GroupMembersCallback(GroupMembersHandler); 62 Groups.OnGroupMembers += new GroupManager.GroupMembersCallback(GroupMembersHandler);
63 this.OnLogMessage += new LogCallback(TestClient_OnLogMessage); 63 this.OnLogMessage += new LogCallback(TestClient_OnLogMessage);