本文整理匯總了C#中agsXMPP.protocol.client.Message.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.ToString方法的具體用法?C# Message.ToString怎麽用?C# Message.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類agsXMPP.protocol.client.Message
的用法示例。
在下文中一共展示了Message.ToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnErrorMessagedReceived
private void OnErrorMessagedReceived(object sender, Message msg)
{
Console.WriteLine(msg.ToString());
}
示例2: OnMessage
private void OnMessage(object sender, Message msg)
{
Parallel.ForEach(this.observers, o =>
{
try
{
if (msg.Type == MessageType.chat || msg.Type == MessageType.groupchat)
{
// TODO: XMPP can send all sorts of messages, gotta filter them out
if (msg.Body != null)
{
o.OnNext(
new MessageData(
// TODO: should we reply to the bare address all the time?
replyTo: msg.Type == MessageType.groupchat ? msg.From.ToJid().Bare : msg.From.ToJid(),
senderAddress: msg.From.ToJid(),
senderName: msg.Type == MessageType.groupchat ? msg.From.Resource : msg.From.User, // TODO: better way to do this...
body: msg.Body,
// TODO: is there a better way to check for this?
isFromMyself: msg.Type == MessageType.groupchat ? String.Equals(msg.From.Resource, this.config.Name, StringComparison.OrdinalIgnoreCase) : string.Equals(msg.From.Bare, this.config.Jid.Bare),
isHistorical: msg.XDelay != null,
isPrivate: msg.Type != MessageType.groupchat
)
);
}
else
{
// TODO: e.g. subject message
Console.Error.WriteLine("Message with null body");
Console.Error.WriteLine(msg.ToString());
}
}
else
{
// TODO: need to handle the other types
}
}
catch (Exception e)
{ // TODO: AgsXmppBackend: Handle observer errors
Console.Error.WriteLineAsync(e.ToString());
}
});
}