예제 #1
0
        public void UpdateSubscriber(ChatMember subscriber)
        {
            if(subscriber == null)
            {
                if(Log.IsWarnEnabled)
                {
                    Log.WarnFormat("Attempted to update a null subscriber.");
                }
                return;
            }

            UpdateInMemoryCollection(subscriber);
            UpdateChatMemberInDataStore(subscriber);
        }
예제 #2
0
 void UpdateInMemoryCollection(ChatMember subscriber)
 {
     _subscribers.RemoveAll(x => x.Jid == subscriber.Jid);
     _subscribers.Add(subscriber);
 }
예제 #3
0
 private void SaveSubscriberToDataStore(ChatMember newSub)
 {
     try
     {
         if(_repository != null)
             _repository.Save(newSub);
     }
     catch(Exception)
     {
         if (Log.IsErrorEnabled)
             Log.ErrorFormat("Error saving chat member Jid:{0} Alias:{1} to repository.",newSub.Jid,newSub.Alias);
     }
 }
예제 #4
0
 private void UpdateChatMemberInDataStore(ChatMember subscriber)
 {
     try
     {
         if (_repository != null)
             _repository.Update(subscriber);
     }
     catch (Exception)
     {
         if (Log.IsErrorEnabled)
             Log.ErrorFormat("Error updating chat member Jid:{0} Alias:{1} to repository.", subscriber.Jid, subscriber.Alias);
     }
 }
예제 #5
0
 private void RemoveSubscriberFromDataStore(ChatMember leavingSub)
 {
     try
     {
         if(_repository != null)
             _repository.Delete(leavingSub);
     }
     catch (Exception e)
     {
         if (Log.IsErrorEnabled)
             Log.ErrorFormat("Error saving chat member Jid:{0} Alias:{1} to repository. Exception: {2}", leavingSub.Jid, e.Message);
     }
 }