Exemplo n.º 1
0
/* Glue */
static void
f_smtp_version(INT32 args)
{
    char   buf[256];
    
    if (args != 0)
        generic_error("version", Pike_sp-args, args,
                      "Too many arguments. None required.\n");

    if (!smtp_version(buf, sizeof(buf), 0))
        generic_error("version", Pike_sp, args,
                      "libesmtp: 'smtp_version' returned 'buffer too small' - "
                      "please report it to [email protected]\n");

    pop_n_elems(args);
    push_string(make_shared_string(buf));
}
Exemplo n.º 2
0
static int smtp_register(void)
{
    char version[256];

    /* Server stuff */
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "server",
                              "SMTP server name or IP address",
                              false, false,
                              mca_notifier_smtp_component.server,
                              &mca_notifier_smtp_component.server);
    mca_base_param_reg_int(&mca_notifier_smtp_component.super.base_version,
                           "port",
                           "SMTP server port",
                           false, false, 
                           mca_notifier_smtp_component.port,
                           &mca_notifier_smtp_component.port);

    /* Email stuff */
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "to",
                              "Comma-delimited list of email addresses to send to",
                              false, false,
                              mca_notifier_smtp_component.to,
                              &mca_notifier_smtp_component.to);
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "from_addr",
                              "Email address that messages will be from",
                              false, false,
                              mca_notifier_smtp_component.from_addr,
                              &mca_notifier_smtp_component.from_addr);
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "from_name",
                              "Email name that messages will be from",
                              false, false,
                              mca_notifier_smtp_component.from_name,
                              &mca_notifier_smtp_component.from_name);
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "subject",
                              "Email subject",
                              false, false,
                              mca_notifier_smtp_component.subject,
                              &mca_notifier_smtp_component.subject);

    /* Mail body prefix and suffix */
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "body_prefix",
                              "Text to put at the beginning of the mail message",
                              false, false,
                              mca_notifier_smtp_component.body_prefix,
                              &mca_notifier_smtp_component.body_prefix);
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "body_suffix",
                              "Text to put at the beginning of the mail message",
                              false, false,
                              mca_notifier_smtp_component.body_suffix,
                              &mca_notifier_smtp_component.body_suffix);

    /* Priority */
    mca_base_param_reg_int(&mca_notifier_smtp_component.super.base_version,
                           "priority",
                           "Priority of this component",
                           false, false, 
                           mca_notifier_smtp_component.priority,
                           &mca_notifier_smtp_component.priority);

    /* Libesmtp version */
    smtp_version(version, sizeof(version), 0);
    version[sizeof(version) - 1] = '\0';
    mca_base_param_reg_string(&mca_notifier_smtp_component.super.base_version,
                              "libesmtp_version",
                              "Version of libesmtp that this component is linked against",
                              false, true, version, NULL);

    return ORTE_SUCCESS;
}
Exemplo n.º 3
0
static int smtp_register(void)
{
    char version[256];

    /* Server stuff */
    mca_notifier_smtp_component.server = strdup("localhost");
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "server",
                                           "SMTP server name or IP address",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.server);

    mca_notifier_smtp_component.port = 25;
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "port",
                                           "SMTP server port",
                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.port);

    /* Email stuff */
    mca_notifier_smtp_component.to = NULL;
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "to",
                                           "Comma-delimited list of email addresses to send to",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.to);
    mca_notifier_smtp_component.from_addr = NULL;
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "from_addr",
                                           "Email address that messages will be from",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.from_addr);
    mca_notifier_smtp_component.from_name = strdup("ORTE Notifier");
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "from_name",
                                           "Email name that messages will be from",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.from_name);
    mca_notifier_smtp_component.subject = strdup("ORTE Notifier");
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "subject",
                                           "Email subject",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.subject);

    /* Mail body prefix and suffix */
    mca_notifier_smtp_component.body_prefix = strdup("The ORTE SMTP notifier wishes to inform you of the following message:\n\n");
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "body_prefix",
                                           "Text to put at the beginning of the mail message",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.body_prefix);
    mca_notifier_smtp_component.body_suffix = strdup("\n\nSincerely,\nOscar the ORTE Owl");
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "body_prefix",
                                           "Text to put at the end of the mail message",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.body_suffix);

    /* Priority */
    mca_notifier_smtp_component.priority = 10;
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "priority",
                                           "Priority of this component",
                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.priority);
    /* Libesmtp version */
    smtp_version(version, sizeof(version), 0);
    version[sizeof(version) - 1] = '\0';
    mca_notifier_smtp_component.version = strdup(version);
    (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "libesmtp_version",
                                           "Version of libesmtp that this component is linked against",
                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
                                           OPAL_INFO_LVL_9,
                                           MCA_BASE_VAR_SCOPE_READONLY,
                                           &mca_notifier_smtp_component.version);

    return ORTE_SUCCESS;
}