void Self_IM(object sender, InstantMessageEventArgs e) { // TODO: MainAvatar.InstantMessageDialog.GroupNotice can also be an inventory offer, should we // handle it here? if (m_InventoryObjectOffered != null && (e.IM.Dialog == InstantMessageDialog.InventoryOffered || e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered)) { AssetType type = AssetType.Unknown; UUID objectID = UUID.Zero; bool fromTask = false; if (e.IM.Dialog == InstantMessageDialog.InventoryOffered) { if (e.IM.BinaryBucket.Length == 17) { type = (AssetType)e.IM.BinaryBucket[0]; objectID = new UUID(e.IM.BinaryBucket, 1); fromTask = false; } else { Logger.Log("Malformed inventory offer from agent", Helpers.LogLevel.Warning, Client); return; } } else if (e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered) { if (e.IM.BinaryBucket.Length == 1) { type = (AssetType)e.IM.BinaryBucket[0]; fromTask = true; } else { Logger.Log("Malformed inventory offer from object", Helpers.LogLevel.Warning, Client); return; } } // Find the folder where this is going to go UUID destinationFolderID = FindFolderForType(type); // Fire the callback try { ImprovedInstantMessagePacket imp = new ImprovedInstantMessagePacket(); imp.AgentData.AgentID = Client.Self.AgentID; imp.AgentData.SessionID = Client.Self.SessionID; imp.MessageBlock.FromGroup = false; imp.MessageBlock.ToAgentID = e.IM.FromAgentID; imp.MessageBlock.Offline = 0; imp.MessageBlock.ID = e.IM.IMSessionID; imp.MessageBlock.Timestamp = 0; imp.MessageBlock.FromAgentName = Utils.StringToBytes(Client.Self.Name); imp.MessageBlock.Message = Utils.EmptyBytes; imp.MessageBlock.ParentEstateID = 0; imp.MessageBlock.RegionID = UUID.Zero; imp.MessageBlock.Position = Client.Self.SimPosition; InventoryObjectOfferedEventArgs args = new InventoryObjectOfferedEventArgs(e.IM, type, objectID, fromTask, destinationFolderID); OnInventoryObjectOffered(args); if (args.Accept) { // Accept the inventory offer switch (e.IM.Dialog) { case InstantMessageDialog.InventoryOffered: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryAccepted; break; case InstantMessageDialog.TaskInventoryOffered: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryAccepted; break; case InstantMessageDialog.GroupNotice: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryAccepted; break; } imp.MessageBlock.BinaryBucket = args.FolderID.GetBytes(); } else { // Decline the inventory offer switch (e.IM.Dialog) { case InstantMessageDialog.InventoryOffered: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryDeclined; break; case InstantMessageDialog.TaskInventoryOffered: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryDeclined; break; case InstantMessageDialog.GroupNotice: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryDeclined; break; } imp.MessageBlock.BinaryBucket = Utils.EmptyBytes; } Client.Network.SendPacket(imp, e.Simulator); } catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); } } }
private void FashionBotModuleMain_OnObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { var offerdetails = e.Offer; if (offerdetails.FromAgentID == client.MasterKey || offerdetails.FromAgentName.ToLower() == client.MasterName.ToLower()) { UUID objectid = e.ObjectID; AssetType type = e.AssetType; ReceiveAndUse(objectid, type); e.Accept = true; } else { e.Accept = false; } }
void Inventory_InventoryObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { offeredObject = e.ObjectID; offeredAgent = e.Offer.FromAgentID; }
///<summary>Raises the InventoryObjectOffered Event</summary> /// <param name="e">A InventoryObjectOfferedEventArgs object containing /// the data sent from the simulator</param> protected virtual void OnInventoryObjectOffered(InventoryObjectOfferedEventArgs e) { EventHandler<InventoryObjectOfferedEventArgs> handler = m_InventoryObjectOffered; if (handler != null) handler(this, e); }
private void Inventory_OnInventoryObjectReceived(object sender, InventoryObjectOfferedEventArgs e) { if (AcceptAllInventoryItems) { e.Accept = true; return; // accept everything} } BotPermissions them = GetSecurityLevel(e.Offer); if (HasPermission(them, BotPermissions.AcceptInventory)) { e.Accept = true; return; } e.Accept = false; }
private void Inventory_OnInventoryObjectReceived(object sender, InventoryObjectOfferedEventArgs e) { if (MasterKey != UUID.Zero) { if (e.Offer.FromAgentID != MasterKey) return; } else if (GroupMembers != null && !GroupMembers.ContainsKey(e.Offer.FromAgentID)) { return; } e.Accept = true; return; }
public void Inventory_InventoryObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { if (!active) { e.Accept = false; return; } Hashtable hashtable = new Hashtable(); hashtable.Add("MessageType", "ObjectOffered"); hashtable.Add("FromAgentID", e.Offer.FromAgentID); hashtable.Add("FromAgentName", e.Offer.FromAgentName); hashtable.Add("RegionID", e.Offer.RegionID); hashtable.Add("Position", e.Offer.Position); hashtable.Add("Timestamp", e.Offer.Timestamp); hashtable.Add("Type", e.AssetType); hashtable.Add("ObjectID", e.ObjectID); hashtable.Add("FromTask", e.FromTask); enqueue(hashtable); e.Accept = true; // Sigh... }
void Inventory_InventoryObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { Gtk.Application.Invoke(delegate { MessageDialog md = new MessageDialog(MainClass.win, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.YesNo, false,e.Offer+"\n Would you like to accept"); md.Response += delegate(object o,ResponseArgs args) { if (args.ResponseId == ResponseType.Yes) { e.Accept = true; } else { e.Accept = false; } md.Destroy(); }; md.ShowAll(); }); }
public void Inventory_OnObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { e.Accept = OnEvent("On-Object-Offered", paramNamesOnObjectOffered, paramTypesOnObjectOffered, e); }