public void TextShouldBeWritable(string text) { var message = new XMPPMessage { Text = text }; Assert.AreEqual(text, message.Text); }
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); }
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); }
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); } } }
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); }
protected void OnMessage(XMPPMessage e) { Message(this, e); }