コード例 #1
0
        public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
        {
            try
            {
                if (instance.IsAvatarMuted(item.FromUUID, item.FromName))
                    return;
            }
            catch
            {
                ;
            }

            string smsg = item.Text;
            string prefix = string.Empty;

            //if (addToBuffer)
            //{
            //    textBuffer.Add(item);

            //    //int lines = textBuffer.Count;
            //    //int maxlines = this.instance.Config.CurrentConfig.lineMax;

            //    //if (lines > maxlines && maxlines > 0)
            //    //{
            //    //    CheckBufferSize();
            //    //    return;
            //    //}
            //}

            DateTime dte = item.Timestamp;

            if (classiclayout)
            {
                if (showTimestamps)
                {
                    dte = this.instance.State.GetTimeStamp(dte);
                    //if (instance.Config.CurrentConfig.UseSLT)
                    //{
                    //    string _timeZoneId = "Pacific Standard Time";
                    //    DateTime startTime = DateTime.UtcNow;
                    //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
                    //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
                    //}

                    textPrinter.SetSelectionForeColor(Color.Gray);

                    if (item.Style == ChatBufferTextStyle.StatusDarkBlue || item.Style == ChatBufferTextStyle.Alert)
                    {
                        //textPrinter.PrintText("\n" + dte.ToString("[HH:mm] "));
                        prefix = "\n" + dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture);
                    }
                    else
                    {
                        if (item.Style != ChatBufferTextStyle.StartupTitle)
                        {
                            //textPrinter.PrintText(dte.ToString("[HH:mm] "));
                            prefix = dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture);
                        }
                    }
                }
                else
                {
                    prefix = string.Empty;
                }
            }
            else
            {

                try
                {
                    if (lastspeaker != item.FromName)
                    {
                        //textPrinter.SetFontStyle(FontStyle.Bold);
                        textPrinter.PrintHeader(item.FromName);   // + buff);

                        lastspeaker = item.FromName;
                    }
                }
                catch
                {
                    ;
                }

                textPrinter.SetFontStyle(FontStyle.Regular);
                textPrinter.SetSelectionBackColor(Color.White);
                //textPrinter.SetSelectionBackColor(instance.Config.CurrentConfig.BgColour);

                if (showTimestamps)
                {
                    if (item.Style != ChatBufferTextStyle.StartupTitle)
                    {
                        dte = this.instance.State.GetTimeStamp(dte);

                        //if (instance.Config.CurrentConfig.UseSLT)
                        //{
                        //    string _timeZoneId = "Pacific Standard Time";
                        //    DateTime startTime = DateTime.UtcNow;
                        //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
                        //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
                        //}

                        //textPrinter.ForeColor = Color.Gray;

                        if (item.Style == ChatBufferTextStyle.StatusDarkBlue || item.Style == ChatBufferTextStyle.Alert)
                        {
                            prefix = "\n" + dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture);
                            //prefix = dte.ToString("[HH:mm] ");
                        }
                        else
                        {
                           // if (item.FromName == client.Self.Name)   //FirstName + " " + client.Self.LastName)
                          //  {
                                prefix = dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture);
                          //  }
                          //  else
                         //   {
                        //        prefix = dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture);
                         //   }
                        }
                    }
                }
                else
                {
                    prefix = string.Empty;
                }
            }

            // Check to see if it is an in-world plugin first
            //current possibilities are GroupManager or ChairAnnouncer
            if (smsg.Contains(gmu))
            {
                roles = new List<UUID>();

                char[] deli = ",".ToCharArray();
                string[] sGrp = smsg.Split(deli);

                try //trap the cast to UUID bug if passed string is malformed
                {
                    igroup = (UUID)sGrp[2];
                    iperson = (UUID)sGrp[1];
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.Message, Helpers.LogLevel.Error);
                    return;
                }

                int ielems = sGrp.Length;

                // This is a hack for backward GroupMan Pro compatibility
                if (ielems > 6)
                {
                    gavname = sGrp[5];
                    gmanlocation = sGrp[6];
                }
                else
                {
                    gavname = string.Empty;
                    gmanlocation = string.Empty;
                }

                string pwd = string.Empty;

                try
                {
                    pwd = sGrp[3];
                }
                catch
                {
                    pwd = "invalid";
                }

                // the MD5 stuff (as of V 0.9.3)
                string str = this.instance.Config.CurrentConfig.GroupManPro;
                METAMD5 md5 = new METAMD5();
                string metapwd = md5.MD5(str);

                if (pwd != metapwd)
                {
                    string gmsg = string.Empty;

                    if (pwd == "invalid")
                    {
                        gmsg = "IMPORTANT WARNING: A group invite could not be sent out. Your GroupMan Pro is out of date.";
                    }
                    else
                    {
                        gmsg = "IMPORTANT WARNING: A group invite request with an invalid password has been received. Either the passwords in METAbolt & GroupMan Pro don't match or someone is trying to get unauthorised access. This is for information purposes only. DO NOT PANIC. The request has been discarded.  \n\nRequest received from: " + item.FromName + " (" + item.FromUUID + ")\nThe password used is: " + pwd + ".\nThe requested invite is for group: " + igroup;
                    }

                    textPrinter.PrintTextLine(gmsg);
                    return;
                }

                //roles.Add("00000000-0000-0000-0000-000000000000");

                // Check if being invited to a specific role
                if (ielems > 4)
                {
                    try //trap the cast to UUID bug if passed string is malformed
                    {
                        irole = (UUID)sGrp[4].Trim();
                    }
                    catch { ;}

                    roles.Add(irole);
                }
                else
                {
                    roles.Add(UUID.Zero);
                }

                try
                {
                    textPrinter.SetSelectionForeColor(Color.DarkCyan);

                    if (this.instance.State.Groups.ContainsKey(igroup))
                    {
                        // check if already member of the group
                        client.Groups.GroupMembersReply += new EventHandler<GroupMembersReplyEventArgs>(GroupMembersHandler);
                        GroupRequestID = client.Groups.RequestGroupMembers(igroup);
                    }

                    return;
                }
                catch (Exception excp)
                {
                    textPrinter.PrintTextLine(String.Format(CultureInfo.CurrentCulture, "\n(GroupMan Pro @ " + gmanlocation + ")\nGroupMan Pro has encountered an error and a group invite could not be sent to: " + gavname));
                    OpenMetaverse.Logger.Log(String.Format(CultureInfo.CurrentCulture, "GroupMan Pro Error: {0}", excp), Helpers.LogLevel.Error);
                    return;
                }
            }
            //added by GM on 2-JUL-2009
            else if (item.FromUUID == cau && cau != UUID.Zero)
            {
                if (!chairAnnEnabled) return;
                if (nextCallTime <= DateTime.Now)
                {
                    textPrinter.SetSelectionForeColor(Color.DarkOrange);
                    if (chairAnnChat) textPrinter.PrintText(prefix);

                    // the MD5 stuff (as of V 0.9.3)
                    //chop out the Password if there is one
                    string[] chops = smsg.Split(new char[] { '|' }, StringSplitOptions.None);
                    string pwd;
                    if (chops.Length == 3)
                    {
                        pwd = chops[1];
                    }
                    else
                    {
                        pwd = "invalid";
                    }

                    string str = this.instance.Config.CurrentConfig.GroupManPro; //GM: actually it is the METAbolt password
                    METAMD5 md5 = new METAMD5();
                    string metapwd = md5.MD5(str);

                    if (pwd != metapwd)
                    {
                        string gmsg = string.Empty;

                        if (pwd == "invalid")
                        {
                            gmsg = "IMPORTANT WARNING: A chair announcement could not be sent out. Your Chair Announcer is out of date. \nThe password used is: " + pwd + ".";
                        }
                        else
                        {
                            gmsg = "IMPORTANT WARNING: A chair announcement with an invalid password has been received. Either the passwords in METAbolt & Chair Announcer don't match or someone is trying to get unauthorised access. This is for information purposes only. DO NOT PANIC. The request has been discarded.  \nThe password used is: " + pwd;
                        }

                        textPrinter.PrintTextLine(gmsg); //always print even if chairAnnChat is turned off
                        return;
                    }

                    //fixup the text
                    //chop off before the ChairPrefix
                    string cp = METAbolt.Properties.Resources.ChairPrefix;
                    int pos = smsg.IndexOf(cp, 2, StringComparison.CurrentCultureIgnoreCase);
                    pos = pos < 0 ? 0 : pos;
                    StringBuilder sb = new StringBuilder(smsg.Substring(pos));

                    //include the advert on a new line
                    // modified by GM on 1-APR-2010
                    //was string ca = METAbolt.Properties.Resources.ChairAdvert;
                    string ca = chairAnnAdvert;
                    sb.Append(" \n");
                    sb.Append(ca);

                    //work out which group to IM between 0 and 5
                    indexGroup++;
                    if (indexGroup == 6 || chairAnnouncerGroups[indexGroup] == UUID.Zero) indexGroup = 0;
                    nextCallTime = DateTime.Now.AddMinutes(1);
                    //callbacks
                    client.Self.GroupChatJoined += new EventHandler<GroupChatJoinedEventArgs>(Self_OnGroupChatJoin);

                    //calculate the interval
                    int perGroupInterval = (int)Math.Round(((decimal)(chairAnnouncerInterval / chairAnnouncerActives)));
                    perGroupInterval = perGroupInterval < 1 ? 1 : perGroupInterval;
                    //find if already in the group
                    UUID grp = chairAnnouncerGroups[indexGroup];
                    if (client.Self.GroupChatSessions.ContainsKey(grp))
                    {
                        client.Self.InstantMessageGroup(grp, sb.ToString());
                        if (chairAnnChat) textPrinter.PrintTextLine("Chair Announcer: IM to existing group " + chairAnnouncerGroupNames[indexGroup]);
                        nextCallTime = nextCallTime.AddMinutes(perGroupInterval - 1);
                    }
                    else
                    {
                        targetIndex = indexGroup;
                        client.Self.RequestJoinGroupChat(grp);
                        waitGroupIMSession.Reset();
                        if (waitGroupIMSession.WaitOne(30000, false)) //30 seconds
                        {
                            client.Self.InstantMessageGroup(grp, sb.ToString());
                            if (chairAnnChat) textPrinter.PrintTextLine("Chair Announcer: IM to new group " + chairAnnouncerGroupNames[indexGroup]);
                            nextCallTime = nextCallTime.AddMinutes(perGroupInterval - 1);
                        }
                        else
                        {
                            Logger.Log("Chair Announcer: timeout after 30 seconds on group " + indexGroup.ToString(CultureInfo.CurrentCulture), Helpers.LogLevel.Warning);
                        }
                    }

                    client.Self.GroupChatJoined -= new EventHandler<GroupChatJoinedEventArgs>(Self_OnGroupChatJoin);
                }
                else
                {
                    Logger.Log("Chair Announcer: skipped", Helpers.LogLevel.Info);
                }

                OpenMetaverse.Logger.Log(String.Format(CultureInfo.CurrentCulture, "AddIn: {0} called {1}", cau.ToString(), smsg), Helpers.LogLevel.Debug);
                return;
            }

            if (classiclayout)
            {
                textPrinter.SetSelectionForeColor(Color.Gray);
                textPrinter.PrintClassicTextDate(prefix);
                //textPrinter.PrintDate(prefix);
            }
            else
            {
                //textPrinter.SetSelectionForeColor(Color.Gray);
                //textPrinter.PrintText(dte.ToString("[HH:mm] "));
                //textPrinter.SetOffset(6);
                //textPrinter.SetFontSize(6.5f);
                textPrinter.PrintDate(prefix);
                //textPrinter.SetFontSize(8.5f);
                //textPrinter.SetOffset(0);
            }

            bool islhdr = false;

            switch (item.Style)
            {
                case ChatBufferTextStyle.Normal:
                    textPrinter.SetSelectionForeColor(Color.Black);
                    break;

                case ChatBufferTextStyle.StatusBlue:
                    textPrinter.SetSelectionForeColor(Color.Blue);
                    break;

                case ChatBufferTextStyle.StatusBold:
                    textPrinter.SetFontStyle(FontStyle.Bold);
                    break;

                case ChatBufferTextStyle.StatusBrown:
                    textPrinter.SetSelectionForeColor(Color.Brown);
                    break;

                case ChatBufferTextStyle.StatusDarkBlue:
                    textPrinter.SetSelectionForeColor(Color.Gray);
                    //textPrinter.BackColor = Color.LightSeaGreen;
                    break;

                case ChatBufferTextStyle.LindenChat:
                    textPrinter.SetSelectionForeColor(Color.DarkGreen);
                    textPrinter.SetSelectionBackColor(Color.LightYellow);
                    break;

                case ChatBufferTextStyle.ObjectChat:
                    textPrinter.SetSelectionForeColor(Color.DarkCyan);
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.OwnerSay:
                    textPrinter.SetSelectionForeColor(Color.FromArgb(255, 211, 75, 0));
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.RegionSay:
                    textPrinter.SetSelectionForeColor(Color.Green);
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.StartupTitle:
                    textPrinter.SetSelectionForeColor(Color.Black);
                    textPrinter.SetFontStyle(FontStyle.Bold);
                    break;

                case ChatBufferTextStyle.Alert:
                    textPrinter.SetSelectionForeColor(Color.White);
                    //textPrinter.SetSelectionBackColor(Color.BlueViolet);
                    textPrinter.SetSelectionBackColor(Color.SteelBlue);
                    item.Text = item.Text;   // +"\n";
                    break;

                case ChatBufferTextStyle.Error:
                    textPrinter.SetSelectionForeColor(Color.Yellow);
                    textPrinter.SetSelectionBackColor(Color.Red);
                    break;

                case ChatBufferTextStyle.LoginReply:
                    textPrinter.PrintHeader(":: Grid Login Message ::");
                    textPrinter.SetSelectionForeColor(Color.Black);
                    //textPrinter.SetSelectionBackColor(Color.LightSteelBlue);
                    textPrinter.SetSelectionBackColor(instance.Config.CurrentConfig.HeaderBackColour);
                    textPrinter.SetFontStyle(FontStyle.Bold);
                    //textPrinter.SetFontSize(12);
                    textPrinter.SetOffset(8);
                    islhdr = true;

                    if (item.Text.Contains("http://"))
                    {
                        item.Text = instance.CleanReplace("http://", "\nhttp://", item.Text);
                    }

                    if (item.Text.Contains("https://"))
                    {
                        item.Text = instance.CleanReplace("https://", "\nhttps://", item.Text);
                    }
                    break;
            }

            textPrinter.PrintTextLine(item.Text);

            if (islhdr) textPrinter.PrintHeader(" ");

            //// Handle chat tweets
            //if (TEnabled)
            //{
            //    if (instance.Config.CurrentConfig.EnableChatTweets)
            //    {
            //        Yedda.Twitter twit = new Yedda.Twitter();
            //        string resp = string.Empty;

            //        if (tweet)
            //        {
            //            // if enabled print to Twitter
            //            resp = twit.UpdateAsJSON(tName, tPwd, item.Text);
            //        }
            //        else
            //        {
            //            // it's a direct message
            //            resp = twit.Send(tName, tPwd, tweetname, item.Text);
            //        }

            //        if (resp != "OK")
            //        {
            //            Logger.Log("Twitter error: " + resp, Helpers.LogLevel.Warning);
            //        }
            //    }
            //}

            if (reprinting)
            {
                reprinting = false;
                return;
            }

            if (!classiclayout)
            {
                string txt = item.FromName + ": " + item.Text;
                LogMessage(dte, item.FromUUID.ToString(), item.FromName, txt);
            }
            else
            {
                LogMessage(dte, item.FromUUID.ToString(), item.FromName, item.Text);
            }
        }
