Example #1
0
        public void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            LLUUID fromAgentID   = im.FromAgentID;
            string fromAgentName = im.FromAgentName;
            //LLUUID toAgentID = im.ToAgentID;
            LLUUID               regionID    = im.RegionID;
            LLVector3            position    = im.Position;
            InstantMessageDialog dialog      = im.Dialog;
            bool                 groupIM     = im.GroupIM;
            LLUUID               imSessionID = im.IMSessionID;
            DateTime             timestamp   = im.Timestamp;
            string               message     = im.Message;
            InstantMessageOnline offline     = im.Offline;

            byte[]    binaryBucket   = im.BinaryBucket;
            uint      parentEstateID = im.ParentEstateID;
            Hashtable item           = new Hashtable();

            item.Add("MessageType", "InstantMessage");
            item.Add("FromAgentID", fromAgentID);
            item.Add("FromAgentName", fromAgentName);
            item.Add("ParentEstateID", parentEstateID.ToString());
            item.Add("RegionID", regionID);
            item.Add("Position", position);
            item.Add("Dialog", dialog);
            item.Add("GroupIM", groupIM);
            item.Add("IMSessionID", imSessionID);
            item.Add("Timestamp", timestamp);
            item.Add("Message", message);
            item.Add("Offline", offline);
            item.Add("BinaryBucket", binaryBucket);
            enqueue(item);
        }
 private void WyslijWiadomosc_Button_Click(object sender, RoutedEventArgs e)//wysyłanie wiadomości
 {
     if (TrescWiadomosci_TextBox.Text == "")
     {
         MessageBox.Show("Treść wiadomości, nie może być pusta.");
     }
     else if (wybranyUzytkownik != null)
     {
         if (wybranyUzytkownik.AdresIP == "")
         {
             MessageBox.Show("Wiadomości można wysyłać tylko do osbób, które są aktualnie online.");
         }
         else
         {
             InstantMessage IM = new InstantMessage("", zalogowanyUzytkownik.login, wybranyUzytkownik.login, TrescWiadomosci_TextBox.Text, "");
             phoneLine.InstantMessaging.SendDirectIPMessage(IM, wybranyUzytkownik.AdresIP);
             wybranyUzytkownik.wiadomosci.Add("Ty napisałeś: " + TrescWiadomosci_TextBox.Text);
             Application.Current.Dispatcher.Invoke(() => {
                 Wiadomosci_ItemsControl.Items.Insert(0, "Ty napisałeś: " + TrescWiadomosci_TextBox.Text);
                 TrescWiadomosci_TextBox.Text = "";
             });
         }
     }
     else
     {
         MessageBox.Show("Najpierw wybierz użytkownika, a następnie wysyłaj wiadomości");
     }
 }
 public IM(InstantMessage i, bool _from_other, int _id)
 {
     message    = i.Message;
     timestamp  = Helper.unixTimeStamp();
     from_other = _from_other;
     id         = _id;
 }
        public override bool Excecute(Automaton am, GridClient client, bool force)
        {
            UUID target;

            result.success = false;
            if (UUID.TryParse(uuid, out target))
            {
                if (client.Network.Connected)
                {
                    if (message != null && message.Length > 0)
                    {
                        InstantMessage i = new InstantMessage();
                        i.FromAgentID = target;
                        i.Message     = message;
                        am.newIM(i);
                        client.Self.InstantMessage(target, message);
                        result.success = true;
                    }
                    else
                    {
                        result.message = "message null or 0 length [" + message + "]";
                    }
                }
                else
                {
                    result.message = "not connected";
                }
            }
            else
            {
                result.message = "uuid faised";
            }
            return(true);
        }
 public TPOffer(InstantMessage im)
 {
     user_id    = im.FromAgentID.ToString();
     user_name  = im.FromAgentName;
     session_id = im.IMSessionID.ToString();
     message    = im.Message;
 }
Example #6
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)
                {
                    DoCommand(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;
            }
        }
        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)
            {
                Text = txtHead.Text
            };

            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnIgnore);
            FireNotificationCallback(args);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
