/// Starts the SMS interception engine public static void StartPersistentNotification() { if (_interceptor == null) { //Is persistent notification enabled? if (MessageInterceptor.IsApplicationLauncherEnabled(APPLICATION_LAUNCH_ID) == true) { // Persistent notification is enabled _interceptor = new MessageInterceptor(APPLICATION_LAUNCH_ID, true); _interceptor.MessageReceived += evthnd; } else { //Persistent notification is not yet enabled _interceptor = new MessageInterceptor(InterceptionAction.NotifyAndDelete, true); MessageCondition cond = new MessageCondition(); cond.ComparisonType = MessagePropertyComparisonType.StartsWith; cond.Property = MessageProperty.Body; cond.CaseSensitive = true; cond.ComparisonValue = TOKEN; _interceptor.MessageCondition = cond; _interceptor.MessageReceived += evthnd; //Enable persistent notification. _interceptor.EnableApplicationLauncher(APPLICATION_LAUNCH_ID); } } }
public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, string description, bool hubReply) { Sender = sender; Message = msg; Status = condition; IsHubReply = hubReply; Description = description; }
public static bool Verify(this Message message, MessageCondition condition) { var textVerified = VerifyText(message.Text, condition.Text); var imageVerified = VerifyImage(message.Photo, condition.Image); var fileVerified = VerifyFile(message.Document, condition.File); return(textVerified && imageVerified && fileVerified); }
/// <summary> /// 启动短信监听 /// </summary> internal void Start() { msgInterceptor = new MessageInterceptor(); msgInterceptor.InterceptionAction = InterceptionAction.NotifyAndDelete; //InterceptionAction.NotifyAndDelete; MessageCondition msgCondition = new MessageCondition(); msgCondition.ComparisonType = MessagePropertyComparisonType.Contains; msgCondition.Property = MessageProperty.Sender; msgInterceptor.MessageCondition = msgCondition; msgInterceptor.MessageReceived += new MessageInterceptorEventHandler(msgInterceptor_MessageReceived); }
public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, bool hubReply) : this(sender, msg, condition, string.Empty, hubReply) { }
public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, string description) : this(sender, msg, condition, description, false) { }