OSDN Git Service

Merge pull request #21 from nooperation/RAD-480
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 19 Jul 2015 07:52:46 +0000 (00:52 -0700)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 19 Jul 2015 07:52:46 +0000 (00:52 -0700)
RAD-480: Text from Muted/Blocked Users no longer shows in group chats

Radegast/GUI/Consoles/GroupIMTabWindow.Designer.cs
Radegast/GUI/Consoles/GroupIMTabWindow.cs

index 678a9d6..426f199 100644 (file)
@@ -58,16 +58,27 @@ namespace Radegast
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.rtbIMText = new Radegast.RRichTextBox();
             this.btnSend = new System.Windows.Forms.Button();
             this.chatSplit = new System.Windows.Forms.SplitContainer();
             this.Participants = new Radegast.ListViewNoFlicker();
+            this.avatarContext = new Radegast.RadegastContextMenuStrip(this.components);
+            this.ctxProfile = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxPay = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxStartIM = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxOfferTP = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxReqestLure = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxEject = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxBan = new System.Windows.Forms.ToolStripMenuItem();
+            this.ctxMute = new System.Windows.Forms.ToolStripMenuItem();
             this.btnShow = new System.Windows.Forms.Button();
             this.pnlChatInput = new System.Windows.Forms.Panel();
             this.cbxInput = new Radegast.ChatInputBox();
             this.chatSplit.Panel1.SuspendLayout();
             this.chatSplit.Panel2.SuspendLayout();
             this.chatSplit.SuspendLayout();
+            this.avatarContext.SuspendLayout();
             this.pnlChatInput.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -117,6 +128,7 @@ namespace Radegast
             // Participants
             // 
             this.Participants.Activation = System.Windows.Forms.ItemActivation.OneClick;
+            this.Participants.ContextMenuStrip = this.avatarContext;
             this.Participants.Dock = System.Windows.Forms.DockStyle.Fill;
             this.Participants.HideSelection = false;
             this.Participants.Location = new System.Drawing.Point(0, 0);
@@ -130,6 +142,87 @@ namespace Radegast
             this.Participants.View = System.Windows.Forms.View.List;
             this.Participants.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Participants_MouseDoubleClick);
             // 
+            // avatarContext
+            // 
+            this.avatarContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.ctxProfile,
+            this.ctxPay,
+            this.ctxStartIM,
+            this.ctxOfferTP,
+            this.ctxReqestLure,
+            this.ctxEject,
+            this.ctxBan,
+            this.ctxMute});
+            this.avatarContext.Name = "avatarContext";
+            this.avatarContext.Size = new System.Drawing.Size(158, 202);
+            this.avatarContext.Opening += new System.ComponentModel.CancelEventHandler(this.avatarContext_Opening);
+            // 
+            // ctxProfile
+            // 
+            this.ctxProfile.Name = "ctxProfile";
+            this.ctxProfile.Size = new System.Drawing.Size(157, 22);
+            this.ctxProfile.Text = "Profile";
+            this.ctxProfile.ToolTipText = " Profile ";
+            this.ctxProfile.Click += new System.EventHandler(this.ctxProfile_Click);
+            // 
+            // ctxPay
+            // 
+            this.ctxPay.Enabled = false;
+            this.ctxPay.Name = "ctxPay";
+            this.ctxPay.Size = new System.Drawing.Size(157, 22);
+            this.ctxPay.Text = "Pay";
+            this.ctxPay.ToolTipText = " Pay ";
+            this.ctxPay.Click += new System.EventHandler(this.ctxPay_Click);
+            // 
+            // ctxStartIM
+            // 
+            this.ctxStartIM.Name = "ctxStartIM";
+            this.ctxStartIM.Size = new System.Drawing.Size(157, 22);
+            this.ctxStartIM.Text = "Start IM";
+            this.ctxStartIM.ToolTipText = " Start IM ";
+            this.ctxStartIM.Click += new System.EventHandler(this.ctxStartIM_Click);
+            // 
+            // ctxOfferTP
+            // 
+            this.ctxOfferTP.Name = "ctxOfferTP";
+            this.ctxOfferTP.Size = new System.Drawing.Size(157, 22);
+            this.ctxOfferTP.Text = "Offer Teleport";
+            this.ctxOfferTP.ToolTipText = " Offer Teleport ";
+            this.ctxOfferTP.Click += new System.EventHandler(this.ctxOfferTP_Click);
+            // 
+            // ctxReqestLure
+            // 
+            this.ctxReqestLure.Name = "ctxReqestLure";
+            this.ctxReqestLure.Size = new System.Drawing.Size(157, 22);
+            this.ctxReqestLure.Text = "Request Teleport";
+            this.ctxReqestLure.ToolTipText = " Request Teleport ";
+            this.ctxReqestLure.Click += new System.EventHandler(this.ctxReqestLure_Click);
+            // 
+            // ctxEject
+            // 
+            this.ctxEject.Name = "ctxEject";
+            this.ctxEject.Size = new System.Drawing.Size(157, 22);
+            this.ctxEject.Text = "Eject";
+            this.ctxEject.ToolTipText = " Eject ";
+            this.ctxEject.Click += new System.EventHandler(this.ctxEject_Click);
+            // 
+            // ctxBan
+            // 
+            this.ctxBan.Name = "ctxBan";
+            this.ctxBan.Size = new System.Drawing.Size(157, 22);
+            this.ctxBan.Text = "Ban";
+            this.ctxBan.ToolTipText = " Ban ";
+            this.ctxBan.Visible = false;
+            this.ctxBan.Click += new System.EventHandler(this.ctxBan_Click);
+            // 
+            // ctxMute
+            // 
+            this.ctxMute.Name = "ctxMute";
+            this.ctxMute.Size = new System.Drawing.Size(157, 22);
+            this.ctxMute.Text = "Mute";
+            this.ctxMute.ToolTipText = " Mute ";
+            this.ctxMute.Click += new System.EventHandler(this.ctxMute_Click);
+            // 
             // btnShow
             // 
             this.btnShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@@ -177,6 +270,7 @@ namespace Radegast
             this.chatSplit.Panel1.ResumeLayout(false);
             this.chatSplit.Panel2.ResumeLayout(false);
             this.chatSplit.ResumeLayout(false);