Example #8
0
        public ntfRequestLure(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.RequestLure)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg      = msg;

            txtHead.BackColor    = instance.MainForm.NotificationBackground;
            txtHead.Text         = String.Format("{0} is requesting to be teleported to your location.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text      = msg.Message;
            btnTeleport.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance)
            {
                Text = txtHead.Text + Environment.NewLine + txtMessage.Text
            };

            args.Buttons.Add(btnTeleport);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
Example #9
0
        private void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
        {
            if (MasterKey != LLUUID.Zero)
            {
                if (im.FromAgentID != MasterKey)
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM ({0})> {1} (not master): {2} (@{3}:{4})", im.Dialog, im.FromAgentName, im.Message,
                                      im.RegionID, im.Position);
                    return;
                }
            }
            else if (GroupMembers != null && !GroupMembers.ContainsKey(im.FromAgentID))
            {
                // Received an IM from someone outside the bot's group, ignore
                Console.WriteLine("<IM ({0})> {1} (not in group): {2} (@{3}:{4})", im.Dialog, im.FromAgentName,
                                  im.Message, im.RegionID, im.Position);
                return;
            }

            // Received an IM from someone that is authenticated
            Console.WriteLine("<IM ({0})> {1}: {2} (@{3}:{4})", 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)
            {
                DoCommand(im.Message, im.FromAgentID);
            }
        }
Example #10
0
        private async void OnSendInstantMessageCommandExecute()
        {
            var message = new RelayMessage
            {
                SentDateTimeUtc = DateTimeOffset.UtcNow,
                ToUserId        = UserId,
                FromUserId      = RegistrationSettings.UserId,
                Payload         = InstantMessage.Trim(),
                Tag             = RelayMessageTags.InstantMessage
            };

            InstantMessage = null;
            await _clientChannel.RelayAsync(message);

            ((ObservableCollection <InstantMessageViewModel>)InstantMessages).Add(new InstantMessageViewModel
            {
                Body                = message.Payload,
                DeliveredAt         = message.SentDateTimeUtc.LocalDateTime,
                IsSender            = true,
                SenderName          = RegistrationSettings.Name,
                SenderProfileSource = OwnProfileSource
            });
            ETWEventLogger.Instance.LogEvent("Outgoing Message",
                                             "SenderName is " + RegistrationSettings.Name + " ReceiverName is " + Name
                                             + "\n SendDateTimeUtc " + message.SentDateTimeUtc.ToString(),
                                             DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString());
        }
Example #11
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);
        }
        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);
            }

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
 // Token: 0x06000A26 RID: 2598 RVA: 0x00040750 File Offset: 0x0003E950
 public void AddClanMessage(int cmid, InstantMessage msg)
 {
     this.ClanDialog.AddMessage(msg);
     if (cmid != PlayerDataManager.Cmid && ChatPageGUI.SelectedTab != TabArea.Clan)
     {
         this.HasUnreadClanMessage.Value = true;
         AutoMonoBehaviour <SfxManager> .Instance.Play2dAudioClip(GameAudio.NewMessage, 0UL, 1f, 1f);
     }
 }
Example #14
0
        public frmInvOffered(METAboltInstance instance, InstantMessage e, UUID objectID, AssetType type)
        {
            InitializeComponent();

            SetExceptionReporter();
            Application.ThreadException += new ThreadExceptionHandler().ApplicationThreadException;

            this.instance = instance;
            client        = this.instance.Client;
            msg           = e;
            this.objectID = objectID;
            this.Text    += " [" + client.Self.Name + "]";

            invtype = type;

            if (invtype == AssetType.Folder)
            {
                instance.State.FolderRcvd = true;
            }
            else
            {
                instance.State.FolderRcvd = false;
            }

            diag = e.Dialog;

            //if (e.Dialog == InstantMessageDialog.TaskInventoryOffered)
            //{
            //    diainv = true;
            //}

            string a = "a";

            if (type.ToString().ToLower(CultureInfo.CurrentCulture).StartsWith("a", StringComparison.CurrentCultureIgnoreCase) || type.ToString().ToLower(CultureInfo.CurrentCulture).StartsWith("o", StringComparison.CurrentCultureIgnoreCase) || type.ToString().ToLower(CultureInfo.CurrentCulture).StartsWith("u", StringComparison.CurrentCultureIgnoreCase))
            {
                a = "an";
            }

            lblSubheading.Text = "You have received " + a + " " + type.ToString() + " named '" + e.Message + "' from " + e.FromAgentName;

            if (instance.Config.CurrentConfig.PlayInventoryItemReceived)
            {
                SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.Item_received);
                simpleSound.Play();
                simpleSound.Dispose();
            }

            timer1.Interval = instance.DialogTimeOut;
            timer1.Enabled  = true;
            timer1.Start();

            DateTime dte = DateTime.Now.AddMinutes(15.0d);

            label1.Text = "This item will be auto accepted @ " + dte.ToShortTimeString();

            this.Text += "   " + "[ " + client.Self.Name + " ]";
        }
