예제 #1
0
        public Message(MB_Message messageRecord) : this()
        {
            if (messageRecord == null)
            {
                return;
            }
            Sender   = messageRecord.Sender;
            Incoming = messageRecord.IsIncoming;
            try
            {
                LocalTimestamp = long.Parse(messageRecord.LocalTimestamp);
            }
            finally
            {
            }
            Body = messageRecord.Body;
            if (messageRecord.Recepients != null)
            {
                foreach (var recipient in messageRecord.Recepients.@string)
                {
                    Recipients.AddRecipient(recipient);
                }
            }

            if (messageRecord.Attachments != null)
            {
                foreach (var attachment in messageRecord.Attachments)
                {
                    Attachments.Add(new MessageAttachment(attachment));
                }
            }
        }
예제 #2
0
 public static void FillDefaultSender(this MB_Message message, string defaultSender)
 {
     if (message != null)
     {
         if (!string.IsNullOrEmpty(message.Sender))
         {
             if (!string.IsNullOrEmpty(message.Sender.Trim()))
             {
                 return;
             }
         }
         message.Sender = defaultSender;
     }
 }
예제 #3
0
        public void SenderList()
        {
            var m = new MB_Message();

            m.Sender = "";
            m.FillDefaultSender("Thomas");
            Assert.AreEqual("Thomas", m.Sender);

            m.Sender = " ";
            m.FillDefaultSender("Thomas");
            Assert.AreEqual("Thomas", m.Sender);

            m.Sender = "Reed";
            m.FillDefaultSender("Thomas");
            Assert.AreEqual("Reed", m.Sender);
        }