/// <summary> /// Retrieves a message from the mailbox by unique message ID. /// </summary> /// <param name="uniqueID">The unique ID of the message to retrieve.</param> /// <returns>A <see cref="CmoMessage"/> representing the requested message if found; otherwise, null.</returns> /// <remarks>Retrieving the message will also mark it as "opened".</remarks> public CmoMessage OpenMessage(string uniqueID) { CmoMessage message = CmoMessage.GetMessage(uniqueID); if (message != null) { // BUGFIX #52: Fixed loophole where other campaign users can mark other campaigns' unread messages as "open", by adding a check to see if the candidate ID context matches before opening a message in a mailbox. if (!string.IsNullOrEmpty(this.Username) && message.IsPosted && _electionCycles.Contains(message.ElectionCycle) && string.Equals(message.CandidateID, _candidateID, StringComparison.InvariantCultureIgnoreCase)) { if (message.Open(this.Username)) { return(message); } } } return(null); }
/// <summary> /// Clears a message's follow-up flag. /// </summary> /// <param name="messageID">The ID of the message to unflag for follow-up.</param> /// <returns>true if the message's follow-up flag was cleared successfully; otherwise, false.</returns> public bool ClearFlag(int messageID) { CmoMessage m = CmoMessage.GetMessage(_candidateID, messageID); return(m != null?m.ClearFlag(this.Username) : false); }
/// <summary> /// Unarchives a message. /// </summary> /// <param name="messageID">The ID of the message to unarchive.</param> /// <returns>true if the message was unarchived successfully; otherwise, false.</returns> public bool Unarchive(int messageID) { CmoMessage m = CmoMessage.GetMessage(_candidateID, messageID); return(m != null?m.Unarchive(this.Username) : false); }