示例#1
1
        void Nurse_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            if (im.Message.Equals("Reset"))
            {
                Reset();
                return;
            }

            if (im.Message.Equals("Stop"))
            {
                Stop();
                return;
            }

            if (im.Message.Equals("Start"))
            {
                Start();
                return;
            }

            if (state != States.idle)
            {
                client.Self.InstantMessage(im.FromAgentID, "busy");
                return;
            }

            List<Vector3> wayPointList = null;
            if (im.Message.Equals("thirsty"))
            {
                state = States.water;
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "room5");
                client.Self.Chat("Ok " + im.FromAgentName + ", I'll get you a drink.", 0, ChatType.Normal);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("I'm getting water for the patient in " + roomName, 0, ChatType.Normal);
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, roomName);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("Here is your water.", 0, ChatType.Normal);
            }
            if (im.Message.Equals("pain"))
            {
                state = States.drugs;
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "pharmacy");
                client.Self.Chat("Ok " + im.FromAgentName + ", I'll see what they have in the pharmacy", 0, ChatType.Normal);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("I'm getting drugs for the patient in " + roomName, 0, ChatType.Normal);
                wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, roomName);
                TraverseWayPoints(wayPointList);
                client.Self.Chat("Here is your morphine.", 0, ChatType.Normal);
            }

            state = States.travelling;
            wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, "lobby");
            TraverseWayPoints(wayPointList);

            state = States.idle;
        }
示例#2
1
 static void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
 {
     if (im.Dialog == InstantMessageDialog.RequestTeleport)
     {
         if (im.FromAgentID == _MasterID)
         {
             _Client.Self.TeleportLureRespond(im.FromAgentID, true);
         }
     }
 }
        public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupNotice)
        {
            InitializeComponent();

            this.instance = instance;
            this.msg = msg;

            if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
            {
                type = (AssetType)msg.BinaryBucket[1];
                destinationFolderID = client.Inventory.FindFolderForType(type);
                int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
                if (icoIndx >= 0)
                {
                    icnItem.Image = frmMain.ResourceImages.Images[icoIndx];
                    icnItem.Visible = true;
                }
                txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
                btnSave.Enabled = true;
                btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
            }

            string group = string.Empty;
            string text = msg.Message.Replace("\n", System.Environment.NewLine);
            int pos = msg.Message.IndexOf('|');
            string title = msg.Message.Substring(0, pos);
            text = text.Remove(0, pos + 1);

            if (instance.Groups.ContainsKey(msg.FromAgentID))
            {
                group = instance.Groups[msg.FromAgentID].Name;
                if (instance.Groups[msg.FromAgentID].InsigniaID != UUID.Zero)
                {
                    imgGroup.Init(instance, instance.Groups[msg.FromAgentID].InsigniaID, string.Empty);
                }
            }

            lblTitle.Text = title;
            lblSentBy.Text = string.Format("Sent by {0}, {1}", msg.FromAgentName, group);
            txtNotice.Text = text;

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = string.Format("{0}{1}{2}{3}{4}",
                lblTitle.Text, System.Environment.NewLine,
                lblSentBy.Text, System.Environment.NewLine,
                txtNotice.Text
                );
            if (btnSave.Visible == true)
            {
                args.Buttons.Add(btnSave);
                args.Text += string.Format("{0}Attachment: {1}", System.Environment.NewLine, txtItemName.Text);
            }
            args.Buttons.Add(btnOK);
            FireNotificationCallback(args);
        }
