Exemplo n.º 1
0
        private void OnChatMessageReceived(XmppMessage message)
        {
            XmppChat chat = null;

            if (String.IsNullOrEmpty(message.Body) &&
                !chats.ContainsKey(message.From.BareIdentifier))
            {
            }
            else
            {
                if (!chats.ContainsKey(message.From.BareIdentifier))
                {
                    chat = CreateChat(message.From);
                }
                else
                {
                    chat = chats[message.From.BareIdentifier];
                }

                messageReceivedSubject.OnNext(message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Creates the chat.
        /// </summary>
        /// <param name = "contactId">The contact id.</param>
        /// <returns></returns>
        public XmppChat CreateChat(XmppJid contactId)
        {
            CheckSessionState();

            XmppChat chat = null;

            lock (syncObject)
            {
                if (!chats.ContainsKey(contactId.BareIdentifier))
                {
                    chat = new XmppChat(this, Roster[contactId.BareIdentifier]);
                    chats.Add(contactId.BareIdentifier, chat);

                    chat.ChatClosed += OnChatClosed;
                }
                else
                {
                    chat = chats[contactId.BareIdentifier];
                }
            }

            return(chat);
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Creates the chat.
        /// </summary>
        /// <param name = "contactId">The contact id.</param>
        /// <returns></returns>
        public XmppChat CreateChat(XmppJid contactId)
        {
            CheckSessionState();

            XmppChat chat = null;

            lock (syncObject)
            {
                if (!chats.ContainsKey(contactId.BareIdentifier))
                {
                    chat = new XmppChat(this, Roster[contactId.BareIdentifier]);
                    chats.Add(contactId.BareIdentifier, chat);

                    chat.ChatClosed += OnChatClosed;
                }
                else
                {
                    chat = chats[contactId.BareIdentifier];
                }
            }

            return chat;
        }