private void netcom_ChatReceived(object sender, ChatEventArgs e)
        {
            if (e.FromName == netcom.LoginOptions.FullName & !prefs.setListUserName) return;

            string name = e.FromName;
            if (e.FromName == netcom.LoginOptions.FullName & !prefs.setUseFullName & e.SourceType == SLSourceType.Avatar) name = "You";

            if(e.SourceType == SLSourceType.Object) name = "(Ob) " + e.FromName;

            //Send our name and UUID to the function along
            //with telling it that we are adding (true) not
            //deleting (false)
            UpdateUserList(name,e.SourceId.ToString(),true);
        }
Beispiel #2
0
        private void ProcessIncomingChat(ChatEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message)) return;

            StringBuilder sb = new StringBuilder();

            if (e.Message.StartsWith("/me "))
            {
                sb.Append(e.FromName);
                sb.Append(e.Message.Substring(3));
            }
            else if (e.FromName == netcom.LoginOptions.FullName && e.SourceType == ChatSourceType.Agent)
            {
                sb.Append("You");

                switch (e.Type)
                {
                    case ChatType.Normal:
                        sb.Append(": ");
                        break;

                    case ChatType.Whisper:
                        sb.Append(" whisper: ");
                        break;

                    case ChatType.Shout:
                        sb.Append(" shout: ");
                        break;
                }

                sb.Append(e.Message);
            }
            else
            {
                sb.Append(e.FromName);

                switch (e.Type)
                {
                    case ChatType.Normal:
                        sb.Append(": ");
                        break;

                    case ChatType.Whisper:
                        sb.Append(" whispers: ");
                        break;

                    case ChatType.Shout:
                        sb.Append(" shouts: ");
                        break;
                }

                sb.Append(e.Message);
            }

            ChatBufferItem item = new ChatBufferItem();
            item.Timestamp = DateTime.Now;
            item.Text = sb.ToString();

            switch (e.SourceType)
            {
                case ChatSourceType.Agent:
                    item.Style =
                        (e.FromName.EndsWith("Linden") ?
                        ChatBufferTextStyle.LindenChat : ChatBufferTextStyle.Normal);
                    break;

                case ChatSourceType.Object:
                    item.Style = ChatBufferTextStyle.ObjectChat;
                    break;
            }

            ProcessBufferItem(item, true);
            sb = null;
        }
        private void ChatIncoming(Packet packet, Simulator simulator)
        {
            if (packet.Layout.Name != "ChatFromSimulator") return;

            string fromname         = string.Empty; //Name of source.
            LLUUID sourceid         = new LLUUID(); //UUID of source, object/avatar
            LLUUID ownerid          = new LLUUID(); //UUID of owner, if object UUID = owner of object, if avatar UUID = same as source
            SLSourceType sourcetype = SLSourceType.None;
            SLChatType chattype     = SLChatType.Whisper;
            bool audible            = false; //Audible: 1 if audible, 0 if beyond 20m (message is null)
            LLVector3 position      = new LLVector3(); //Region local position of source.
            string message          = string.Empty; //Message from source
            byte command            = 0; //Unused?
            LLUUID commandID        = new LLUUID(); //Unused?

            ArrayList blocks = packet.Blocks();

            foreach (Block block in blocks)
            {
                foreach (Field field in block.Fields)
                {
                    switch (field.Layout.Name)
                    {
                        case "SourceID":
                            sourceid = (LLUUID)field.Data;
                            break;

                        case "OwnerID":
                            ownerid = (LLUUID)field.Data;
                            break;

                        case "FromName":
                            fromname = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                            break;

                        case "SourceType":
                            sourcetype = (SLSourceType)(byte)field.Data;
                            break;

                        case "ChatType":
                            chattype = (SLChatType)(byte)field.Data;
                            break;

                        case "Audible":
                            audible = ((byte)field.Data == 1 ? true : false);
                            break;

                        case "Message":
                            message = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                            break;

                        case "Position":
                            position = (LLVector3)field.Data;
                            break;

                        case "Command":
                            command = (byte)field.Data;
                            break;

                        case "CommandID":
                            commandID = (LLUUID)field.Data;
                            break;
                    }
                }

                ChatEventArgs eventArgs = new ChatEventArgs(
                    message, chattype,
                    position, sourcetype, sourceid, ownerid,
                    fromname, audible, command, commandID);

                if (netcomSync != null)
                {
                    object[] ea = new object[1];
                    ea[0] = eventArgs;
                    netcomSync.Invoke(new OnChatRaise(OnChatReceived), ea);
                }
                else
                {
                    OnChatReceived(eventArgs);
                }
            }
        }