コード例 #2
0
        public void PrintStartupMessage()
        {
            ChatBufferItem title = new ChatBufferItem(
                DateTime.Now, Properties.Resources.METAboltTitle + " " + Properties.Resources.METAboltVersion + Environment.NewLine, ChatBufferTextStyle.StartupTitle);

            ChatBufferItem ready = new ChatBufferItem(
                DateTime.Now, " Ready to login...\n", ChatBufferTextStyle.StatusBlue);

            ProcessBufferItem(title, true);
            ProcessBufferItem(ready, true);
        }
コード例 #3
0
        public void PrintUUID()
        {
            string avid = client.Self.AgentID.ToString();

            ChatBufferItem avuuid = new ChatBufferItem(
                DateTime.Now, " My UUID is " + avid, ChatBufferTextStyle.Alert);

            ProcessBufferItem(avuuid, true);
        }
コード例 #4
0
ファイル: TabsConsole.cs プロジェクト: NullProjects/METAbolt
        public void DisplayChatScreen(string msg)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    DisplayChatScreen(msg);
                }));

                return;
            }

            BeginInvoke(new MethodInvoker(delegate()
            {
                ChatBufferItem ready = new ChatBufferItem(DateTime.Now,
                           msg,
                           ChatBufferTextStyle.Alert,
                           null,
                           UUID.Random()); //added by GM on 3-JUL-2009 - the FromAgentID

                chatConsole.ChatManager.ProcessBufferItem(ready, false);
            }));
        }
