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()); }
private void StoreOffline(Message message, IOfflineStore offlineStore) { if ((message.Type == MessageType.normal || message.Type == MessageType.chat) && !string.IsNullOrEmpty(message.To.User)) { offlineStore.SaveOfflineMessages(message); } }