コード例 #1
0
ファイル: ns_resetpass.c プロジェクト: SwiftIRC/services
/**
 * Load the configuration directives from Services configuration file.
 * @return 0 for success
 **/
int mLoadConfig(int argc, char **argv)
{
    int tmpRestrictReset = 0;
    int tmpExpirePassCode = -1;
    int i;

    Directive directivas[] = {
        {"RestrictReset", {{PARAM_SET, PARAM_RELOAD, &tmpRestrictReset}}},
        {"ExpirePassCode", {{PARAM_TIME, PARAM_RELOAD, &tmpExpirePassCode}}},
    };

    for (i = 0; i < 2; i++) {
        Directive *d = &directivas[i];
        moduleGetConfigDirective(d);
    }

    if (tmpRestrictReset == 1)
        RestrictReset = 1;
    else
        RestrictReset = 0;

    if (tmpExpirePassCode != -1) {
        ExpirePassCode = tmpExpirePassCode;
    }

    alog(LOG_CONFIG_LOADED, MYNAME);

    return MOD_CONT;
}
コード例 #2
0
static void my_load_config(void)
{
    int i;
    char *tmp = NULL;

    Directive confvalues[][1] = {
        {{"HSRequestMemoUser",
          {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoUser}}}},
        {{"HSRequestMemoOper",
          {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoOper}}}},
        {{"HSRequestMemoSetters",
          {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoSetters}}}},
        {{"HSRequestDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}}
    };

    for (i = 0; i < 4; i++)
        moduleGetConfigDirective(confvalues[i]);

    if (tmp) {
        if (HSRequestDBName)
            free(HSRequestDBName);
        HSRequestDBName = sstrdup(tmp);
    } else {
        HSRequestDBName = sstrdup(HSREQ_DEFAULT_DBNAME);
    }

    if (debug)
        alog("debug: [hs_request] Set config vars: MemoUser=%d MemoOper=%d MemoSetters=%d DBName='%s'", HSRequestMemoUser, HSRequestMemoOper, HSRequestMemoSetters, HSRequestDBName);
}
コード例 #3
0
ファイル: ns_maxemail.c プロジェクト: dollabi11z/itechnet
void my_load_config(void)
{
    Directive confvalues[] = {
        {"NSEmailMax", {{PARAM_INT, PARAM_RELOAD, &NSEmailMax}}}
    };

    moduleGetConfigDirective(confvalues);

    if (debug)
        alog("debug: [ns_maxemail] NSEmailMax set to %d", NSEmailMax);
}
コード例 #4
0
void load_config(void)
{
	int i = 0;
	Directive confvalues[][1] = {
		{{"AutoOwner", {{PARAM_SET, PARAM_RELOAD, &AutoOwner}}}},
		{{"AutoOwnerLevel", {{PARAM_INT, PARAM_RELOAD, &AutoOwnerLevel}}}}
	};

	for (i = 0; i < 2; i++)
		moduleGetConfigDirective(confvalues[i]);

	if (AutoOwner && (!AutoOwnerLevel || AutoOwnerLevel < 0 || AutoOwnerLevel > 9999)) {
		AutoOwnerLevel = 9999;
	}
}
コード例 #5
0
ファイル: cs_autovoice.c プロジェクト: GeekShed/anope-modules
void mLoadConfig(void)
{
	int i;
    char *tmp = NULL;
    Directive confvalues[][1] = {
		{{"CSAVoiceDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}},
	};
    for (i = 0; i < 1; i++)
		moduleGetConfigDirective(confvalues[i]);
    if (tmp) {
        if (CSAVoiceDBName)
			free(CSAVoiceDBName);
		CSAVoiceDBName = sstrdup(tmp);
    } else {
        CSAVoiceDBName = sstrdup(DEFAULT_DB_NAME);
    }
}
コード例 #6
0
ファイル: ns_qdbban.c プロジェクト: GeekShed/anope-modules
int loadConfParam(char *name, char *defaultVal, char **ptr)
{
	char *tmp = NULL;

	Directive directivas[] = {
		{name, {{PARAM_STRING, PARAM_RELOAD, &tmp}}},
	};

	Directive *d = &directivas[0];
	moduleGetConfigDirective(d);

	if (tmp) {
		*ptr = tmp;
	} else {
		*ptr = sstrdup(defaultVal);
	}

	alog("ns_qdbban: Directive %s loaded (%s)...", name, *ptr);

	return 0;
}
コード例 #7
0
ファイル: os_redirect.c プロジェクト: Visi0n/Anope-Modules
 int AnopeInit(int argc, char **argv) {
     /* We create the command we're going to use */
     int req_access = 1;
     char *usermsg = 
     Directive conf[]= 
     {
               {"RedirectAccess",{ { PARAM_INT, PARAM_RELOAD, &req_access } } }
     };

     moduleGetConfigDirective(conf);
     
     Command *c;
     if ((req_access!=0) && (req_access!=1) && (req_access!=2)) req_access=1;
     if (req_access==0)
     {                  
          c = createCommand("redirect", do_redirect,NULL, -1, -1, -1, -1, -1);
          alog("Loading os_redirect with restriction to noone");
     }
     else if (req_access==1)
     { 
          c = createCommand("redirect", do_redirect,is_services_oper, -1, -1, -1, -1, -1);
          alog("Loading os_redirect with restriction to services operators");
     }
     else if (req_access==2) 
     {
          c = createCommand("redirect", do_redirect,is_services_admin, -1, -1, -1, -1, -1);
          alog("Loading os_redirect with restriction to services administrators");
     }
          
 
     /* We add the command to HelpServ and log it */
     alog("os_redirect: Add command 'redirect' status: %d", moduleAddCommand(OPERSERV, c, MOD_HEAD));
 
     /* We tell Anope who we are and what version this module is */
     moduleAddAuthor(AUTHOR);
     moduleAddVersion(VERSION);
 
     /* Loading succeeded */
     return MOD_CONT;
 }
コード例 #8
0
int load_config(void)
{
    int i;
    int retval = 1;

    Directive confvalues[][1] = {
        {{"LogEvents", {{PARAM_SET, 0, &Log_ConnectServ}}}},
        {{"JoinLogChan", {{PARAM_SET, 0, &CsJoinLogChan}}}},
        {{"ConnectServNick", {{PARAM_STRING, 0, &s_ConnectServ}}}},
        {{"ConnectServIdent", {{PARAM_STRING, 0, &ConnectServ_ident}}}},
        {{"ConnectServHost", {{PARAM_STRING, 0, &ConnectServ_host}}}},
        {{"ConnectServReal", {{PARAM_STRING, 0, &ConnectServ_realname}}}},
        {{"ConnectServModes", {{PARAM_STRING, 0, &ConnectServ_modes}}}},
        {{"SignOnMessage", {{PARAM_SET, 0, &SignOnMessage}}}},
        {{"SignOffMessage", {{PARAM_SET, 0, &SignOffMessage}}}},
        {{"UseColorfulMessages", {{PARAM_SET, 0, &UseColorfulMessages}}}},
        {{"NickChangeMessage", {{PARAM_SET, 0, &NickChangeMessage}}}},
    };
    for (i = 0; i < 6; i++)
        moduleGetConfigDirective((char *) "connectserv.conf", confvalues[i]);

    if (!s_ConnectServ) {
        alog(LOG_NORMAL, "Error: ConnectServNick missing");
        retval = 0;
    }
    if (!ConnectServ_ident) {
        alog(LOG_NORMAL, "Error: ConnectServIdent missing");
        retval = 0;
    }
    if (!ConnectServ_host) {
        alog(LOG_NORMAL, "Error: ConnectServHost missing");
        retval = 0;
    }
    if (!ConnectServ_realname) {
        alog(LOG_NORMAL, "Error: ConnectServReal missing");
        retval = 0;
    }
    return retval;
}