示例#4
0
        public IITabWindow(METAboltInstance instance, InstantMessage e)
        {
            InitializeComponent();

            this.instance = instance;
            netcom = this.instance.Netcom;
            client = this.instance.Client;
            ProcessEventArgs(e);
        }
        public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupNotice)
        {
            InitializeComponent();
            Disposed += new System.EventHandler(ntfGroupNotice_Disposed);

            this.instance = instance;
            this.msg = msg;
            client.Groups.GroupProfile += new System.EventHandler<GroupProfileEventArgs>(Groups_GroupProfile);

            if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
            {
                type = (AssetType)msg.BinaryBucket[1];
                destinationFolderID = client.Inventory.FindFolderForType(type);
                int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
                if (icoIndx >= 0)
                {
                    icnItem.Image = frmMain.ResourceImages.Images[icoIndx];
                    icnItem.Visible = true;
                }
                txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
                btnSave.Enabled = true;
                btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
            }

            if (msg.BinaryBucket.Length >= 18)
            {
                groupID = new UUID(msg.BinaryBucket, 2);
            }
            else
            {
                groupID = msg.FromAgentID;
            }

            int pos = msg.Message.IndexOf('|');
            string title = msg.Message.Substring(0, pos);
            lblTitle.Text = title;
            string text = msg.Message.Replace("\n", System.Environment.NewLine);
            text = text.Remove(0, pos + 1);

            lblSentBy.Text = string.Format("Sent by {0}", msg.FromAgentName);
            txtNotice.Text = text;

            if (instance.Groups.ContainsKey(groupID))
            {
                group = instance.Groups[groupID];
                ShowNotice();
            }
            else
            {
                client.Groups.RequestGroupProfile(groupID);
            }
        }
        public ntfInventoryOffer(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.InventoryOffer)
        {
            InitializeComponent();
            Disposed += new EventHandler(ntfInventoryOffer_Disposed);

            this.instance = instance;
            this.msg = msg;

            instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);

            if (msg.BinaryBucket.Length > 0)
            {
                type = (AssetType)msg.BinaryBucket[0];
                destinationFolderID = client.Inventory.FindFolderForType(type);

                if (msg.BinaryBucket.Length == 17)
                {
                    objectID = new UUID(msg.BinaryBucket, 1);
                }

                if (msg.Dialog == InstantMessageDialog.InventoryOffered)
                {
                    txtInfo.Text = string.Format("{0} has offered you {1} \"{2}\".", msg.FromAgentName, type.ToString(), msg.Message);
                }
                else if (msg.Dialog == InstantMessageDialog.TaskInventoryOffered)
                {
                    txtInfo.Text = objectOfferText();
                }

                // Fire off event
                NotificationEventArgs args = new NotificationEventArgs(instance);
                args.Text = txtInfo.Text;
                args.Buttons.Add(btnAccept);
                args.Buttons.Add(btnDiscard);
                args.Buttons.Add(btnIgnore);
                FireNotificationCallback(args);
            }
            else
            {
                Logger.Log("Wrong format of the item offered", Helpers.LogLevel.Warning, client);
            }

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
        public ntfGroupInvitation(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupInvitation)
        {
            InitializeComponent();

            this.instance = instance;
            this.msg = msg;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message.Replace("\n", "\r\n");
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnYes);
            FireNotificationCallback(args);
        }
示例#8
0
        public ntfTeleport(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.Teleport)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg = msg;

            txtHead.BackColor = instance.MainForm.NotificationBackground;
            txtHead.Text = String.Format("{0} has offered to teleport you to their location.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message;
            btnTeleport.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnTeleport);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);
        }
        public ntfFriendshipOffer(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.FriendshipOffer)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg = msg;

            txtHead.BackColor = instance.MainForm.NotificationBackground;
            txtHead.Text = String.Format("{0} has offered you friendship.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message;
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnIgnore);
            FireNotificationCallback(args);
        }
示例#10
0
 private BotPermissions GetSecurityLevel(InstantMessage im)
 {
     BotPermissions perms = GetSecurityLevel(im.FromAgentID, im.FromAgentName);
     return perms;
 }
示例#11
0
        private void ProcessEventArgs(InstantMessage e)
        {
            targetName = e.FromAgentName;
            targetUUID = e.FromAgentID;
            isession = e.IMSessionID;
            string gmsg = e.Message.ToString();

            // This was causing a crash when an inventory item is received
            // there is no ":" why was it looking for it???
            // section now removed and replaced with something that makes sense
            //
            //string[] split = gmsg.Split(new Char[] { ':' });
            //lblSubheading.Text = split[0].ToString() + "\n \n" + split[1].ToString();
            lblSubheading.Text = "You have received an inventory item named '" + gmsg + "' from " + targetName;
        }
