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/CloneProfileCommand.cs | |
parent | Added skeleton for grid management agent (diff) | |
download | opensim-SC-64a98c736848de6099254f23483058668273c1a5.zip opensim-SC-64a98c736848de6099254f23483058668273c1a5.tar.gz opensim-SC-64a98c736848de6099254f23483058668273c1a5.tar.bz2 opensim-SC-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/CloneProfileCommand.cs')
-rw-r--r-- | ExportBot/Commands/CloneProfileCommand.cs | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/ExportBot/Commands/CloneProfileCommand.cs b/ExportBot/Commands/CloneProfileCommand.cs deleted file mode 100644 index 68712ff..0000000 --- a/ExportBot/Commands/CloneProfileCommand.cs +++ /dev/null | |||
@@ -1,130 +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 CloneProfileCommand : Command | ||
10 | { | ||
11 | Avatar.AvatarProperties Properties; | ||
12 | Avatar.Interests Interests; | ||
13 | private Dictionary<LLUUID,ulong> Avatars = new Dictionary<LLUUID,ulong>(); | ||
14 | List<LLUUID> Groups = new List<LLUUID>(); | ||
15 | bool ReceivedProperties = false; | ||
16 | bool ReceivedInterests = false; | ||
17 | bool ReceivedGroups = false; | ||
18 | ManualResetEvent ReceivedProfileEvent = new ManualResetEvent(false); | ||
19 | |||
20 | public CloneProfileCommand(TestClient testClient) | ||
21 | { | ||
22 | testClient.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests); | ||
23 | testClient.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties); | ||
24 | testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups); | ||
25 | testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup); | ||
26 | |||
27 | // testClient.Self.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(AvatarSeen); | ||
28 | |||
29 | Name = "cloneprofile"; | ||
30 | Description = "Clones another avatars profile as closely as possible. WARNING: This command will " + | ||
31 | "destroy your existing profile! Usage: cloneprofile [targetuuid]"; | ||
32 | } | ||
33 | |||
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) | ||
43 | { | ||
44 | if (args.Length != 1) | ||
45 | return Description; | ||
46 | |||
47 | LLUUID targetID; | ||
48 | ReceivedProperties = false; | ||
49 | ReceivedInterests = false; | ||
50 | ReceivedGroups = false; | ||
51 | |||
52 | try | ||
53 | { | ||
54 | targetID = new LLUUID(args[0]); | ||
55 | } | ||
56 | catch (Exception) | ||
57 | { | ||
58 | return Description; | ||
59 | } | ||
60 | |||
61 | // Request all of the packets that make up an avatar profile | ||
62 | Client.Avatars.RequestAvatarProperties(targetID); | ||
63 | |||
64 | // Wait for all the packets to arrive | ||
65 | ReceivedProfileEvent.Reset(); | ||
66 | ReceivedProfileEvent.WaitOne(5000, false); | ||
67 | |||
68 | // Check if everything showed up | ||
69 | if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups) | ||
70 | return "Failed to retrieve a complete profile for that UUID"; | ||
71 | |||
72 | Client.Self.SetAvatarInformation(); | ||
73 | |||
74 | return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated(); | ||
75 | } | ||
76 | |||
77 | void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties) | ||
78 | { | ||
79 | lock (ReceivedProfileEvent) | ||
80 | { | ||
81 | Properties = properties; | ||
82 | ReceivedProperties = true; | ||
83 | |||
84 | if (ReceivedInterests && ReceivedProperties && ReceivedGroups) | ||
85 | ReceivedProfileEvent.Set(); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | void Avatars_OnAvatarInterests(LLUUID avatarID, Avatar.Interests interests) | ||
90 | { | ||
91 | lock (ReceivedProfileEvent) | ||
92 | { | ||
93 | Interests = interests; | ||
94 | ReceivedInterests = true; | ||
95 | |||
96 | if (ReceivedInterests && ReceivedProperties && ReceivedGroups) | ||
97 | ReceivedProfileEvent.Set(); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | void Avatars_OnAvatarGroups(LLUUID avatarID, AvatarGroupsReplyPacket.GroupDataBlock[] groups) | ||
102 | { | ||
103 | lock (ReceivedProfileEvent) | ||
104 | { | ||
105 | foreach (AvatarGroupsReplyPacket.GroupDataBlock block in groups) | ||
106 | { | ||
107 | Groups.Add(block.GroupID); | ||
108 | } | ||
109 | |||
110 | ReceivedGroups = true; | ||
111 | |||
112 | if (ReceivedInterests && ReceivedProperties && ReceivedGroups) | ||
113 | ReceivedProfileEvent.Set(); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | void Self_OnJoinGroup(LLUUID groupID, bool success) | ||
118 | { | ||
119 | Console.WriteLine(Client.ToString() + (success ? " joined " : " failed to join ") + | ||
120 | groupID.ToStringHyphenated()); | ||
121 | |||
122 | if (success) | ||
123 | { | ||
124 | Console.WriteLine(Client.ToString() + " setting " + groupID.ToStringHyphenated() + | ||
125 | " as the active group"); | ||
126 | Client.Self.ActivateGroup(groupID); | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | } | ||