public override void HandleCommand(IrcLine line, Nick nick, Channel channel)
        {
            try {
                Seen     seen      = Seen.Fetch(nick);
                DateTime checkTime = DateTime.Now;
                checkTime.AddDays(-7);
                if (seen.FirstSeenAt == DateTime.MinValue || seen.FirstSeenAt > checkTime)
                {
                    conn.SendPrivmsg(nick.Name, String.Format("Sorry, {0}, but you aren't allowed to use the mugshots functions yet. :(", nick.DisplayName));
                    return;
                }

                Mugshot mugshot = Mugshot.Fetch(nick.Account);
                if (mugshot == null)
                {
                    conn.SendPrivmsg(nick.Name, "You don't have a mugshot in the database to clear! :o");
                    return;
                }

                nick.Account.MostRecentNick = nick;

                mugshot.IsDeleted = true;
                mugshot.Save();

                conn.SendPrivmsg(nick.Name, "Your mugshot has been cleared. :(");
            } catch (Exception e) {
                logger.Error(e);
                conn.SendPrivmsg(nick.Name, "Oof… I've got indigestion or something, I can't do that right now. :(");
            }
        }
Exemplo n.º 2
0
        protected void OnRetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            int    index = -1;
            string name  = _fullList[e.ItemIndex];

            if (AddList.Contains(name))
            {
                name = name + " (added)";
            }
            if (RemoveList.Contains(name))
            {
                name = name + " (removed)";
            }

            if (ShowMugshots)
            {
                index = _imageList.Images.IndexOfKey(name);
                if (index < 0)
                {
                    _imageList.Images.Add(name, Mugshot.MugshotForUser(name, false).RealImage);
                }
            }

            e.Item = new ListViewItem("")
            {
                ImageIndex = index
            };
            e.Item.SubItems.Add(new ListViewItem.ListViewSubItem(e.Item, name));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Refresh the Account field from the server. The profile structure specifies
        /// the updated data. Note that some fields may legally be null in the case where
        /// no server side profile has been retrieved. The only field that is guaranteed
        /// not to be null is the username.
        /// </summary>
        /// <param name="profile">A Profile object with the account profile data</param>
        /// <param name="force">Whether to force refresh the mugshot</param>
        private void RefreshAccount(Profile profile, bool force)
        {
            actUsername.Text = CIX.Username;

            Mugshot mugshot = Mugshot.MugshotForUser(profile.Username, force);

            actMugshot.Image = mugshot.RealImage;

            if (force)
            {
                mugshot.Refresh();
            }

            actEmail.Text    = profile.EMailAddress;
            actFullname.Text = profile.FullName;
            actLocation.Text = profile.Location;

            string sexCode = "u";

            if (!string.IsNullOrEmpty(profile.Sex))
            {
                sexCode = profile.Sex.ToLower();
            }
            actSexDontSay.Checked = sexCode == "" || sexCode == "u";
            actSexFemale.Checked  = sexCode == "f";
            actSexMale.Checked    = sexCode == "m";

            actAbout.Text = profile.About;

            actNotifyPM.Checked  = profile.Flags.HasFlag(Profile.NotificationFlags.PMNotification);
            actNotifyTag.Checked = profile.Flags.HasFlag(Profile.NotificationFlags.TagNotification);

            actSave.Enabled = false;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Display the currently set profile
 /// </summary>
 private void DisplayProfile()
 {
     if (_thisProfile == null)
     {
         _profileItem = null;
     }
     else
     {
         if (_profileItem != null)
         {
             _profileItem.Image       = Mugshot.MugshotForUser(_thisProfile.Username, true).RealImage;
             _profileItem.ProfileData = _thisProfile;
         }
         else
         {
             Mugshot mugshot = Mugshot.MugshotForUser(_thisProfile.Username, true);
             _profileItem = new ProfileItem(prvDetails, false)
             {
                 NameColour  = UI.System.SelectionColour,
                 Image       = mugshot.RealImage,
                 Font        = _font,
                 ProfileData = _thisProfile
             };
             mugshot.Refresh();
             prvDetails.Items.Add(_profileItem);
         }
     }
 }
Exemplo n.º 5
0
 /// <inheritdoc />
 public void Dispose()
 {
     Mugshot?.Dispose();
     DownLoadRunning?.Dispose();
     MyPluginDataDic.Dispose();
     LockObject?.Dispose();
 }
Exemplo n.º 6
0
        /// <summary>
        /// Draw the full thread for the selected conversation. The users current scroll position is not altered
        /// unless resetScrollPosition is true in which case we scroll so that the last message is visible.
        ///
        /// Drawing the thread also optionally marks the conversation as read and triggers an update on the server.
        /// </summary>
        /// <param name="conversation">The conversation to draw</param>
        private void ShowMessage(InboxConversation conversation)
        {
            inboxMessagePane.BeginUpdate();
            inboxMessagePane.Items.Clear();
            if (conversation != null)
            {
                InboxItem lastItem = null;

                foreach (InboxMessage message in conversation.Messages)
                {
                    InboxItem item = new InboxItem(inboxMessagePane, lastItem != null)
                    {
                        ID             = message.RemoteID,
                        Image          = Mugshot.MugshotForUser(message.Author, true).RealImage,
                        ItemColour     = SystemColors.Window,
                        FullDateString = _showFullDate,
                        Message        = message,
                        Font           = _bodyFont
                    };
                    inboxMessagePane.Items.Add(item);
                    lastItem = item;
                }
                inboxMessagePane.SelectedItem = lastItem;
            }
            inboxMessagePane.EndUpdate(null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update the mugshot for the given user.
        /// </summary>
        public void Refresh(string username)
        {
            CanvasItemLayout layout = CanvasItemLayout;

            Mugshot mugshot = Mugshot.MugshotForUser(username, true);

            foreach (CanvasImage imageItem in layout.Items.
                     Where(component => component.ID == ActionID.AuthorImage && (string)component.Tag == username).
                     Cast <CanvasImage>())
            {
                imageItem.Image = mugshot.RealImage;
                Invalidate();
                break;
            }
        }
Exemplo n.º 8
0
        private void parList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            int    index = -1;
            string name  = _participants[e.ItemIndex];

            if (_showMugshots)
            {
                index = _imageList.Images.IndexOfKey(name);
                if (index < 0)
                {
                    _imageList.Images.Add(name, Mugshot.MugshotForUser(name, false).RealImage);
                }
            }

            e.Item = new ListViewItem("")
            {
                ImageIndex = index
            };
            e.Item.SubItems.Add(new ListViewItem.ListViewSubItem(e.Item, name));
        }
Exemplo n.º 9
0
 /// <summary>
 /// Synchronise the profile collection, updating any changes to the local
 /// profile and resume that was made offline to the server.
 /// </summary>
 public void Sync()
 {
     try
     {
         Profile selfProfile = Profile.ProfileForUser(CIX.Username);
         if (selfProfile.Pending)
         {
             selfProfile.Sync();
         }
         Mugshot selfMugshot = Mugshot.MugshotForUser(CIX.Username, false);
         if (selfMugshot.Pending)
         {
             selfMugshot.Sync();
         }
     }
     catch (Exception e)
     {
         CIX.ReportServerExceptions("ProfileCollection.Sync", e);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Build the layout for this item.
        /// </summary>
        protected override CanvasItemLayout BuildLayout()
        {
            CanvasItemLayout newLayout = new CanvasItemLayout(this, DrawRectangle);

            if (Items != null)
            {
                // Title
                newLayout.Add(new CanvasText
                {
                    ID         = ActionID.None,
                    ForeColour = UI.System.ForegroundColour,
                    Alignment  = CanvasTextAlign.Top,
                    LineHeight = 30,
                    Font       = UI.GetFont(UI.System.font, 12),
                    Text       = Title
                });
                newLayout.AddNewLine();

                // Iterate and show an image for every profile.
                foreach (string username in Items)
                {
                    newLayout.Add(new CanvasImage
                    {
                        ID          = ActionID.AuthorImage,
                        Image       = Mugshot.MugshotForUser(username, true).RealImage,
                        Text        = username,
                        Font        = UI.GetFont(UI.System.font, 8),
                        Tag         = username,
                        NoWrap      = SingleLine,
                        ForeColour  = UI.System.ForegroundColour,
                        ImageWidth  = 80,
                        ImageHeight = 80
                    });
                }
                newLayout.AddNewLine();
            }
            return(newLayout);
        }
Exemplo n.º 11
0
        public void CopyFrom(CharacterCache objExistingCache)
        {
            Background     = objExistingCache.Background;
            BuildMethod    = objExistingCache.BuildMethod;
            CharacterAlias = objExistingCache.CharacterAlias;
            CharacterName  = objExistingCache.CharacterName;
            CharacterNotes = objExistingCache.CharacterNotes;
            Concept        = objExistingCache.Concept;
            Created        = objExistingCache.Created;
            Description    = objExistingCache.Description;
            Essence        = objExistingCache.Essence;
            GameNotes      = objExistingCache.GameNotes;
            Karma          = objExistingCache.Karma;
            FileName       = objExistingCache.FileName;
            Metatype       = objExistingCache.Metatype;
            Metavariant    = objExistingCache.Metavariant;
            PlayerName     = objExistingCache.PlayerName;
            SettingsFile   = objExistingCache.SettingsFile;

            Image imgNewMugshot = objExistingCache.Mugshot.Clone() as Image;

            Mugshot?.Dispose();
            Mugshot = imgNewMugshot;
        }
Exemplo n.º 12
0
 /// <summary>
 /// Replace the mugshot image with the default image.
 /// </summary>
 /// <param name="sender">The form control</param>
 /// <param name="e">Event arguments</param>
 private void actRemove_Click(object sender, EventArgs e)
 {
     actMugshot.Image = Mugshot.GetDefaultMugshot();
     OnAccountChanged(this, new EventArgs());
 }
Exemplo n.º 13
0
        /// <summary>
        /// Save the account changes and upload to the server
        /// </summary>
        private void SaveAccountChanges()
        {
            actSave.Enabled = false;

            // Resize the image to 100x100 before uploading
            Mugshot mugshot = Mugshot.MugshotForUser(CIX.Username, false);

            mugshot.Update(actMugshot.Image);

            Profile myProfile  = Profile.ProfileForUser(CIX.Username);
            bool    isModified = false;

            string sexCode = "";

            if (actSexMale.Checked)
            {
                sexCode = "M";
            }
            if (actSexFemale.Checked)
            {
                sexCode = "F";
            }
            if (sexCode != myProfile.Sex)
            {
                myProfile.Sex = sexCode;
                isModified    = true;
            }
            if (actEmail.Text != myProfile.EMailAddress)
            {
                myProfile.EMailAddress = actEmail.Text;
                isModified             = true;
            }
            if (actFullname.Text != myProfile.FullName)
            {
                myProfile.FullName = actFullname.Text;
                isModified         = true;
            }
            if (actLocation.Text != myProfile.Location)
            {
                myProfile.Location = actLocation.Text;
                isModified         = true;
            }
            if (actAbout.Text != myProfile.About)
            {
                myProfile.About = actAbout.Text;
                isModified      = true;
            }
            Profile.NotificationFlags flags = 0;
            if (actNotifyPM.Checked)
            {
                flags |= Profile.NotificationFlags.PMNotification;
            }
            if (actNotifyTag.Checked)
            {
                flags |= Profile.NotificationFlags.TagNotification;
            }
            if (flags != myProfile.Flags)
            {
                myProfile.Flags = flags;
                isModified      = true;
            }
            if (isModified)
            {
                myProfile.Update();
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Build the layout for this item from the message.
        /// </summary>
        protected override CanvasItemLayout BuildLayout()
        {
            CanvasItemLayout newLayout = new CanvasItemLayout(this, DrawRectangle);

            newLayout.Add(new CanvasImage
            {
                ImageWidth  = 100,
                ImageHeight = 100,
                Image       = Program.CIXReaderLogo,
                Margin      = new Rectangle(0, 0, 10, 0)
            });

            newLayout.AddNewColumn();

            newLayout.Add(new CanvasText
            {
                Text       = Resources.WelcomeTitle,
                Font       = UI.GetFont(UI.System.font, 20),
                ForeColour = UI.Forums.BodyColour
            });

            newLayout.AddNewLine();

            newLayout.Add(new CanvasHTMLText
            {
                Text       = Resources.WelcomeSubtitle,
                Font       = _font,
                ForeColour = UI.Forums.BodyColour
            });

            newLayout.AddNewLine();

            if (Threads.Count > 0)
            {
                newLayout.Add(new CanvasText
                {
                    Text       = Resources.TopThreads,
                    Font       = _headerFont,
                    ForeColour = UI.Forums.BodyColour,
                    Margin     = new Rectangle(0, 0, 0, 15)
                });

                newLayout.AddNewLine();
            }
            foreach (CIXThread thread in Threads)
            {
                newLayout.AddBeginSection();

                newLayout.Add(new CanvasImage
                {
                    ID          = ActionID.AuthorImage,
                    ImageWidth  = 40,
                    ImageHeight = 40,
                    Tag         = thread.Author,
                    Margin      = new Rectangle(0, 0, 5, 0),
                    Image       = Mugshot.MugshotForUser(thread.Author, true).RealImage
                });

                newLayout.AddNewColumn();

                string bodyText = thread.Body ?? string.Empty;
                newLayout.Add(new CanvasText
                {
                    ID         = ActionID.GoToSource,
                    Text       = bodyText.FirstLine().TruncateByWordWithLimit(80),
                    Font       = _font,
                    Tag        = thread,
                    Alignment  = CanvasTextAlign.Top,
                    LineHeight = _headerLineHeight,
                    ForeColour = UI.Forums.BodyColour
                });

                newLayout.AddNewLine();

                newLayout.Add(new CanvasText
                {
                    ID         = ActionID.AuthorImage,
                    Text       = string.Format(Resources.StartedBy, thread.Author),
                    Font       = _font,
                    Alignment  = CanvasTextAlign.Top,
                    Tag        = thread.Author,
                    LineHeight = _headerLineHeight,
                    ForeColour = UI.Forums.HeaderFooterColour
                });

                AddSeparatorItem(newLayout, _headerLineHeight);

                newLayout.Add(new CanvasText
                {
                    ID         = ActionID.GoToSource,
                    Text       = string.Format("{0}/{1}", thread.Forum, thread.Topic),
                    Font       = _font,
                    Tag        = thread,
                    Alignment  = CanvasTextAlign.Top,
                    LineHeight = _headerLineHeight,
                    Margin     = new Rectangle(0, 0, 0, 15),
                    ForeColour = UI.System.LinkColour
                });

                AddSeparatorItem(newLayout, _headerLineHeight);

                newLayout.Add(new CanvasText
                {
                    Text       = string.Format("posted at {0}", thread.Date.FriendlyString(true)),
                    Font       = _font,
                    Tag        = thread,
                    Alignment  = CanvasTextAlign.Top,
                    LineHeight = _headerLineHeight,
                    Margin     = new Rectangle(0, 0, 0, 15),
                    ForeColour = UI.Forums.HeaderFooterColour
                });

                newLayout.AddEndSection();
            }

            if (OnlineUsers.Users != null)
            {
                newLayout.Add(new CanvasText
                {
                    Text       = Resources.OnlineUsers,
                    Font       = _headerFont,
                    ForeColour = UI.Forums.BodyColour,
                    Margin     = new Rectangle(0, 0, 0, 15)
                });

                newLayout.AddNewLine();

                foreach (OnlineUser user in OnlineUsers.Users)
                {
                    newLayout.Add(new CanvasImage
                    {
                        ID          = ActionID.AuthorImage,
                        Image       = Mugshot.MugshotForUser(user.Name, true).RealImage,
                        Text        = user.Name,
                        Font        = UI.GetFont(UI.System.font, 8),
                        Tag         = user.Name,
                        NoWrap      = true,
                        ForeColour  = UI.System.ForegroundColour,
                        ImageWidth  = 80,
                        ImageHeight = 80
                    });
                }
            }
            return(newLayout);
        }
Exemplo n.º 15
0
        public override void HandleCommand(IrcLine line, Nick nick, Channel channel)
        {
            try {
                Setting largeImageBasePath = Setting.Fetch("Mugshots", "LargeImageBasePath");
                Setting originalBasePath   = Setting.Fetch("Mugshots", "OriginalBasePath");
                Setting thumbnailBasePath  = Setting.Fetch("Mugshots", "ThumbnailBasePath");

                Setting maxLargeHeightSetting = Setting.Fetch("Mugshots", "MaxLargeHeight");
                Setting maxLargeWidthSetting  = Setting.Fetch("Mugshots", "MaxLargeWidth");
                Setting thumbWidthSetting     = Setting.Fetch("Mugshots", "ThumbWidth");
                Setting thumbHeightSetting    = Setting.Fetch("Mugshots", "ThumbHeight");

                if (largeImageBasePath == null)
                {
                    throw new Exception("Mugshots/LargeImageBasePath is missing from Settings table");
                }
                if (originalBasePath == null)
                {
                    throw new Exception("Mugshots/OriginalBasePath is missing from Settings table");
                }
                if (thumbnailBasePath == null)
                {
                    throw new Exception("Mugshots/ThumbnailBasePath is missing from Settings table");
                }

                if (maxLargeHeightSetting == null)
                {
                    throw new Exception("Mugshots/MaxLargeHeight is missing from Settings table");
                }
                if (maxLargeWidthSetting == null)
                {
                    throw new Exception("Mugshots/MaxLargeWidth is missing from Settings table");
                }
                if (thumbWidthSetting == null)
                {
                    throw new Exception("Mugshots/ThumbWidth is missing from Settings table");
                }
                if (thumbHeightSetting == null)
                {
                    throw new Exception("Mugshots/ThumbHeight is missing from Settings table");
                }

                int maxLargeHeight = Int32.Parse(maxLargeHeightSetting.Value);
                int maxLargeWidth  = Int32.Parse(maxLargeWidthSetting.Value);
                int thumbHeight    = Int32.Parse(thumbHeightSetting.Value);
                int thumbWidth     = Int32.Parse(thumbWidthSetting.Value);

                if (maxLargeHeight < 1)
                {
                    throw new Exception("Mugshots/MaxLargeHeight in Settings table must be > 0");
                }
                if (maxLargeWidth < 1)
                {
                    throw new Exception("Mugshots/MaxLargeWidth in Settings table must be > 0");
                }
                if (thumbWidth < 1)
                {
                    throw new Exception("Mugshots/ThumbWidth in Settings table must be > 0");
                }
                if (thumbHeight < 1)
                {
                    throw new Exception("Mugshots/ThumbHeight in Settings table must be > 0");
                }

                if (!Directory.Exists(originalBasePath.Value))
                {
                    throw new Exception($"Directory `{originalBasePath.Value}` does not exist");
                }
                if (!Directory.Exists(largeImageBasePath.Value))
                {
                    throw new Exception($"Directory `{largeImageBasePath.Value}` does not exist");
                }
                if (!Directory.Exists(thumbnailBasePath.Value))
                {
                    throw new Exception($"Directory `{thumbnailBasePath.Value}` does not exist");
                }

                Seen     seen      = Seen.Fetch(nick);
                DateTime checkTime = DateTime.Now;
                checkTime.AddDays(-7);
                if (seen.FirstSeenAt == DateTime.MinValue || seen.FirstSeenAt > checkTime)
                {
                    conn.SendPrivmsg(nick.Name, String.Format("Sorry, {0}, but you aren't allowed to use the mugshots functions yet. :(", nick.DisplayName));
                    return;
                }

                Regex  r        = new Regex(@"^!setmugshot ?");
                string imageUri = r.Replace(line.Args, "").Trim();
                if (imageUri.Length <= 0)   // Whaaaat??
                {
                    conn.SendPrivmsg(nick.Name, "Usage: !setmugshot <image_url_here>");
                    return;
                }

                r = new Regex(@"^https?://.*\.(png|gif|jpe?g)");
                Match m = r.Match(imageUri);
                if (!m.Success)
                {
                    conn.SendPrivmsg(nick.Name, "Usage: !setmugshot <image_url_here> - the image must be a PNG, GIF, or JPEG file.");
                    return;
                }

                r = new Regex(@"^https?://(www.)?dropbox.com/.*\?dl=0");
                m = r.Match(imageUri);
                if (m.Success)
                {
                    imageUri = imageUri.Replace("?dl=0", "?dl=1");
                }

                Image original = GetImageFromUrl(imageUri);
                if (original == null)
                {
                    throw new Exception(String.Format("Unable to get image from URI `{0}`", imageUri));
                }

                float fileRatio = ((float)original.Width) / ((float)original.Height);
                logger.Trace("Got image! {0}x{1}, {2}", original.Width, original.Height, fileRatio);

                float maxRatio = thumbWidth / thumbHeight;
                int   width    = 0;
                int   height   = 0;
                if (fileRatio < maxRatio)
                {
                    height = maxLargeHeight;
                    width  = (int)Math.Ceiling(height * fileRatio);
                }
                else
                {
                    width  = maxLargeWidth;
                    height = (int)Math.Ceiling(width / fileRatio);
                }
                logger.Trace("Calculate resize dimensions: {0}x{1}", width, height);

                var rect  = new Rectangle(0, 0, width, height);
                var image = new Bitmap(width, height);
                try {
                    image.SetResolution(original.HorizontalResolution, original.VerticalResolution);
                } catch (Exception e) {
                    logger.Debug("image.SetResolution failed.");
                    logger.Trace(e);
                }
                using (var graphics = Graphics.FromImage(image))
                {
                    graphics.CompositingMode    = CompositingMode.SourceCopy;
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                    graphics.SmoothingMode      = SmoothingMode.HighQuality;
                    graphics.PixelOffsetMode    = PixelOffsetMode.HighQuality;

                    using (var wrapMode = new ImageAttributes())
                    {
                        wrapMode.SetWrapMode(WrapMode.TileFlipXY);
                        graphics.DrawImage(original, rect, 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, wrapMode);
                    }
                }

                r = new Regex(@"\.([a-z0-9]{3})$");
                string newFileName = r.Replace(Path.GetRandomFileName(), ".png");
                Image  thumb       = original.GetThumbnailFixedSize(thumbWidth, thumbHeight, true);

                ImageCodecInfo info    = GetEncoderInfo("image/png");
                Encoder        encoder = Encoder.Quality;

                EncoderParameters encoderParams = new EncoderParameters(1);
                encoderParams.Param[0] = new EncoderParameter(encoder, 100);

                thumb.Save(Path.Combine(thumbnailBasePath.Value, newFileName), info, encoderParams);
                image.Save(Path.Combine(largeImageBasePath.Value, newFileName), info, encoderParams);
                original.Save(Path.Combine(originalBasePath.Value, newFileName), info, encoderParams);

                nick.Account.MostRecentNick = nick;

                Mugshot mugshot = Mugshot.FetchOrCreate(nick.Account);
                mugshot.FileName         = newFileName;
                mugshot.OriginalImageUri = imageUri;
                mugshot.IsActive         = true;
                mugshot.IsDeleted        = false;
                mugshot.LastModifiedAt   = DateTime.Now;
                mugshot.Save();

                conn.SendPrivmsg(nick.Name, "Your mugshot has been set! :D");
            } catch (SetMugshotException e) {
                logger.Error(e);
                conn.SendPrivmsg(nick.Name, "Sorry, but I was unable to download your mugshot photo from the URL you provided. Please try another URL, or poke TwoWholeWorms if this error continues.");
            } catch (Exception e) {
                logger.Error(e);
                conn.SendPrivmsg(nick.Name, "Oof… I shouldn't have eaten that pie, I can't do that right now. :(");
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Display the message editor window.
        /// </summary>
        private void CIXMessageEditor_Load(object sender, EventArgs e)
        {
            bool   isReply   = _message.CommentID > 0;
            string forumName = string.Empty;
            string topicName = string.Empty;

            Editor = nmMessage;

            // Restore the form width, height and state from the last time it
            // was invoked.
            this.RestoreFromSettings();

            Folder folder = _message.Topic;

            if (folder != null)
            {
                Folder parentFolder = folder.ParentFolder;
                if (parentFolder != null)
                {
                    forumName = parentFolder.Name;
                }
                topicName = folder.Name;
            }

            if (isReply && folder != null)
            {
                string replyName = string.Empty;
                isReply = false;

                CIXMessage parentMessage = folder.Messages.MessageByID(_message.CommentID);
                if (parentMessage != null)
                {
                    replyName = parentMessage.Author;

                    Mugshot mugshot = Mugshot.MugshotForUser(replyName, true);

                    nmReplyImage.Image   = mugshot.RealImage;
                    nmReplyUsername.Text = string.Format(Resources.ReplyEditorTitle, replyName);
                    nmReplyText.Text     = parentMessage.Body;

                    // Make the full body available as a tooltip.
                    nmBodyTooltip.SetToolTip(nmReplyText, parentMessage.Body);

                    isReply = true;
                }

                Text = string.Format(Resources.ReplyTitle, replyName, forumName, topicName);
            }
            else
            {
                Text = string.Format(Resources.NewMessageTitle, forumName, topicName);
            }
            if (!isReply)
            {
                nmReplyPanel.Visible = false;
                nmMessage.Top       -= nmReplyPanel.Height;
                nmMessage.Height    += nmReplyPanel.Height;
            }

            // Load signature list
            ReloadSignaturesList(nmSignatureList);

            // Add any existing message with signature.
            LoadMessage(forumName, _message.Body);

            nmMessage.Font = UI.GetFont(UI.Forums.font, UI.Forums.fontsize);

            _wasPending          = _message.IsPending;
            _message.PostPending = false;

            MessageEditorCollection.Add(this);

            EnableSendButton();
        }