Sends a chat message with the specified content to the specified JID.

Namespace: S22.Xmpp.Client
Assembly: S22.Xmpp (in S22.Xmpp.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public void SendMessage(
	Jid to,
	string body,
	string subject = null,
	string thread = null,
	MessageType type = MessageType.Normal,
	CultureInfo language = null
)

Parameters

to
Type: S22.Xmpp..::..Jid
The JID of the intended recipient.
body
Type: System..::..String
The content of the message.
subject (Optional)
Type: System..::..String
The subject of the message.
thread (Optional)
Type: System..::..String
The conversation thread the message belongs to.
type (Optional)
Type: S22.Xmpp.Im..::..MessageType
The type of the message. Can be one of the values from the MessagType enumeration.
language (Optional)
Type: System.Globalization..::..CultureInfo
The language of the XML character data of the stanza.

Examples

This example demonstrates how to use the SendMessage method in order to send a chat-message to a contact.
CopyC#
  string hostname = "jabber.se",
    username = "myUsername",
    password = "myPassword";
  Jid juliet = "juliet@capulet.com/balcony";

  using (var cl = new XmppClient(hostname, username, password)) {
    cl.Connect();

    while(true) {
      Console.Write("Type a message or type 'quit' to exit: ");
      string s = Console.ReadLine();
      if(s == "quit")
        return;
      // Send the message to Juliet.
      cl.SendMessage(juliet, s);
    }
}

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionThe to parameter or the body parameter is null.
System..::..ArgumentExceptionThe body parameter is the empty string.
System.IO..::..IOExceptionThere was a failure while writing to or reading from the network.
System..::..InvalidOperationExceptionThe XmppClient instance is not connected to a remote host, or the XmppClient instance has not authenticated with the XMPP server.
System..::..ObjectDisposedExceptionThe XmppClient object has been disposed.

See Also