Example #1
0
        private void ProcessMessage(Message msg)
        {
            if (msg.IsReceipt)
            {
                m_server.IncomingReceipt(msg.Id);
            }
            else
            {
                //if (msg.GetAttributeBool("HANDSHAKE"))
                //{
                //  if (m_server != null)
                //  {
                //    m_clientJid = msg.From;
                //    Console.WriteLine("Received handshake from client: {0}", m_clientJid);
                //    m_server.OnConnect(m_clientJid);
                //  }

                //}

                m_server.IncomingMessage(msg);

                // Send the acknowledgement
                var to = msg.From;
                msg.To   = msg.From;
                msg.From = to;
                msg.DeliveryReceipt(msg.Id);
                Send(msg);
            }
        }
Example #2
0
        private void ProcessMessage(Message msg)
        {
            var to = msg.To;

            // check if the destination of this message is available
            var con = Global.ServerConnections.FirstOrDefault(c => c.Jid.Equals(to, new BareJidComparer()));

            if (con != null)
            {
                // found connection, stamp packet with from and route it.
                msg.From = Jid;
                con.Send(msg);
            }
            else
            {
                // connection not found. Return the message to the sender and stamp it with error
                msg.Type = MessageType.Error;
                msg.To   = Jid;
                msg.From = to;
                msg.Add(new Matrix.Xmpp.Client.Error(Matrix.Xmpp.Base.ErrorCondition.ServiceUnavailable));
                Send(msg);
            }
        }
Example #3
0
 internal void IncomingMessage(Message msg)
 {
     m_msgClient.IncomingMessage(msg);
 }