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,
	IDictionary<string, string> bodies,
	IDictionary<string, string> subjects = null,
	string thread = null,
	MessageType type = MessageType.Normal,
	CultureInfo language = null
)

Parameters

to
Type: S22.Xmpp..::..Jid
The JID of the intended recipient.
bodies
Type: System.Collections.Generic..::..IDictionary<(Of <(<'String, String>)>)>
A dictionary of message bodies. The dictionary keys denote the languages of the message bodies and must be valid ISO 2 letter language codes.
subjects (Optional)
Type: System.Collections.Generic..::..IDictionary<(Of <(<'String, String>)>)>
A dictionary of message subjects. The dictionary keys denote the languages of the message subjects and must be valid ISO 2 letter language codes.
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.

Remarks

An XMPP chat-message may contain multiple subjects and bodies in different languages. Use this method in order to send a message that contains copies of the message content in several distinct languages.

Examples

This example demonstrates how to use the SendMessage method in order to send a multi-language 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();

  cl.SendMessage(juliet, new Dictionary<string, string>() {
    { "en", "Hi, how are you?" },
    { "dk", "Hej, hvordan har du det?" },
    { "de", "Hallo, wie geht es dir?" },
    { "jp", "お元気ですか?" }
  });
}

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionThe to parameter or the bodies parameter is null.
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