コード例 #1
0
        public void StreamEndHandle(XmppStream stream, ICollection <Node> notSendedBuffer, XmppHandlerContext context)
        {
            if (notSendedBuffer.Count == 0 || string.IsNullOrEmpty(stream.User))
            {
                return;
            }

            var messages = new List <Message>();

            foreach (var node in notSendedBuffer)
            {
                if (node is Presence)
                {
                    var p = (Presence)node;
                    if (p.Type == PresenceType.subscribe || p.Type == PresenceType.subscribed || p.Type == PresenceType.unsubscribe || p.Type == PresenceType.unsubscribed)
                    {
                        offlineStore.SaveOfflinePresence(p);
                    }
                }
                if (node is Message)
                {
                    messages.Add((Message)node);
                }
            }
            offlineStore.SaveOfflineMessages(messages.ToArray());
        }
コード例 #2
0
 private void StoreOffline(Message message, IOfflineStore offlineStore)
 {
     if ((message.Type == MessageType.normal || message.Type == MessageType.chat) && !string.IsNullOrEmpty(message.To.User))
     {
         offlineStore.SaveOfflineMessages(message);
     }
 }
コード例 #3
0
		private void StoreOffline(Message message, IOfflineStore offlineStore)
		{
			if ((message.Type == MessageType.normal || message.Type == MessageType.chat) && !string.IsNullOrEmpty(message.To.User))
			{
				offlineStore.SaveOfflineMessages(message);
			}
		}