public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) return Description; groupName = String.Empty; resolvedGroupID = UUID.Zero; resolvedGroupName = String.Empty; if (args[0].ToLower() == "uuid") { if (args.Length < 2) return Description; if (!UUID.TryParse((resolvedGroupName = groupName = args[1]), out resolvedGroupID)) return resolvedGroupName + " doesn't seem a valid UUID"; } else { for (int i = 0; i < args.Length; i++) groupName += args[i] + " "; groupName = groupName.Trim(); DirectoryManager.DirGroupsReplyCallback callback = new DirectoryManager.DirGroupsReplyCallback(Directory_OnDirGroupsReply); Client.Directory.OnDirGroupsReply += callback; queryID = Client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, groupName, 0); GetGroupsSearchEvent.WaitOne(60000, false); Client.Directory.OnDirGroupsReply -= callback; GetGroupsSearchEvent.Reset(); } if (resolvedGroupID == UUID.Zero) { if (string.IsNullOrEmpty(resolvedGroupName)) return "Unable to obtain UUID for group " + groupName; else return resolvedGroupName; } GroupManager.GroupJoinedCallback gcallback = new GroupManager.GroupJoinedCallback(Groups_OnGroupJoined); Client.Groups.OnGroupJoined += gcallback; Client.Groups.RequestJoinGroup(resolvedGroupID); /* A.Biondi * TODO: implement the pay to join procedure. */ GetGroupsSearchEvent.WaitOne(60000, false); Client.Groups.OnGroupJoined -= gcallback; GetGroupsSearchEvent.Reset(); Client.ReloadGroupsCache(); if (joinedGroup) return "Joined the group " + resolvedGroupName; return "Unable to join the group " + resolvedGroupName; }
public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) { return(Description); } int place = 0;//for knowing what arg to grab if (!UUID.TryParse(args[place].Trim(), out avatarid)) { //not a uuid, check if its a name AvatarManager.AvatarNameSearchCallback ncallback = new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); testC.Avatars.OnAvatarNameSearch += ncallback; targetAvatarName = args[place] + " " + args[++place]; if (!Name2Key.ContainsKey(targetAvatarName.ToLower())) { // Send the Query Client.Avatars.RequestAvatarNameSearch(targetAvatarName, UUID.Random()); NameSearchEvent.WaitOne(10000, false); testC.Avatars.OnAvatarNameSearch -= ncallback; if (Name2Key.ContainsKey(targetAvatarName.ToLower())) { avatarid = Name2Key[targetAvatarName.ToLower()]; } else { return("Name lookup for " + targetAvatarName + " failed"); } } else if (Name2Key.ContainsKey(targetAvatarName.ToLower())) { avatarid = Name2Key[targetAvatarName.ToLower()]; } else { return("Name lookup for " + targetAvatarName + " failed"); } } if (!UUID.TryParse(args[++place].Trim(), out groupid)) { //not a uuid, try group name targetGroupName = args[place++]; for (; place < args.Length; place++) { targetGroupName += " " + args[place]; } Console.WriteLine("looking for the group named " + targetGroupName); DirectoryManager.DirGroupsReplyCallback callback = new DirectoryManager.DirGroupsReplyCallback(Directory_OnDirGroupsReply); Client.Directory.OnDirGroupsReply += callback; GqueryID = Client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, targetGroupName, 0); GetGroupsSearchEvent.WaitOne(10000, false); Client.Directory.OnDirGroupsReply -= callback; GetGroupsSearchEvent.Reset(); if (groupid == UUID.Zero) { return("Unable to obtain UUID for group "); } Console.WriteLine("got a group id :D"); } List <UUID> roles = new List <UUID>(); UUID role = UUID.Zero; if (args.Length <= ++place) { Console.WriteLine("using default role"); roles.Add(role); } //Console.WriteLine("didnt crash yet"); while (args.Length > (place++) + 1) { if (UUID.TryParse(args[place], out role)) { roles.Add(role); } } //we now got everything in uuid form woot //TODO check if this failed, like if avatar isnt in the group or has permissions //TODO get better roles o.0 Client.Groups.Invite(groupid, roles, avatarid); return("Invited to the group " + targetGroupName); }
public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) { return(Description); } groupName = String.Empty; resolvedGroupID = UUID.Zero; resolvedGroupName = String.Empty; if (args[0].ToLower() == "uuid") { if (args.Length < 2) { return(Description); } if (!UUID.TryParse((resolvedGroupName = groupName = args[1]), out resolvedGroupID)) { return(resolvedGroupName + " doesn't seem a valid UUID"); } } else { for (int i = 0; i < args.Length; i++) { groupName += args[i] + " "; } groupName = groupName.Trim(); DirectoryManager.DirGroupsReplyCallback callback = new DirectoryManager.DirGroupsReplyCallback(Directory_OnDirGroupsReply); Client.Directory.OnDirGroupsReply += callback; queryID = Client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, groupName, 0); GetGroupsSearchEvent.WaitOne(60000, false); Client.Directory.OnDirGroupsReply -= callback; GetGroupsSearchEvent.Reset(); } if (resolvedGroupID == UUID.Zero) { if (string.IsNullOrEmpty(resolvedGroupName)) { return("Unable to obtain UUID for group " + groupName); } else { return(resolvedGroupName); } } GroupManager.GroupJoinedCallback gcallback = new GroupManager.GroupJoinedCallback(Groups_OnGroupJoined); Client.Groups.OnGroupJoined += gcallback; Client.Groups.RequestJoinGroup(resolvedGroupID); /* A.Biondi * TODO: implement the pay to join procedure. */ GetGroupsSearchEvent.WaitOne(60000, false); Client.Groups.OnGroupJoined -= gcallback; GetGroupsSearchEvent.Reset(); if (joinedGroup) { return("Joined the group " + resolvedGroupName); } return("Unable to join the group " + resolvedGroupName); }
public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) return Description; int place = 0;//for knowing what arg to grab if (!UUID.TryParse(args[place].Trim(), out avatarid)) { //not a uuid, check if its a name AvatarManager.AvatarNameSearchCallback ncallback = new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); testC.Avatars.OnAvatarNameSearch += ncallback; targetAvatarName = args[place] + " " + args[++place]; if (!Name2Key.ContainsKey(targetAvatarName.ToLower())) { // Send the Query Client.Avatars.RequestAvatarNameSearch(targetAvatarName, UUID.Random()); NameSearchEvent.WaitOne(10000, false); testC.Avatars.OnAvatarNameSearch -= ncallback; if (Name2Key.ContainsKey(targetAvatarName.ToLower())) { avatarid = Name2Key[targetAvatarName.ToLower()]; } else { return "Name lookup for " + targetAvatarName + " failed"; } }else if (Name2Key.ContainsKey(targetAvatarName.ToLower())) { avatarid = Name2Key[targetAvatarName.ToLower()]; } else { return "Name lookup for " + targetAvatarName + " failed"; } } if (!UUID.TryParse(args[++place].Trim(), out groupid)) { //not a uuid, try group name targetGroupName = args[place++]; for (; place < args.Length; place++) targetGroupName += " " + args[place]; Console.WriteLine("looking for the group named " + targetGroupName); DirectoryManager.DirGroupsReplyCallback callback = new DirectoryManager.DirGroupsReplyCallback(Directory_OnDirGroupsReply); Client.Directory.OnDirGroupsReply += callback; GqueryID = Client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, targetGroupName, 0); GetGroupsSearchEvent.WaitOne(10000, false); Client.Directory.OnDirGroupsReply -= callback; GetGroupsSearchEvent.Reset(); if (groupid == UUID.Zero) { return "Unable to obtain UUID for group "; } Console.WriteLine("got a group id :D"); } List<UUID> roles = new List<UUID>(); UUID role = UUID.Zero; if (args.Length <= ++place) { Console.WriteLine("using default role"); roles.Add(role); } //Console.WriteLine("didnt crash yet"); while (args.Length > (place++)+1) { if (UUID.TryParse(args[place], out role)) roles.Add(role); } //we now got everything in uuid form woot //TODO check if this failed, like if avatar isnt in the group or has permissions //TODO get better roles o.0 Client.Groups.Invite(groupid, roles, avatarid); return "Invited to the group " + targetGroupName; }