Exemple #1
0
        /// <summary>Starts a new real-time message for a specific user</summary>
        /// <param name="user">User who started typing</param>
        /// <returns>A new, rael time decoder</returns>
        public RealTimeMessage NewRealTimeMessage(XmlDocument doc, jabber.JID jid, Color colorValue)
        {
            RealTimeMessage rtt = new RealTimeMessage(jid, colorValue);

            chatRealTime[(string)jid] = rtt;
            rtt.Decoder = new RealTimeText.Decoder(doc);
            return(rtt);
        }
Exemple #2
0
        /// <summary>Clears the real time message of specified JID or full JID</summary>
        /// <param name="jid">JID of user</param>
        public void RemoveRealTimeMessage(jabber.JID jid)
        {
            RealTimeMessage rttMessage = (RealTimeMessage)chatRealTime[(string)jid];

            if (rttMessage != null)
            {
                rttMessage.Decoder.Dispose();
                chatRealTime.Remove((string)jid);
            }
        }
Exemple #3
0
        /// <summary>Process the contents of an XMPP message</summary>
        public void HandleMessage(jabber.protocol.client.Message msg)
        {
            //Console.WriteLine(msg.OuterXml.ToString());
            if (rttEnabled)
            {
                // Did we receive a <rtt> element?
                XmlElement rttBlock = (XmlElement)msg["rtt"];
                if (rttBlock != null)
                {
                    // Create a new real time mesage if not already created
                    RealTimeMessage rttMessage = m_chat.GetRealTimeMessage(msg.From.Bare);
                    if (rttMessage == null)
                    {
                        rttMessage = m_chat.NewRealTimeMessage(_jabberClient.Document, (string)msg.From.Bare, Color.DarkBlue);
                        rttMessage.Decoder.TextUpdated      += new RealTimeText.Decoder.TextUpdatedHandler(decoder_TextDecoded);
                        rttMessage.Decoder.SyncStateChanged += new RealTimeText.Decoder.SyncStateChangedHandler(decoder_SyncStateChanged);
                    }
                    // Process <rtt> element
                    rttMessage.Decoder.Decode(rttBlock);

                    // Highlight frozen text differently (stalled due to missing message)
                    rttMessage.Color = rttMessage.Decoder.InSync ? Color.DarkBlue : Color.LightGray;

                    // If key press intervals are disabled, decode immediately
                    if (!encoderRTT.KeyIntervalsEnabled)
                    {
                        rttMessage.Decoder.FullDecodeNow();
                        UpdateConversationWindow();
                    }
                }
            }

            if (msg.Body != null)
            {
                // Completed line of text
                AppendConversation(msg.From.Bare, msg.Body, Color.DarkBlue);
            }
        }
Exemple #4
0
 /// <summary>Starts a new real-time message for a specific user</summary>
 /// <param name="user">User who started typing</param>
 /// <returns>A new, rael time decoder</returns>
 public RealTimeMessage NewRealTimeMessage(XmlDocument doc, jabber.JID jid, Color colorValue)
 {
     RealTimeMessage rtt = new RealTimeMessage(jid, colorValue);
     chatRealTime[(string)jid] = rtt;
     rtt.Decoder = new RealTimeText.Decoder(doc);
     return rtt;
 }