Beispiel #4
0
        private void ChatIncoming(Packet packet, Simulator simulator)
        {
            if (packet.Layout.Name != "ChatFromSimulator")
            {
                return;
            }

            string       fromname   = string.Empty; //Name of source.
            LLUUID       sourceid   = new LLUUID(); //UUID of source, object/avatar
            LLUUID       ownerid    = new LLUUID(); //UUID of owner, if object UUID = owner of object, if avatar UUID = same as source
            SLSourceType sourcetype = SLSourceType.None;
            SLChatType   chattype   = SLChatType.Whisper;
            bool         audible    = false;           //Audible: 1 if audible, 0 if beyond 20m (message is null)
            LLVector3    position   = new LLVector3(); //Region local position of source.
            string       message    = string.Empty;    //Message from source
            byte         command    = 0;               //Unused?
            LLUUID       commandID  = new LLUUID();    //Unused?

            ArrayList blocks = packet.Blocks();

            foreach (Block block in blocks)
            {
                foreach (Field field in block.Fields)
                {
                    switch (field.Layout.Name)
                    {
                    case "SourceID":
                        sourceid = (LLUUID)field.Data;
                        break;

                    case "OwnerID":
                        ownerid = (LLUUID)field.Data;
                        break;

                    case "FromName":
                        fromname = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                        break;

                    case "SourceType":
                        sourcetype = (SLSourceType)(byte)field.Data;
                        break;

                    case "ChatType":
                        chattype = (SLChatType)(byte)field.Data;
                        break;

                    case "Audible":
                        audible = ((byte)field.Data == 1 ? true : false);
                        break;

                    case "Message":
                        message = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                        break;

                    case "Position":
                        position = (LLVector3)field.Data;
                        break;

                    case "Command":
                        command = (byte)field.Data;
                        break;

                    case "CommandID":
                        commandID = (LLUUID)field.Data;
                        break;
                    }
                }

                ChatEventArgs eventArgs = new ChatEventArgs(
                    message, chattype,
                    position, sourcetype, sourceid, ownerid,
                    fromname, audible, command, commandID);

                if (netcomSync != null)
                {
                    object[] ea = new object[1];
                    ea[0] = eventArgs;
                    netcomSync.Invoke(new OnChatRaise(OnChatReceived), ea);
                }
                else
                {
                    OnChatReceived(eventArgs);
                }
            }
        }
Beispiel #5
0
 private void netcom_ChatReceived(object sender, ChatEventArgs e)
 {
     ProcessIncomingChat(e);
 }
Beispiel #6
0
        private void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
        {
            ChatEventArgs ea = new ChatEventArgs(message, audible, type, sourceType, fromName, id, ownerid, position);

            if (netcomSync != null)
                netcomSync.BeginInvoke(new OnChatRaise(OnChatReceived), new object[] { ea });
            else
                OnChatReceived(ea);
        }
 protected virtual void OnChatReceived(ChatEventArgs e)
 {
     if (ChatReceived != null) ChatReceived(this, e);
 }
Beispiel #8
0
        private void netcom_ChatReceived(object sender, ChatEventArgs e)
        {
            if (e.SourceType != ChatSourceType.Agent) return;
            if (e.FromName == netcom.LoginOptions.FullName) return;

            int index = lvwObjects.Items.IndexOfKey(e.FromName);
            if (index == -1) return;

            if (e.Type == ChatType.StartTyping)
                lvwObjects.Items[index].ForeColor = Color.DarkBlue;
            else
                lvwObjects.Items[index].ForeColor = Color.FromKnownColor(KnownColor.ControlText);
        }
Beispiel #9
0
        private void netcom_ChatReceived(object sender, ChatEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message)) return;

            tabs["chat"].Highlight();
        }
        private void netcom_ChatReceived(object sender, ChatEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message)) return;

            if (prefs.setChatTimestamps)
            {

                TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
                DateTime tr = (new DateTime(1970,1,1)).AddSeconds(t.TotalSeconds);
                tr = tr.AddHours(int.Parse(prefs.setChatTimeZ));
                textPrinter.ForeColor = Color.Gray;
                textPrinter.PrintText(tr.ToString(prefs.setChatStampFormat));
            }

            StringBuilder sb = new StringBuilder();

            //If the name is the users, the source is an agent,
            //and a "/me" command is not being done, then we append "you"
            //otherwise we append the full name.
            if (e.FromName == netcom.LoginOptions.FullName & e.SourceType == SLSourceType.Avatar & !e.Message.ToLower().StartsWith("/me ") & !prefs.setUseFullName)
                    sb.Append("You");
            else
                sb.Append(e.FromName);

            switch (e.Type)
            {
                case SLChatType.Say:
                    //sb.Append(": ");
                    break;

                case SLChatType.Whisper:
                    sb.Append(" whisper");
                    break;

                case SLChatType.Shout:
                    sb.Append(" shout");
                    break;
            }

            //Setting us up for proper grammar, so we don't get "You shouts"
            //but rather "You shout"
            if(e.FromName != netcom.LoginOptions.FullName & e.Type != SLChatType.Say)
                sb.Append("s");

            //Checking for a /me command
            string Mess = e.Message;
            if(!e.Message.ToLower().StartsWith("/me "))
            {
                sb.Append(": ");
            }else {
                Mess = e.Message.Remove(0,3);
            }

            sb.Append(Mess);

            switch (e.SourceType)
            {
                case SLSourceType.Avatar:
                    if(e.FromName.Split(' ')[1]=="Linden")
                    {
                        textPrinter.ForeColor = colorLindenText;
                    }else{
                        textPrinter.ForeColor = colorUserText;
                    }
                    break;

                case SLSourceType.Object:
                    textPrinter.ForeColor = colorObjectText;
                    break;
            }

            textPrinter.PrintTextLine(sb.ToString());
            sb = null;
        }