+            this.avatarContext.ResumeLayout(false);
             this.pnlChatInput.ResumeLayout(false);
             this.pnlChatInput.PerformLayout();
             this.ResumeLayout(false);
@@ -192,6 +286,15 @@ namespace Radegast
         public ListViewNoFlicker Participants;
         public System.Windows.Forms.Button btnShow;
         private System.Windows.Forms.Panel pnlChatInput;
+        public RadegastContextMenuStrip avatarContext;
+        public System.Windows.Forms.ToolStripMenuItem ctxProfile;
+        public System.Windows.Forms.ToolStripMenuItem ctxPay;
+        public System.Windows.Forms.ToolStripMenuItem ctxStartIM;
+        private System.Windows.Forms.ToolStripMenuItem ctxOfferTP;
+        private System.Windows.Forms.ToolStripMenuItem ctxReqestLure;
+        private System.Windows.Forms.ToolStripMenuItem ctxEject;
+        private System.Windows.Forms.ToolStripMenuItem ctxBan;
+        private System.Windows.Forms.ToolStripMenuItem ctxMute;
 
     }
 }
index 2ed2a07..95f5f28 100644 (file)
@@ -210,7 +210,9 @@ namespace Radegast
                             ChatSessionMember participant = members[i];
                             ListViewItem item = new ListViewItem();
                             item.Name = participant.AvatarKey.ToString();
-                            item.Text = instance.Names.Get(participant.AvatarKey); 
+                            item.Text = instance.Names.Get(participant.AvatarKey);
+                            item.Tag = participant.AvatarKey;
+
                             if (participant.IsModerator)
                                 item.Font = new Font(item.Font, FontStyle.Bold);
                             Participants.Items.Add(item);
@@ -454,5 +456,98 @@ namespace Radegast
         {
             pnlChatInput.Height = cbxInput.Height + 7;
         }
+
+        private void avatarContext_Opening(object sender, System.ComponentModel.CancelEventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1)
+            {
+                e.Cancel = true;
+                return;
+            }
+
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+
+            if (av == client.Self.AgentID)
+            {
+                ctxMute.Enabled = ctxPay.Enabled = ctxStartIM.Enabled = false;
+            }
+            else
+            {
+                ctxMute.Enabled = ctxPay.Enabled = ctxStartIM.Enabled = true;
+
+                bool isMuted = client.Self.MuteList.Find(me => me.Type == MuteType.Resident && me.ID == av) != null;
+                ctxMute.Text = isMuted ? "Unmute" : "Mute";
+            }
+        }
+
+        private void ctxProfile_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            string name = instance.Names.Get(av);
+
+            instance.MainForm.ShowAgentProfile(name, av);
+        }
+
+        private void ctxPay_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            string name = instance.Names.Get(av);
+
+            new frmPay(instance, av, name, false).ShowDialog();
+        }
+
+        private void ctxStartIM_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            string name = instance.Names.Get(av);
+
+            instance.TabConsole.ShowIMTab(av, name, true);
+        }
+
+        private void ctxOfferTP_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            client.Self.SendTeleportLure(av, "Join me in " + client.Network.CurrentSim.Name + "!");
+        }
+
+        private void ctxReqestLure_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            instance.MainForm.AddNotification(new ntfSendLureRequest(instance, av));
+        }
+
+        private void ctxEject_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            instance.Client.Groups.EjectUser(session, av);
+        }
+
+        private void ctxBan_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+        }
+
+        private void ctxMute_Click(object sender, EventArgs e)
+        {
+            if (Participants.SelectedItems.Count != 1) return;
+            UUID av = (UUID)Participants.SelectedItems[0].Tag;
+            if (av == client.Self.AgentID) return;
+
+            if (ctxMute.Text == "Mute")
+            {
+                client.Self.UpdateMuteListEntry(MuteType.Resident, av, instance.Names.GetLegacyName(av));
+            }
+            else
+            {
+                client.Self.RemoveMuteListEntry(av, instance.Names.GetLegacyName(av));
+            }
+        }
     }
 }