Example #15
0
        public IITabWindow(METAboltInstance instance, InstantMessage e)
        {
            InitializeComponent();

            this.instance = instance;
            netcom        = this.instance.Netcom;
            client        = this.instance.Client;
            ProcessEventArgs(e);
        }
        public async System.Threading.Tasks.Task Handle(AddInstantMessageCommand command)
        {
            var @instantMessage = new InstantMessage(command.From, command.MessageText, command.To)
            {
                ConferenceId = command.ConferenceId
            };
            await _context.AddAsync(@instantMessage);

            await _context.SaveChangesAsync();
        }
Example #17
0
 public static InstantMessageResponse MapMessageToResponse(InstantMessage instantMessage)
 {
     return(new InstantMessageResponse
     {
         From = instantMessage.From,
         MessageText = instantMessage.MessageText,
         TimeStamp = instantMessage.TimeStamp,
         To = instantMessage.To
     });
 }
Example #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));
        }
Example #19
0
        public frmGroupNotice(METAboltInstance instance, InstantMessageEventArgs e)
        {
            InitializeComponent();
            this.instance = instance;
            client        = this.instance.Client;
            imsg          = e.IM;

            Disposed += new EventHandler(GroupNotice_Disposed);

            this.Text += "   " + "[ " + client.Self.Name + " ]";
        }
        /// <summary>
        /// This will be called when an instant message received through a call.
        /// </summary>
        private void Call_InstantMessageReceived(object sender, InstantMessage e)
        {
            IPhoneCall call = sender as IPhoneCall;

            if (call == null)
            {
                return;
            }

            OnCallInstantMessageReceived(new PhoneCallInstantMessageArgs(call, e));
        }
Example #21
0
 public void WriteFail(IVoltronSession session, InstantMessage message, InstantMessageFailureReason fail)
 {
     session.Write(new InstantMessage
     {
         FromType = FSO.Common.Enum.UserReferenceType.AVATAR,
         From     = message.To,
         Type     = InstantMessageType.FAILURE_ACK,
         Message  = "",
         AckID    = message.AckID,
         Reason   = fail
     });
 }