示例#12
0
 public IM(InstantMessage i,bool _from_other,int _id)
 {
     message = i.Message;
     timestamp = Helper.unixTimeStamp();
     from_other = _from_other;
     id = _id;
 }
示例#13
0
        /// <summary>
        /// Group Chat Request
        /// </summary>
        /// <param name="capsKey">Caps Key</param>
        /// <param name="llsd">LLSD Map containing invitation</param>
        /// <param name="simulator">Originating Simulator</param>
        private void ChatterBoxInvitationHandler(string capsKey, LLSD llsd, Simulator simulator)
        {       
                if (OnInstantMessage != null)
                {
                    LLSDMap map = (LLSDMap)llsd;
                    LLSDMap im = (LLSDMap)map["instantmessage"];
                    LLSDMap agent = (LLSDMap)im["agent_params"];
                    LLSDMap msg = (LLSDMap)im["message_params"];
                    LLSDMap msgdata = (LLSDMap)msg["data"];

                    InstantMessage message = new InstantMessage();
                    
                    message.FromAgentID = map["from_id"].AsUUID();
                    message.FromAgentName = map["from_name"].AsString();
                    message.ToAgentID = msg["to_id"].AsString();
                    message.ParentEstateID = (uint)msg["parent_estate_id"].AsInteger();
                    message.RegionID = msg["region_id"].AsUUID();
                    message.Position.FromLLSD(msg["position"]);
                    message.Dialog = (InstantMessageDialog)msgdata["type"].AsInteger();
                    message.GroupIM = true;
                    message.IMSessionID = map["session_id"].AsUUID();
                    message.Timestamp = new DateTime(msgdata["timestamp"].AsInteger());
                    message.Message = msg["message"].AsString();
                    message.Offline = (InstantMessageOnline)msg["offline"].AsInteger();
                    message.BinaryBucket = msg["binary_bucket"].AsBinary();

                    try { OnInstantMessage(message, simulator); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }             
        }
示例#14
0
        /// <summary>
        /// Handle a group chat Invitation
        /// </summary>
        /// <param name="capsKey">Caps Key</param>
        /// <param name="message">IMessage object containing decoded data from OSD</param>
        /// <param name="simulator">Originating Simulator</param>
        private void ChatterBoxInvitationEventHandler(string capsKey, IMessage message, Simulator simulator)
        {
            if (m_InstantMessage != null)
            {
                ChatterBoxInvitationMessage msg = (ChatterBoxInvitationMessage)message;

                //TODO: do something about invitations to voice group chat/friends conference
                //Skip for now
                if (msg.Voice) return;

                InstantMessage im = new InstantMessage();

                im.FromAgentID = msg.FromAgentID;
                im.FromAgentName = msg.FromAgentName;
                im.ToAgentID = msg.ToAgentID;
                im.ParentEstateID = (uint)msg.ParentEstateID;
                im.RegionID = msg.RegionID;
                im.Position = msg.Position;
                im.Dialog = msg.Dialog;
                im.GroupIM = msg.GroupIM;
                im.IMSessionID = msg.IMSessionID;
                im.Timestamp = msg.Timestamp;
                im.Message = msg.Message;
                im.Offline = msg.Offline;
                im.BinaryBucket = msg.BinaryBucket;

                OnInstantMessage(new InstantMessageEventArgs(im, simulator));
            }
        }
示例#15
0
 public void newIM(InstantMessage i)
 {
     if (IMLog.ContainsKey(i.FromAgentID.ToString())) IMLog[i.FromAgentID.ToString()].newIM(i);
     else IMLog.Add(i.FromAgentID.ToString(), new IMSession(i));
     httpCallback(CallBackEvent.im, new string[] { i.FromAgentID.ToString() }, new JavaScriptSerializer().Serialize(IMLog[i.FromAgentID.ToString()].messages.Last()));
     sumIMs();
 }
示例#16
0
        /// <summary>
        /// Handle a group chat Invitation
        /// </summary>
        /// <param name="capsKey">Caps Key</param>
        /// <param name="message">IMessage object containing decoded data from OSD</param>
        /// <param name="simulator">Originating Simulator</param>
        private void ChatterBoxInvitationEventHandler(string capsKey, IMessage message, Simulator simulator)
        {
            if (m_InstantMessage != null)
            {
                ChatterBoxInvitationMessage msg = (ChatterBoxInvitationMessage)message;

                InstantMessage im = new InstantMessage();

                im.FromAgentID = msg.FromAgentID;
                im.FromAgentName = msg.FromAgentName;
                im.ToAgentID = msg.ToAgentID;
                im.ParentEstateID = (uint)msg.ParentEstateID;
                im.RegionID = msg.RegionID;
                im.Position = msg.Position;
                im.Dialog = msg.Dialog;
                im.GroupIM = msg.GroupIM;
                im.IMSessionID = msg.IMSessionID;
                im.Timestamp = msg.Timestamp;
                im.Message = msg.Message;
                im.Offline = msg.Offline;
                im.BinaryBucket = msg.BinaryBucket;

                OnInstantMessage(new InstantMessageEventArgs(im, simulator));
            }
        }
示例#17
0
 public InventoryObjectOfferedEventArgs(InstantMessage offerDetails, AssetType type, UUID objectID, bool fromTask, UUID folderID)
 {
     this.Accept = false;
     this.FolderID = folderID;
     this.m_Offer = offerDetails;
     this.m_AssetType = type;
     this.m_ObjectID = objectID;
     this.m_FromTask = fromTask;
 }
示例#18
0
 public void newIM(InstantMessage i)
 {
     bool other = false;
     if (i.FromAgentName != null && i.FromAgentName != "")
     {
         user_name = i.FromAgentName;
         other = true;
     }
     messages.Add(new IM(i,other,messages.Count));
 }
示例#19
0
 public IMSession(InstantMessage i)
 {
     user_id = i.FromAgentID.ToString();
     bool other = false;
     if (i.FromAgentName != null && i.FromAgentName != "")
     {
         user_name = i.FromAgentName;
         other = true;
     }
     messages = new List<IM>();
     messages.Add(new IM(i,other,messages.Count));
 }
示例#20
0
 public TPOffer(InstantMessage im)
 {
     user_id = im.FromAgentID.ToString();
     user_name = im.FromAgentName;
     session_id = im.IMSessionID.ToString();
     message = im.Message;
 }
示例#21
0
        //UI thread
        private bool ReceivedInventoryOffer(InstantMessage offer, AssetType type, UUID objectID, bool fromTask)
        {
            if (instance.IsAvatarMuted(offer.FromAgentID))
                return false;

            if (!instance.Config.CurrentConfig.DeclineInv)
            {
                (new frmInvOffered(instance, offer, objectID, type)).Show();

                if (!client.Inventory.Store.Contains(objectID)) return true;

                InventoryBase invObj = client.Inventory.Store[objectID];

                UpdateFolder(invObj.ParentUUID);
                return true;
            }
            else
            {
                if (type != AssetType.Notecard)
                {
                    client.Inventory.RemoveItem(objectID);
                    //client.Self.Chat("Inventory item decline", 0, ChatType.OwnerSay);
                    return false;
                }
                else
                {
                    if (!client.Inventory.Store.Contains(objectID)) return true;

                    InventoryBase invObj = client.Inventory.Store[objectID];

                    UpdateFolder(invObj.ParentUUID);

                    return true;
                }
            }
        }
示例#22
0
        //Separate thread
        private bool Inventory_OnInventoryObjectReceived(InstantMessage offer, AssetType type, UUID objectID, bool fromTask)
        {
            BeginInvoke(
                new InventoryManager.ObjectOfferedCallback(ReceivedInventoryOffer),
                new object[] { offer, type, objectID, fromTask });

            return true;
        }
示例#23
0
        /// <summary>
        /// Handles relevant messages from the server encapsulated in instant messages.
        /// </summary>
        /// <param name="im">InstantMessage object containing encapsalated instant message</param>
        /// <param name="simulator">Originating Simulator</param>
        private void MainAvatar_InstantMessage(InstantMessage im, Simulator simulator)
        {
            if (im.Dialog == InstantMessageDialog.FriendshipOffered)
            {
                if (OnFriendshipOffered != null)
                {
                    lock (FriendRequests)
                    {
                        if (FriendRequests.ContainsKey(im.FromAgentID))
                            FriendRequests[im.FromAgentID] = im.IMSessionID;
                        else
                            FriendRequests.Add(im.FromAgentID, im.IMSessionID);
                    }
                    try { OnFriendshipOffered(im.FromAgentID, im.FromAgentName, im.IMSessionID); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipAccepted)
            {
                FriendInfo friend = new FriendInfo(im.FromAgentID, FriendRights.CanSeeOnline,
                    FriendRights.CanSeeOnline);
                friend.Name = im.FromAgentName;
                lock (FriendList) FriendList[friend.UUID] = friend;

                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, true); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipDeclined)
            {
                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, false); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
示例#24
0
        private UUID Inventory_OnInventoryObjectReceived(InstantMessage offer, AssetType type,
            UUID objectID, bool fromTask)
        {
            if (MasterKey != UUID.Zero)
            {
                if (offer.FromAgentID != MasterKey)
                    return UUID.Zero;
            }
            else if (GroupMembers != null && !GroupMembers.ContainsKey(offer.FromAgentID))
            {
                return UUID.Zero;
            }
            else if (MasterName != String.Empty)
            {
                if (offer.FromAgentName != MasterName)
                    return UUID.Zero;
            }
            else if (fromTask && !AllowObjectMaster)
            {
                return UUID.Zero;
            }

            return Inventory.FindFolderForType(type);
        }
        /// <summary>
        /// Handle a group chat Invitation
        /// </summary>
        /// <param name="capsKey">Caps Key</param>
        /// <param name="message">IMessage object containing decoded data from OSD</param>
        /// <param name="simulator">Originating Simulator</param>
        private void ChatterBoxInvitationEventHandler(string capsKey, IMessage message, Simulator simulator)
        {
            if (m_InstantMessage != null)
            {
                ChatterBoxInvitationMessage msg = (ChatterBoxInvitationMessage)message;

                //TODO: do something about invitations to voice group chat/friends conference
                //Skip for now
                if (msg.Voice) return;

                InstantMessage im = new InstantMessage();

                im.FromAgentID = msg.FromAgentID;
                im.FromAgentName = msg.FromAgentName;
                im.ToAgentID = msg.ToAgentID;
                im.ParentEstateID = (uint)msg.ParentEstateID;
                im.RegionID = msg.RegionID;
                im.Position = msg.Position;
                im.Dialog = msg.Dialog;
                im.GroupIM = msg.GroupIM;
                im.IMSessionID = msg.IMSessionID;
                im.Timestamp = msg.Timestamp;
                im.Message = msg.Message;
                im.Offline = msg.Offline;
                im.BinaryBucket = msg.BinaryBucket;
                try
                {
                    ChatterBoxAcceptInvite(msg.IMSessionID);
                }
                catch (Exception ex)
                {
                    Logger.Log("Failed joining IM:", Helpers.LogLevel.Warning, Client, ex);
                }
                OnInstantMessage(new InstantMessageEventArgs(im, simulator));
            }
        }
示例#26
0
        private void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            // TODO: MainAvatar.InstantMessageDialog.GroupNotice can also be an inventory offer, should we
            // handle it here?

            if (OnObjectOffered != null &&
                (im.Dialog == InstantMessageDialog.InventoryOffered
                || im.Dialog == InstantMessageDialog.TaskInventoryOffered))
            {
                AssetType type = AssetType.Unknown;
                UUID objectID = UUID.Zero;
                bool fromTask = false;

                if (im.Dialog == InstantMessageDialog.InventoryOffered)
                {
                    if (im.BinaryBucket.Length == 17)
                    {
                        type = (AssetType)im.BinaryBucket[0];
                        objectID = new UUID(im.BinaryBucket, 1);
                        fromTask = false;
                    }
                    else
                    {
                        Logger.Log("Malformed inventory offer from agent", Helpers.LogLevel.Warning, _Client);
                        return;
                    }
                }
                else if (im.Dialog == InstantMessageDialog.TaskInventoryOffered)
                {
                    if (im.BinaryBucket.Length == 1)
                    {
                        type = (AssetType)im.BinaryBucket[0];
                        fromTask = true;
                    }
                    else
                    {
                        Logger.Log("Malformed inventory offer from object", Helpers.LogLevel.Warning, _Client);
                        return;
                    }
                }

                // Fire the callback
                try
                {
                    ImprovedInstantMessagePacket imp = new ImprovedInstantMessagePacket();
                    imp.AgentData.AgentID = _Agents.AgentID;
                    imp.AgentData.SessionID = _Agents.SessionID;
                    imp.MessageBlock.FromGroup = false;
                    imp.MessageBlock.ToAgentID = im.FromAgentID;
                    imp.MessageBlock.Offline = 0;
                    imp.MessageBlock.ID = im.IMSessionID;
                    imp.MessageBlock.Timestamp = 0;
                    imp.MessageBlock.FromAgentName = Utils.StringToBytes(_Agents.Name);
                    imp.MessageBlock.Message = new byte[0];
                    imp.MessageBlock.ParentEstateID = 0;
                    imp.MessageBlock.RegionID = UUID.Zero;
                    imp.MessageBlock.Position = _Agents.SimPosition;

                    UUID destinationFolderID = OnObjectOffered(im, type, objectID, fromTask);
                    if (destinationFolderID != UUID.Zero)
                    {
                        // Accept the inventory offer
                        switch (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 = destinationFolderID.GetBytes();
                    }
                    else
                    {
                        // Decline the inventory offer
                        switch (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 = new byte[0];
                    }

                    _Network.SendPacket(imp, simulator);
                }
                catch (Exception e)
                {
                    Logger.Log(e.Message, Helpers.LogLevel.Error, _Client, e);
                }
            }
        }
示例#27
0
        private bool Inventory_OnInventoryObjectReceived(InstantMessage offer, AssetType type,
            UUID objectID, bool fromTask)
        {
            if (MasterKey != UUID.Zero)
            {
                if (offer.FromAgentID != MasterKey)
                    return false;
            }
            else if (GroupMembers != null && !GroupMembers.ContainsKey(offer.FromAgentID))
            {
                return false;
            }

            return true;
        }
示例#28
0
        private void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            bool groupIM = im.GroupIM && GroupMembers != null && GroupMembers.ContainsKey(im.FromAgentID) ? true : false;

            if (im.FromAgentID == MasterKey || (GroupCommands && groupIM))
            {
                // Received an IM from someone that is authenticated
                Console.WriteLine("<{0} ({1})> {2}: {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message, im.RegionID, im.Position);

                if (im.Dialog == InstantMessageDialog.RequestTeleport)
                {
                    Console.WriteLine("Accepting teleport lure.");
                    Self.TeleportLureRespond(im.FromAgentID, true);
                }
                else if (
                    im.Dialog == InstantMessageDialog.MessageFromAgent ||
                    im.Dialog == InstantMessageDialog.MessageFromObject)
                {
                    ClientManager.Instance.DoCommandAll(im.Message, im.FromAgentID);
                }
            }
            else
            {
                // Received an IM from someone that is not the bot's master, ignore
                Console.WriteLine("<{0} ({1})> {2} (not master): {3} (@{4}:{5})", im.GroupIM ? "GroupIM" : "IM", im.Dialog, im.FromAgentName, im.Message,
                    im.RegionID, im.Position);
                return;
            }
        }
示例#29
0
 /// <summary>
 /// Construct a new instance of the InstantMessageEventArgs object
 /// </summary>
 /// <param name="im">the InstantMessage object</param>
 /// <param name="simulator">the simulator where the InstantMessage origniated</param>
 public InstantMessageEventArgs(InstantMessage im, Simulator simulator)
 {
     this.m_IM = im;
     this.m_Simulator = simulator;
 }
示例#30
0
 private void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
 {
     if (OnIM != null)
         OnIM(im.FromAgentID, im.FromAgentName, im.Message);
 }