本文整理匯總了C#中agsXMPP.protocol.client.Message.HasTag方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.HasTag方法的具體用法?C# Message.HasTag怎麽用?C# Message.HasTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類agsXMPP.protocol.client.Message
的用法示例。
在下文中一共展示了Message.HasTag方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: IsContentMessage
public static bool IsContentMessage(Message msg)
{
//A "content message" -- that is, a message stanza whose primary meaning is contained in
//standard messaging content such as the XMPP <body/> or any other properly-namespaced child
//element(s) other than those defined for chat state notifications in this specification.
return !string.IsNullOrEmpty(msg.Body) || msg.HasTag(XamlBody.TAG);
}
示例2: OnMessage
/// <summary>
/// Handle incomming messages
/// </summary>
/// <param name="sender"></param>
/// <param name="message"></param>
private void OnMessage(object sender, Message message)
{
if (!message.HasTag("event"))
{
return;
}
// Check for the activity changed data, see here: https://github.com/swissmanu/harmonyhubjs-client/blob/master/docs/protocol/startActivityFinished.md
var eventElement = message.SelectSingleElement("event");
var eventData = eventElement.GetData();
if (eventData == null)
{
return;
}
foreach (var pair in eventData.Split(':'))
{
if (!pair.StartsWith("activityId"))
{
continue;
}
var activityId = pair.Split('=')[1];
OnActivityChanged?.Invoke(this, activityId);
}
}
示例3: receivedMessageDispatcher
/// <summary>
/// This method will parse incoming messages and call specific handlers.
/// </summary>
/// <param name="sender">The sender of the message</param>
/// <param name="message">The messsage that was received</param>
private void receivedMessageDispatcher(Object sender, Message message)
{
//check whether the message is an invitation to join a chatroom and invoke the strategy
if (message.HasTag("invite", true))
{
chatroom = message.From;
MucManager manager = new MucManager(connection);
//Wait for 3 seconds
System.Threading.Thread.Sleep(3000);
manager.JoinRoom(chatroom, nickname, false);
decisionStrategy.OnJoiningGame(chatroom.ToString());
}
else
{
if (message.Body != null)
{
decisionStrategy.OnMessageReceived(message);
}
}
}