Example #22
0
 // Token: 0x06000FB6 RID: 4022 RVA: 0x00065748 File Offset: 0x00063948
 public InstantMessage(InstantMessage instantMessage)
 {
     this.Cmid             = instantMessage.Cmid;
     this.PlayerName       = instantMessage.PlayerName;
     this.Text             = instantMessage.Text;
     this.TimeString       = instantMessage.TimeString;
     this.AccessLevel      = instantMessage.AccessLevel;
     this.Context          = instantMessage.Context;
     this.IsFriend         = PlayerDataManager.IsFriend(this.Cmid);
     this.IsFacebookFriend = PlayerDataManager.IsFacebookFriend(this.Cmid);
     this.IsClan           = PlayerDataManager.IsClanMember(this.Cmid);
 }
 // Token: 0x06000A27 RID: 2599 RVA: 0x000407A8 File Offset: 0x0003E9A8
 public void AddNewPrivateMessage(int cmid, InstantMessage msg)
 {
     try
     {
         ChatDialog chatDialog;
         if (!this._dialogsByCmid.TryGetValue(cmid, out chatDialog) && !msg.IsNotification)
         {
             CommActorInfo user;
             if (AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.TryGetPlayer(cmid, out user))
             {
                 CommUser commUser = new CommUser(user);
                 chatDialog = this.AddNewDialog(commUser);
                 if (!this._friendUsers.Exists((CommUser p) => p.Cmid == cmid))
                 {
                     this._otherUsers.Add(commUser);
                 }
             }
             else
             {
                 CommUser commUser2 = new CommUser(new CommActorInfo
                 {
                     Cmid        = cmid,
                     PlayerName  = msg.PlayerName,
                     Channel     = ChannelType.WebPortal,
                     AccessLevel = msg.AccessLevel
                 });
                 chatDialog = this.AddNewDialog(commUser2);
                 if (!this._friendUsers.Exists((CommUser p) => p.Cmid == cmid))
                 {
                     this._otherUsers.Add(commUser2);
                 }
             }
         }
         if (chatDialog != null)
         {
             chatDialog.AddMessage(msg);
             if (chatDialog != this.SelectedDialog)
             {
                 chatDialog.HasUnreadMessage = true;
             }
             if (ChatPageGUI.SelectedTab != TabArea.Private)
             {
                 this.HasUnreadPrivateMessage.Value = true;
                 AutoMonoBehaviour <SfxManager> .Instance.Play2dAudioClip(GameAudio.NewMessage, 0UL, 1f, 1f);
             }
         }
     }
     catch
     {
         Debug.LogError(string.Format("AddNewPrivateMessage from cmid={0}", cmid));
         throw;
     }
 }
Example #24
0
 private void AddButton(MessageBarButton button, InstantMessage im)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker) delegate { AddButton(button, im); });
     }
     else
     {
         AddButton(button, false);
         _Sessions[im.FromAgentID].Window.LogText(im.FromAgentName + ": " + im.Message, Color.FromKnownColor(KnownColor.ControlText));
     }
 }
Example #25
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));
        }
        public void Should_map_all_properties()
        {
            const string from        = "Sender name";
            const string messageText = "some test message for mapping tests";
            const string to          = "Receiver name";

            var instantMessage = new InstantMessage(from, messageText, to);
            var response       = InstantMessageToResponseMapper.MapMessageToResponse(instantMessage);

            response.From.Should().Be(instantMessage.From);
            response.MessageText.Should().Be(instantMessage.MessageText);
            response.To.Should().Be(instantMessage.To);
        }
Example #27
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();
 }
        private void PhoneLine_InstantMessageReceived(object sender, InstantMessage e)//odbieranie wiadomości
        {
            string  login_nadawcy = e.Sender.Substring(0, e.Sender.IndexOf("@"));
            Kontakt nadawca       = listaKontaktow.Find(x => x.login == login_nadawcy);

            if (nadawca != null)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    nadawca.wiadomosci.Add(login_nadawcy + " napisał: " + e.Content);
                    Wiadomosci_ItemsControl.Items.Add(login_nadawcy + " napisał: " + e.Content);
                });
            }
        }
Example #29
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;
        }
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            if (SelectedLine == null)
            {
                return;
            }

            var message = new InstantMessage(Recipient, InstantMessage);

            SelectedLine.InstantMessaging.SendMessage(message);

            string msgSender = string.Format("{0}", SelectedLine.SIPAccount);

            Model.AddInstantMessage(msgSender, InstantMessage);
            InstantMessage = "";
        }
 public PhoneLineInstantMessageArgs(IPhoneLine phoneLine, InstantMessage message)
 {
     PhoneLine = phoneLine;
     Message = message;
 }
 public PhoneCallInstantMessageArgs(IPhoneCall phoneCall, InstantMessage message)
 {
     PhoneCall = phoneCall;
     Message = message;
 }
        /// <summary>
        /// This will be called when an instant message received through a call.
        /// </summary>
        private void Call_InstantMessageReceived(object sender, InstantMessage e)
        {
            IPhoneCall call = sender as IPhoneCall;
            if (call == null)
                return;

            OnCallInstantMessageReceived(new PhoneCallInstantMessageArgs(call, e));
        }
 /// <summary>
 /// This will be called when an instant message received through a phone line.
 /// </summary>
 private void Line_InstantMessageReceived(object sender, InstantMessage e)
 {
     AddInstantMessage(e.Sender, e.Content);
 }