internal UserMessageRuleActionBase(UserMessageRuleActionType actionType, UserMessageRule rule, UserMessageRuleActionCollection owner, string id, string description)
 {
     this.m_ActionType  = actionType;
     this.m_pRule       = rule;
     this.m_pOwner      = owner;
     this.m_ID          = id;
     this.m_Description = description;
 }
Пример #2
0
        internal void Add(string actionID, string description, UserMessageRuleActionType type, byte[] actionData, bool addToCollection)
        {
            Guid.NewGuid().ToString();
            SmartStream arg_EE_0 = this.m_pRule.Owner.VirtualServer.Server.TCP_Client.TcpStream;

            string[] array = new string[14];
            array[0]  = "AddUserMessageRuleAction ";
            array[1]  = this.m_pRule.Owner.VirtualServer.VirtualServerID;
            array[2]  = " ";
            array[3]  = TextUtils.QuoteString(this.m_pRule.Owner.Owner.UserID);
            array[4]  = " ";
            array[5]  = TextUtils.QuoteString(this.m_pRule.ID);
            array[6]  = " ";
            array[7]  = TextUtils.QuoteString(actionID);
            array[8]  = " ";
            array[9]  = TextUtils.QuoteString(description);
            array[10] = " ";
            string[] arg_D3_0 = array;
            int      arg_D3_1 = 11;
            int      num      = (int)type;

            arg_D3_0[arg_D3_1] = num.ToString();
            array[12]          = " ";
            array[13]          = Convert.ToBase64String(actionData);
            arg_EE_0.WriteLine(string.Concat(array));
            string text = this.m_pRule.Owner.VirtualServer.Server.ReadLine();

            if (!text.ToUpper().StartsWith("+OK"))
            {
                throw new Exception(text);
            }
            if (addToCollection)
            {
                this.m_pActions.Add(this.GetAction(actionID, description, type, actionData));
            }
        }
Пример #3
0
 private UserMessageRuleActionBase GetAction(string actionID, string description, UserMessageRuleActionType actionType, byte[] actionData)
 {
     if (actionType == UserMessageRuleActionType.AddHeaderField)
     {
         return(new UserMessageRuleAction_AddHeaderField(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.AutoResponse)
     {
         return(new UserMessageRuleAction_AutoResponse(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.DeleteMessage)
     {
         return(new UserMessageRuleAction_DeleteMessage(this.m_pRule, this, actionID, description));
     }
     if (actionType == UserMessageRuleActionType.ExecuteProgram)
     {
         return(new UserMessageRuleAction_ExecuteProgram(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.ForwardToEmail)
     {
         return(new UserMessageRuleAction_ForwardToEmail(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.ForwardToHost)
     {
         return(new UserMessageRuleAction_ForwardToHost(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.MoveToIMAPFolder)
     {
         return(new UserMessageRuleAction_MoveToImapFolder(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.PostToHTTP)
     {
         return(new UserMessageRuleAction_PostToHttp(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.PostToNNTPNewsGroup)
     {
         return(new UserMessageRuleAction_PostToNntpNewsgroup(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.RemoveHeaderField)
     {
         return(new UserMessageRuleAction_RemoveHeaderField(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.StoreToDiskFolder)
     {
         return(new UserMessageRuleAction_StoreToDiskFolder(this.m_pRule, this, actionID, description, actionData));
     }
     if (actionType == UserMessageRuleActionType.StoreToFTPFolder)
     {
         return(new UserMessageRuleAction_StoreToFtp(this.m_pRule, this, actionID, description, actionData));
     }
     throw new Exception("Invalid action type !");
 }