Commit 48cdb820 48cdb82036a77da6d594f4a03018937198586773 by Sergey Poznyakoff

(mh_decode_rcpt_flag,builtin_rcpt): New functions.

1 parent b9330033
...@@ -1613,6 +1613,33 @@ builtin_unre (struct mh_machine *mach) ...@@ -1613,6 +1613,33 @@ builtin_unre (struct mh_machine *mach)
1613 } 1613 }
1614 } 1614 }
1615 1615
1616 int
1617 mh_decode_rcpt_flag (const char *arg)
1618 {
1619 if (strcmp (arg, "to") == 0)
1620 return RCPT_TO;
1621 else if (strcmp (arg, "cc") == 0)
1622 return RCPT_CC;
1623 else if (strcmp (arg, "me") == 0)
1624 return RCPT_ME;
1625 else if (strcmp (arg, "all") == 0)
1626 return RCPT_ALL;
1627
1628 return RCPT_NONE;
1629 }
1630
1631 static void
1632 builtin_rcpt (struct mh_machine *mach)
1633 {
1634 int rc = mh_decode_rcpt_flag (strobj_ptr (&mach->arg_str));
1635 if (rc == RCPT_NONE)
1636 {
1637 mh_error (_("Invalid recipient mask"));
1638 /* try to continue anyway */
1639 }
1640 mach->arg_num = rc & rcpt_mask;
1641 }
1642
1616 /* Builtin function table */ 1643 /* Builtin function table */
1617 1644
1618 mh_builtin_t builtin_tab[] = { 1645 mh_builtin_t builtin_tab[] = {
...@@ -1689,6 +1716,7 @@ mh_builtin_t builtin_tab[] = { ...@@ -1689,6 +1716,7 @@ mh_builtin_t builtin_tab[] = {
1689 { "formataddr", builtin_formataddr, mhtype_none, mhtype_str, 1 }, 1716 { "formataddr", builtin_formataddr, mhtype_none, mhtype_str, 1 },
1690 { "putaddr", builtin_putaddr, mhtype_none, mhtype_str }, 1717 { "putaddr", builtin_putaddr, mhtype_none, mhtype_str },
1691 { "unre", builtin_unre, mhtype_str, mhtype_str }, 1718 { "unre", builtin_unre, mhtype_str, mhtype_str },
1719 { "rcpt", builtin_rcpt, mhtype_num, mhtype_str },
1692 { 0 } 1720 { 0 }
1693 }; 1721 };
1694 1722
......