43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using S22.Xmpp;
|
|
using S22.Xmpp.Client;
|
|
using S22.Xmpp.Im;
|
|
|
|
namespace RhinoReminds
|
|
{
|
|
public class SimpleXmppClient : XmppClient
|
|
{
|
|
public SimpleXmppClient(Jid user, string password) : base(user.Domain, user.Node, password)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sends a chat message to the specified JID.
|
|
/// </summary>
|
|
/// <param name="to">The JID to send the message to.</param>
|
|
/// <param name="message">The messaage to send.</param>
|
|
public void SendChatMessage(Jid to, string message)
|
|
{
|
|
//Console.WriteLine($"[Rhino/Send/Chat] Sending {message} -> {to}");
|
|
SendMessage(
|
|
to, message,
|
|
null, null, MessageType.Chat
|
|
);
|
|
}
|
|
/// <summary>
|
|
/// Sends a chat message in direct reply to a given incoming message.
|
|
/// </summary>
|
|
/// <param name="originalMessage">Original message.</param>
|
|
/// <param name="reply">Reply.</param>
|
|
public void SendChatReply(Message originalMessage, string reply)
|
|
{
|
|
//Console.WriteLine($"[Rhino/Send/Reply] Sending {reply} -> {originalMessage.From}");
|
|
SendMessage(
|
|
originalMessage.From, reply,
|
|
null, originalMessage.Thread, MessageType.Chat
|
|
);
|
|
}
|
|
|
|
}
|
|
}
|