aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot/Commands/CloneProfileCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ExportBot/Commands/CloneProfileCommand.cs')
-rw-r--r--ExportBot/Commands/CloneProfileCommand.cs25
1 files changed, 12 insertions, 13 deletions
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