コード例 #5
0
        private void netcom_ClientDisconnected(object sender, DisconnectedEventArgs e)
        {
            if (e.Reason == NetworkManager.DisconnectType.ClientInitiated) return;

            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, " Client disconnected. Message: " + e.Message, ChatBufferTextStyle.Error);

            ProcessBufferItem(item, true);

            RemoveNetcomEvents();
        }
コード例 #6
0
 /// <summary>
 /// Adds a chat buffer item to the data context.
 /// </summary>
 /// <param name="chatBufferItem">The chat buffer item to be added.</param>
 public void AddChatBufferItem(ChatBufferItem chatBufferItem)
 {
     _entityContainer.ChatBuffer.Add(chatBufferItem);
     _entityContainer.SaveChanges();
 }
コード例 #7
0
 /// <summary>
 /// Deletes a chat buffer item from the data context.
 /// </summary>
 /// <param name="chatBufferItem">The chat buffer item to be deleted.</param>
 public void DeleteChatBufferItem(ChatBufferItem chatBufferItem)
 {
     _entityContainer.ChatBuffer.Remove(chatBufferItem);
     _entityContainer.SaveChanges();
 }
コード例 #8
0
        private void ProcessIncomingChat(ChatEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message)) return;

            if (instance.IsAvatarMuted(e.OwnerID, e.FromName))
                return;

            //if (e.Message.Substring(0, 1) == "@") return;   // Ignore RLV commands
            if (e.Message.Contains(imu)) return; // Ignore the message for plugin use or whatever
            if (e.Message.Contains(commandin)) return; // LSL API command

            StringBuilder sb = new StringBuilder();

            if (e.Message.StartsWith("/me ", StringComparison.CurrentCultureIgnoreCase))
            {
                sb.Append(e.FromName);
                sb.Append(e.Message.Substring(3));
            }
            else if (e.FromName.ToLower(CultureInfo.CurrentCulture) == client.Self.Name.ToLower(CultureInfo.CurrentCulture) && e.SourceType == ChatSourceType.Agent)
            {
                if (classiclayout)
                {
                    sb.Append(e.FromName);
                }

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

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

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

                sb.Append(e.Message);
            }
            else
            {
                if (instance.chatbuffer.RingBuffer(instance))
                {
                    ChatBufferItem dalert = new ChatBufferItem(
                    DateTime.Now, "Too many chat messages are coming in too quickly. Flood Protection is in operation for your security...", ChatBufferTextStyle.Alert);

                    ProcessBufferItem(dalert, true);

                    return;
                }

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

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

                    case ChatType.Shout:
                        sb.Append(" [shouts] ");
                        break;
                    case ChatType.Debug:
                        //sb.Append(": ");
                        return;
                }

                sb.Append(e.Message);
            }

            ChatBufferItem item = new ChatBufferItem();
            item.Timestamp = DateTime.Now;
            item.Text = sb.ToString();
            item.FromName = e.FromName;
            item.Link = "http://*****:*****@", StringComparison.CurrentCultureIgnoreCase)) return;

                    if (e.Type == ChatType.OwnerSay)
                    {
                        item.Style = ChatBufferTextStyle.OwnerSay;
                    }
                    else if (e.Type == ChatType.Debug)
                    {
                        item.Style = ChatBufferTextStyle.Error;
                    }
                    else if (e.Type == ChatType.RegionSay)
                    {
                        item.Style = ChatBufferTextStyle.RegionSay;
                    }
                    else
                    {
                        item.Style = ChatBufferTextStyle.ObjectChat;
                    }

                    //item.Style = ChatBufferTextStyle.ObjectChat;
                    break;
            }

            if (e.FromName.ToLower(CultureInfo.CurrentCulture) == client.Self.Name.ToLower(CultureInfo.CurrentCulture))
            {
                ProcessBufferItem(item, true);
            }
            else
            {
                ProcessBufferItemResp(item, true);
            }

            sb = null;
        }
