Ejemplo n.º 1
0
        /// 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);
                }
            }
        }
Ejemplo n.º 2
0
 public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, string description, bool hubReply)
 {
     Sender      = sender;
     Message     = msg;
     Status      = condition;
     IsHubReply  = hubReply;
     Description = description;
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 /// <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);
 }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
 public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, bool hubReply) :
     this(sender, msg, condition, string.Empty, hubReply)
 {
 }
Ejemplo n.º 7
0
 public MessageStatus(INyxNode sender, INyxMessage msg, MessageCondition condition, string description) :
     this(sender, msg, condition, description, false)
 {
 }