Beispiel #1
0
        public void TextShouldBeWritable(string text)
        {
            var message = new XMPPMessage {
                Text = text
            };

            Assert.AreEqual(text, message.Text);
        }
Beispiel #2
0
        public static XMPPMessage toXMPP(Message msg)
        {
            var m = new XMPPMessage();

            m.SetAttributeValue(XNamespace.Get(Namespaces.JabberClient) + "type", "chat");
            m.SetAttributeValue(XNamespace.Get(Namespaces.JabberClient) + "id", msg.MessageID);
            m.SetAttributeValue(XNamespace.Get(Namespaces.JabberClient) + "to", msg.To);
            var body = new XElement(XNamespace.Get(Namespaces.JabberClient) + "body");

            body.Value = msg.Text;
            m.Add(body);
            return(m);
        }
Beispiel #3
0
 public void Send(string xml, string type = null, string id = null, XMPPMessage del = null)
 {
     if (type != null && del != null)
     {
         if (type == "iq")
         {
             iqMethods.Add(id, del);
         }
     }
     Console.ForegroundColor = ConsoleColor.Red;
     //Console.WriteLine (xml);//TODO:
     Console.ForegroundColor = ConsoleColor.White;
     socket.Send(xml);
 }
Beispiel #4
0
        private void Socket_MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            //Console.WriteLine (e.Message);//TODO:
            Console.ForegroundColor = ConsoleColor.White;
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(e.Message);
            XmlElement node = (XmlElement)doc.FirstChild;

            if (messageTypes.ContainsKey(node.Name))
            {
                XMPPMessage msg = messageTypes[node.Name];
                if (msg != null)
                {
                    msg(node);
                }
            }
        }
Beispiel #5
0
 public void Send(string xml,string type=null,string id=null,XMPPMessage del=null)
 {
     if (type != null && del != null) {
         if (type == "iq") {
             iqMethods.Add (id, del);
         }
     }
     Console.ForegroundColor = ConsoleColor.Red;
     //Console.WriteLine (xml);//TODO:
     Console.ForegroundColor = ConsoleColor.White;
     socket.Send (xml);
 }
Beispiel #6
0
 protected void OnMessage(XMPPMessage e)
 {
     Message(this, e);
 }