コード例 #9
0
        //Used only for non-public chat
        private void ProcessOutgoingChat(ChatSentEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("(channel ");
            sb.Append(e.Channel);

            if (classiclayout)
            {
                sb.Append(") You: ");
            }
            else
            {
                sb.Append(") ");
            }

            switch (e.Type)
            {
                case ChatType.Normal:
                    if (classiclayout)
                    {
                        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(
                DateTime.Now, sb.ToString(), ChatBufferTextStyle.StatusDarkBlue, client.Self.Name);

            ProcessBufferItem(item, true);

            sb = null;
        }
コード例 #10
0
        private void netcom_ScriptQuestionReceived(object sender, ScriptQuestionEventArgs e)
        {
            if (instance.IsObjectMuted(e.ItemID, e.ObjectName))
                return;

            if (scriptbuffer.RingBuffer(instance))
            {
                ChatBufferItem dalert = new ChatBufferItem(
                DateTime.Now, "Too many script dialogues are coming in too quickly. Flood Protection is in operation for your security...", ChatBufferTextStyle.Alert);

                ProcessBufferItem(dalert, true);

                return;
            }

            //e.ObjectName.ToString();
            //e.ObjectOwner.ToString();
            //e.Questions.ToString();

            ScriptPermission sperm = ScriptPermission.None;
            string smsg = string.Empty;

            switch (e.Questions)
            {
                case ScriptPermission.Attach:
                    sperm = ScriptPermission.Attach;
                    smsg = "Wants permission to ATTACH.";
                    break;

                case ScriptPermission.Debit:
                    sperm = ScriptPermission.Debit;
                    smsg = "Wants permission to DEBIT.";
                    break;

                case ScriptPermission.TakeControls:
                    sperm = ScriptPermission.TakeControls;
                    smsg = "Wants permission to TAKE CONTROLS.";
                    break;

                case ScriptPermission.TriggerAnimation:
                    sperm = ScriptPermission.TriggerAnimation;
                    smsg = "Wants permission to TRIGGER ANIMATION.";
                    break;

                case ScriptPermission.Teleport:
                    sperm = ScriptPermission.Teleport;
                    smsg = "Wants permission to TELEPORT.";
                    break;
            }

            //DialogResult sret = MessageBox.Show(e.ObjectName.ToString(CultureInfo.CurrentCulture) + " owned by " + e.ObjectOwnerName + ":\n\n" + smsg, "Script permission...", MessageBoxButtons.OKCancel);
            DialogResult sret = MessageBoxEx.Show(e.ObjectName.ToString(CultureInfo.CurrentCulture) + "\nowned by " + e.ObjectOwnerName + ":\n\n" + smsg, "Script permission...", MessageBoxButtons.OKCancel, 15000);

            if (sret == DialogResult.OK)
            {
                // Grant permission
                client.Self.ScriptQuestionReply(client.Network.CurrentSim, e.ItemID, e.TaskID, sperm);
            }
            else
            {
                client.Self.ScriptQuestionReply(client.Network.CurrentSim, e.ItemID, e.TaskID, ScriptPermission.None);
            }
        }
コード例 #11
0
        private void ProcessBufferItemResp(ChatBufferItem item, bool addToBuffer)
        {
            //if (addToBuffer)
            //{
            //    textBuffer.Add(item);

            //    //int lines = textBuffer.Count;
            //    //int maxlines = this.instance.Config.CurrentConfig.lineMax;

            //    //if (lines > maxlines && maxlines > 0)
            //    //{
            //    //    CheckBufferSize();
            //    //    return;
            //    //}
            //}

            textPrinter.SetSelectionForeColor(Color.Gray);
            DateTime dte = item.Timestamp;

            if (classiclayout)
            {
                if (showTimestamps)
                {
                    dte = this.instance.State.GetTimeStamp(dte);

                    //if (instance.Config.CurrentConfig.UseSLT)
                    //{
                    //    string _timeZoneId = "Pacific Standard Time";
                    //    DateTime startTime = DateTime.UtcNow;
                    //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
                    //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
                    //}

                    textPrinter.PrintClassicTextDate(dte.ToString("[HH:mm] ", CultureInfo.CurrentCulture));
                }

                try
                {
                    if (item.Style != ChatBufferTextStyle.ObjectChat && item.Style != ChatBufferTextStyle.OwnerSay && item.Style != ChatBufferTextStyle.RegionSay)
                    {
                        if (!string.IsNullOrEmpty(item.FromName))
                        {
                            textPrinter.PrintLink(item.FromName, item.Link + "&" + item.FromName);
                        }
                    }
                    else
                    {
                        textPrinter.PrintClassicTextDate(item.FromName);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log("Chat Manager: " + ex.Message, Helpers.LogLevel.Error);
                }
            }
            else
            {
                try
                {
                    if (lastspeaker != item.FromName)
                    {
                        textPrinter.SetFontStyle(FontStyle.Bold);

                        if (item.Style != ChatBufferTextStyle.ObjectChat && item.Style != ChatBufferTextStyle.OwnerSay && item.Style != ChatBufferTextStyle.RegionSay)
                        {
                            if (!string.IsNullOrEmpty(item.FromName))
                            {
                                textPrinter.PrintLinkHeader(item.FromName, item.FromUUID.ToString(), item.Link + "&" + item.FromName);
                            }
                        }
                        else
                        {
                            textPrinter.PrintHeader(item.FromName);
                        }

                        lastspeaker = item.FromName;
                    }
                }
                catch
                {
                    ;
                }

                textPrinter.SetFontStyle(FontStyle.Regular);
                textPrinter.SetSelectionBackColor(Color.White);
                //textPrinter.SetSelectionBackColor(instance.Config.CurrentConfig.BgColour);

                if (showTimestamps)
                {
                    dte = this.instance.State.GetTimeStamp(dte);

                    //if (instance.Config.CurrentConfig.UseSLT)
                    //{
                    //    string _timeZoneId = "Pacific Standard Time";
                    //    DateTime startTime = DateTime.UtcNow;
                    //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
                    //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
                    //}

                    string header = string.Empty;

                    header = "[HH:mm] ";
                    //textPrinter.SetSelectionForeColor(Color.Gray);
                    //textPrinter.SetOffset(6);
                    //textPrinter.SetFontSize(6.5f);
                    textPrinter.PrintDate(dte.ToString(header, CultureInfo.CurrentCulture));
                    //textPrinter.SetFontSize(8.5f);
                    //textPrinter.SetOffset(0);
                }
            }

            switch (item.Style)
            {
                case ChatBufferTextStyle.Normal:
                    textPrinter.SetSelectionForeColor(Color.Blue);
                    break;

                case ChatBufferTextStyle.StatusBlue:
                    textPrinter.SetSelectionForeColor(Color.BlueViolet);
                    break;

                case ChatBufferTextStyle.StatusBold:
                    textPrinter.SetFontStyle(FontStyle.Bold);
                    break;

                case ChatBufferTextStyle.StatusBrown:
                    textPrinter.SetSelectionForeColor(Color.Brown);
                    break;

                case ChatBufferTextStyle.StatusDarkBlue:
                    textPrinter.SetSelectionForeColor(Color.White);
                    textPrinter.SetSelectionBackColor(Color.LightSeaGreen);
                    break;

                case ChatBufferTextStyle.LindenChat:
                    textPrinter.SetSelectionForeColor(Color.DarkGreen);
                    textPrinter.SetSelectionBackColor(Color.LightYellow);
                    break;

                case ChatBufferTextStyle.ObjectChat:
                    textPrinter.SetSelectionForeColor(Color.DarkCyan);
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.OwnerSay:
                    textPrinter.SetSelectionForeColor(Color.FromArgb(255, 211, 75, 0));
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.RegionSay:
                    textPrinter.SetSelectionForeColor(Color.Green);
                    //item.Text = "\n" + item.Text;
                    break;

                case ChatBufferTextStyle.Alert:
                    textPrinter.SetSelectionForeColor(Color.White);
                    //textPrinter.SetSelectionBackColor(Color.BlueViolet);
                    textPrinter.SetSelectionBackColor(Color.SteelBlue);
                    item.Text = item.Text;   // +"\n";
                    break;

                case ChatBufferTextStyle.Error:
                    textPrinter.SetSelectionForeColor(Color.Yellow);
                    textPrinter.SetSelectionBackColor(Color.Red);
                    break;
            }

            textPrinter.PrintTextLine(item.Text);

            if (reprinting)
            {
                reprinting = false;
                return;
            }

            if (!classiclayout)
            {
                string txt = item.FromName + ": " + item.Text;
                LogMessage(dte, item.FromUUID.ToString(), item.FromName, txt);
            }
            else
            {
                LogMessage(dte, item.FromUUID.ToString(), item.FromName, item.Text);
            }
        }
コード例 #12
0
        private void netcom_LoadURLReceived(object sender, LoadUrlEventArgs e)
        {
            //e.Message;
            //e.ObjectName;
            //e.url;

            if (instance.IsObjectMuted(e.ObjectID, e.ObjectName))
                return;

            if (urlbuffer.RingBuffer(instance))
            {
                ChatBufferItem dalert = new ChatBufferItem(
                DateTime.Now, "Too many URL offers are coming in too quickly. Flood Protection is in operation for your security...", ChatBufferTextStyle.Alert);

                ProcessBufferItem(dalert, true);

                return;
            }

            DialogResult sret = MessageBoxEx.Show(e.ObjectName.ToString(CultureInfo.CurrentCulture) + "\nowned by " + e.OwnerID.ToString() + " is offering you a URL.\n\nClick 'OK' to visit.", "URL offer...", MessageBoxButtons.OKCancel, 15000);

            if (sret == DialogResult.OK)
            {
                //ShellExecute(this.Handle, "open", e.url.ToString(), null, null, 0);
                System.Diagnostics.Process.Start(@e.URL.ToString(CultureInfo.CurrentCulture));
            }
        }
コード例 #13
0
        private void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e)
        {
            if (e.Status == LoginStatus.Success)
            {
                ChatBufferItem loggedIn = new ChatBufferItem(
                    DateTime.Now,
                    " Logged into Second Life as " + netcom.LoginOptions.FullName + ".",
                    ChatBufferTextStyle.StatusBlue);

                ChatBufferItem loginReply = new ChatBufferItem(
                    DateTime.Now, Environment.NewLine + e.Message, ChatBufferTextStyle.LoginReply);

                string avid = client.Self.AgentID.ToString();

                ChatBufferItem avuuid = new ChatBufferItem(
                    DateTime.Now, " " + netcom.LoginOptions.FullName + "'s UUID is " + avid + " " + Environment.NewLine, ChatBufferTextStyle.StatusBlue);

                //ChatBufferItem avuuid1 = new ChatBufferItem(
                //    DateTime.Now, " Waiting for avatar to rezz... ", ChatBufferTextStyle.Alert);

                ProcessBufferItem(loggedIn, true);
                ProcessBufferItem(avuuid, true);
                ProcessBufferItem(loginReply, true);
                //ProcessBufferItem(avuuid1, true);
            }
            else if (e.Status == LoginStatus.Failed)
            {
                ChatBufferItem loginError = new ChatBufferItem(
                    DateTime.Now, " Login error: " + e.Message, ChatBufferTextStyle.Error);

                ProcessBufferItem(loginError, true);
            }
        }
コード例 #14
0
        private void netcom_ClientLoggedOut(object sender, EventArgs e)
        {
            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, " Logged out of Second Life.\n", ChatBufferTextStyle.StatusBlue);

            ProcessBufferItem(item, true);

            RemoveNetcomEvents();
        }
コード例 #15
0
        // Seperate thread
        private void GroupMembersHandler(object sender, GroupMembersReplyEventArgs e)
        {
            if (e.RequestID == GroupRequestID)
            {
                client.Groups.GroupMembersReply -= new EventHandler<GroupMembersReplyEventArgs>(GroupMembersHandler);

                if (igroup != e.GroupID)
                {
                    return;
                }

                invitecounter += 1;

                if (e.Members.Count > 0)
                {
                    GroupMember gmember;

                    if (e.Members.TryGetValue(iperson, out gmember))
                    {
                        invitecounter = 0;

                        if (!ismember)
                        {
                            //DateTime dte = DateTime.Now;

                            //dte = this.instance.State.GetTimeStamp(dte);

                            //if (instance.Config.CurrentConfig.UseSLT)
                            //{
                            //    string _timeZoneId = "Pacific Standard Time";
                            //    DateTime startTime = DateTime.UtcNow;
                            //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
                            //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
                            //}

                            string prefix = instance.SetTime();    //dte.ToString("[HH:mm] ");
                            string gname = instance.State.GroupStore[igroup];

                            //textPrinter.SetSelectionForeColor(Color.Gray);
                           // textPrinter.PrintTextLine(prefix + "\n\n[ GroupMan Pro ] @ " + gmanlocation + "\n   Invite request for group " + gname.ToUpper(CultureInfo.CurrentCulture) + " has been ignored. " + gavname + " (" + iperson.ToString() + ") is already a member.");

                            string Msg = "\n\n[ GroupMan Pro ] @ " + gmanlocation + "\n   Invite request for group " + gname.ToUpper(CultureInfo.CurrentCulture) + " has been ignored. " + gavname + " (" + iperson.ToString() + ") is already a member.";

                            ChatBufferItem ready = new ChatBufferItem( DateTime.Now, Msg, ChatBufferTextStyle.StatusGray);

                            ProcessBufferItem(ready, true);

                            return;
                        }
                        else
                        {
                            ismember = false;
                            GivePresent();
                            return;
                        }
                    }
                }

                if (invitecounter > 1)
                {
                    invitecounter = 0;
                    ismember = false;
                    aTimer.Stop();
                    aTimer.Enabled = false;
                    return;
                }

                if (invitecounter == 1)
                {
                    WriteToChat();
                }
            }
        }
コード例 #16
0
        private void WriteToChat()
        {
            //DateTime dte = DateTime.Now;

            //dte = this.instance.State.GetTimeStamp(dte);

            //if (instance.Config.CurrentConfig.UseSLT)
            //{
            //    string _timeZoneId = "Pacific Standard Time";
            //    DateTime startTime = DateTime.UtcNow;
            //    TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById(_timeZoneId);
            //    dte = TimeZoneInfo.ConvertTime(startTime, TimeZoneInfo.Utc, tst);
            //}

            //textPrinter.ForeColor = Color.Gray;
            string prefix = instance.SetTime();    //dte.ToString("[HH:mm] ");

            try
            {
                client.Groups.Invite(igroup, roles, iperson);

                // start timer to check if invite has been accepted
                aTimer = new System.Timers.Timer();
                aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
                // Set the Interval to 10 seconds.
                aTimer.Interval = 10000;
                aTimer.Enabled = true;
                aTimer.Start();
            }
            catch (Exception excp)
            {
                //string eex = excp.ToString();
                //PrintIM(DateTime.Now, e.IM.FromAgentName, "GroupMan Pro has encountered an error and a group invite could not be sent to: " + sGrp[2].ToString());
                textPrinter.PrintTextLine(String.Format(CultureInfo.CurrentCulture, prefix + "(\nGroupMan Pro @ " + gmanlocation + ")\nGroupMan Pro has encountered an error and a group invite could not be sent to: " + gavname));
                OpenMetaverse.Logger.Log(String.Format(CultureInfo.CurrentCulture, prefix + "GroupMan Pro Error: {0}", excp), Helpers.LogLevel.Error);
                return;
            }

            string gname = string.Empty;

            if (instance.State.GroupStore.ContainsKey(igroup))
            {
                gname = "for group " + instance.State.GroupStore[igroup];
            }

            //textPrinter.SetFontStyle(FontStyle.Bold);
            //textPrinter.PrintTextLine(prefix + "\n\n[ GroupMan Pro ] @ " + gmanlocation + "\n   An invite has been sent to: " + gavname + " (" + iperson.ToString() + ")" + gname);

            string Msg = "\n\n[ GroupMan Pro ] @ " + gmanlocation + "\n   An invite has been sent to: " + gavname + " (" + iperson.ToString() + ")" + gname;

            ChatBufferItem ready = new ChatBufferItem(
               DateTime.Now, Msg, ChatBufferTextStyle.StatusBold);

            ProcessBufferItem(ready, true);
        }
コード例 #17
0
ファイル: ChatOverlay.cs プロジェクト: Booser/radegast
 public ChatLine(ChatBufferItem item, float timeAdded)
 {
     this.item = item;
     this.TimeAdded = timeAdded;
 }
コード例 #18
0
        public void PrintAlertMessage(string msg)
        {
            ChatBufferItem ready = new ChatBufferItem(
                DateTime.Now, msg, ChatBufferTextStyle.Alert);

            ProcessBufferItem(ready, true);
        }
コード例 #19
0
 /// <summary>
 /// Updates an existing chat buffer item in the data context.
 /// </summary>
 /// <param name="chatBufferItem">The chat buffer item to be updated.</param>
 public void UpdateChatBufferItem(ChatBufferItem chatBufferItem)
 {
     _entityContainer.SaveChanges();
 }
コード例 #20
0
        public void PrintDialogWarning(string avname, string oinfo)
        {
            ChatBufferItem dalert = new ChatBufferItem(
                DateTime.Now, " There is a total of 8 dialogs open. All new dialogs are now being blocked for your security. Close currently open dialogs to resume normal conditions.", ChatBufferTextStyle.Alert);

            ChatBufferItem warn1 = new ChatBufferItem(
                DateTime.Now, " Last dialog was from " + avname + ". Object details below..." + oinfo, ChatBufferTextStyle.Alert);

            ProcessBufferItem(dalert, false);
            ProcessBufferItem(warn1, false);
        }
コード例 #21
0
ファイル: ChatOverlay.cs プロジェクト: CasperTech/radegast
 public ChatLine(ChatBufferItem item, float timeAdded)
 {
     this.item      = item;
     this.TimeAdded = timeAdded;
 }
コード例 #22
0
        public void PrintMsg(string Msg)
        {
            //textPrinter.SetSelectionForeColor(Color.Brown);
            //textPrinter.PrintText(Msg);

            ChatBufferItem ready = new ChatBufferItem(
               DateTime.Now, Msg, ChatBufferTextStyle.StatusBrown);

            ProcessBufferItem(ready, true);
        }
コード例 #23
0
ファイル: TabsConsole.cs プロジェクト: NullProjects/METAbolt
        public void DisplayOnChat(InstantMessageEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    DisplayOnChat(e);
                }));

                return;
            }

            if (instance.IsAvatarMuted(e.IM.FromAgentID, e.IM.FromAgentName)) return;
            if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.CommandInID)) return;
            if (e.IM.Message.Contains(this.instance.Config.CurrentConfig.IgnoreUID)) return;

            BeginInvoke(new MethodInvoker(delegate()
            {
                ChatBufferItem ready = new ChatBufferItem(DateTime.Now,
                           e.IM.FromAgentName + " (" + e.IM.FromAgentID.ToString() + "): " + e.IM.Message,
                           ChatBufferTextStyle.ObjectChat,
                           null,
                           e.IM.IMSessionID); //added by GM on 3-JUL-2009 - the FromAgentID

                chatConsole.ChatManager.ProcessBufferItem(ready, false);
            }));
        }
コード例 #24
0
        private void netcom_AlertMessageReceived(object sender, AlertMessageEventArgs e)
        {
            if (e.Message.ToLower(CultureInfo.CurrentCulture).Contains("autopilot canceled")) return; //workaround the stupid autopilot alerts

            string emsg = e.Message.Trim();

            if (emsg.Contains("RESTART_X_MINUTES"))
            {
                string[] mins = emsg.Split(new Char[] { ' ' });
                emsg = "Region is restarting in " + mins[1].Trim() + " minutes. If you remain in this region you will be logged out.";
                netcom.ChatOut(emsg, ChatType.Normal, 123456);
            }

            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, " Alert message: " + emsg, ChatBufferTextStyle.Alert);

            ProcessBufferItem(item, true);
        }