Exemple #1
0
        public bool AddReciveredMessage(IMORZEContact from, MORZEMessage msg)
        {
            bool          bres = false;
            MORZEMessages msgs = GetMessages(from);

            if (msgs != null)
            {
                msgs.AddRecivedMessages(msg);
            }
            return(bres);
        }
Exemple #2
0
        public bool SetDeliveredMessage(IMORZEContact from, SMSHash hashid, byte [] hash)
        {
            bool          bres = false;
            MORZEMessages msgs = GetMessages(from);

            if (msgs != null)
            {
                msgs.SetDeliveredMessage(hashid, hash);
            }
            return(bres);
        }
Exemple #3
0
        public List <MORZEMessage> GetUnsendedNewMessages(IMORZEContact contact, TimeSpan interval)
        {
            List <MORZEMessage> lmsg = null;

            Monitor.Enter(this);

            MORZEMessages msgs = null;

            if (m_Messages != null)
            {
                msgs = m_Messages.Where(x => x.ContactAddress == contact.GetAddress()).FirstOrDefault();
                if (msgs != null)
                {
                    lmsg = msgs.Messages.Where(x => x.Status == MORZEMessageStatus.unsendedNew || (x.Status == MORZEMessageStatus.sended && x.Date + interval < DateTime.Now)).ToList();
                }
            }
            Monitor.Exit(this);

            return(lmsg);
        }
Exemple #4
0
        public List <MORZEMessages> GetSendedAndUncofirmedMessages(TimeSpan interval)
        {
            List <MORZEMessages> msgssended = null;

            foreach (MORZEMessages msg in m_Messages)
            {
                MORZEMessages ms;
                List <MORZEMessage>
                msgs = msg.Messages.Where(x => x.Status == MORZEMessageStatus.sended && x.Date + interval < DateTime.Now).ToList();
                if (msgs != null && msgs.Any() == true)
                {
                    if (msgssended == null)
                    {
                        msgssended = new List <MORZEMessages>();
                    }
                    ms = new MORZEMessages(msg.ContactAddress);
                    ms.Messages.AddRange(msgs);
                    msgssended.Add(ms);
                }
            }
            return(msgssended);
        }
Exemple #5
0
        public MORZEMessages GetMessages(IMORZEContact contact)
        {
            Monitor.Enter(this);

            MORZEMessages msgs = null;

            if (m_Messages == null)
            {
                m_Messages = new List <MORZEMessages>();
            }
            else
            {
                msgs = m_Messages.Where(x => x.ContactAddress == contact.GetAddress()).FirstOrDefault();
            }
            if (msgs == null)
            {
                msgs = new MORZEMessages(contact);
                m_Messages.Add(msgs);
            }
            Monitor.Exit(this);

            return(msgs);
        }