コード例 #1
0
ファイル: mod-iauth_loc.c プロジェクト: staticfox/srvx
static void
iauth_loc_conf_read(void)
{
    dict_t node;
    const char *str1;
    const char *str2;


    node = conf_get_data("modules/blacklist", RECDB_OBJECT);
    if (node == NULL)
        return;

    str1 = database_get_data(node, "debug_bot", RECDB_QSTRING);
    if (str1)
        conf.debug_bot = GetUserH(str1);

    str1 = database_get_data(node, "debug_channel", RECDB_QSTRING);
    if (conf.debug_bot && str1) {
        str2 = database_get_data(node, "debug_channel_modes", RECDB_QSTRING);
        if (!str2)
            str2 = "+tinms";
        conf.debug_channel = AddChannel(str1, now, str2, NULL);
        AddChannelUser(conf.debug_bot, conf.debug_channel)->modes |= MODE_CHANOP;
    } else {
        conf.debug_channel = NULL;
    }
}
コード例 #2
0
ファイル: mod-track.c プロジェクト: Cloudxtreme/x3
int
track_finalize(void) {
    struct mod_chanmode change;
    dict_t node;
    char *str;

    finalized = 1;
    node = conf_get_data("modules/track", RECDB_OBJECT);
    if (!node)
        return 0;
    str = database_get_data(node, "snomask", RECDB_QSTRING);
    if (!str)
	    track_cfg.snomask = TRACK_NICK|TRACK_KICK|TRACK_JOIN|TRACK_PART|TRACK_CHANMODE|TRACK_NEW|TRACK_DEL|TRACK_AUTH;
    else
	    parse_track_conf(str);
    str = database_get_data(node, "bot", RECDB_QSTRING);
    if (!str)
        return 0;
    track_cfg.bot = GetUserH(str);
    if (!track_cfg.bot)
        return 0;
    mod_chanmode_init(&change);
    change.argc = 1;
    change.args[0].mode = MODE_CHANOP;
    change.args[0].u.member = AddChannelUser(track_cfg.bot, track_cfg.channel);
    mod_chanmode_announce(track_cfg.bot, track_cfg.channel, &change);
    return 1;
}
コード例 #3
0
ファイル: proto-common.c プロジェクト: Cloudxtreme/x3
static CMD_FUNC(cmd_version)
{
    struct userNode *user;
    if (!(user = GetUserH(origin))) {
        log_module(MAIN_LOG, LOG_ERROR, "Could not find VERSION origin user %s", origin);
        return 0;
    }
    irc_numeric(user, 351, "%s %s+[%s] %s", PACKAGE_TARNAME, PACKAGE_VERSION, cvs_version, self->name);
    return 1;
}
コード例 #4
0
ファイル: proto-common.c プロジェクト: Cloudxtreme/x3
static CMD_FUNC(cmd_part)
{
    struct part_desc desc;

    if (argc < 2)
        return 0;
    desc.user = GetUserH(origin);
    if (!desc.user)
        return 0;
    desc.text = (argc > 2) ? argv[argc - 1] : NULL;
    parse_foreach(argv[1], part_helper, NULL, NULL, NULL, &desc);
    return 1;
}
コード例 #5
0
ファイル: proto-common.c プロジェクト: Cloudxtreme/x3
static CMD_FUNC(cmd_admin)
{
    struct userNode *user;
    struct string_list *slist;

    if (!(user = GetUserH(origin))) {
        log_module(MAIN_LOG, LOG_ERROR, "Could not find ADMIN origin user %s", origin);
        return 0;
    }
    if ((slist = conf_get_data("server/admin", RECDB_STRING_LIST)) && slist->used) {
        unsigned int i;

        irc_numeric(user, 256, ":Administrative info about %s", self->name);
        for (i = 0; i < slist->used && i < 3; i++)
            irc_numeric(user, 257 + i, ":%s", slist->list[i]);
    } else {
        irc_numeric(user, 423, ":No administrative info available");
    }
    return 1;
}
コード例 #6
0
ファイル: proto-common.c プロジェクト: Cloudxtreme/x3
static CMD_FUNC(cmd_stats)
{
    struct userNode *un;

    if (argc < 2)
        return 0;
    if (!(un = GetUserH(origin)))
        return 0;
    switch (argv[1][0]) {
    case 'u': {
        unsigned int uptime = now - boot_time;
        irc_numeric(un, RPL_STATSUPTIME, ":Server Up %d days %d:%02d:%02d",
                    uptime/(24*60*60), (uptime/(60*60))%24, (uptime/60)%60, uptime%60);
        irc_numeric(un, RPL_MAXCONNECTIONS, ":Highest connection count: %d (%d clients)",
                    self->max_clients+1, self->max_clients);
        break;
    }
    default: /* unrecognized/unhandled stats output */ break;
    }
    irc_numeric(un, 219, "%s :End of /STATS report", argv[1]);
    return 1;
}
コード例 #7
0
ファイル: mod-snoop.c プロジェクト: Cloudxtreme/x3
int
snoop_finalize(void) {
    struct mod_chanmode change;
    dict_t node;
    char *str;

    finalized = 1;
    node = conf_get_data("modules/snoop", RECDB_OBJECT);
    if (!node)
        return 0;
    str = database_get_data(node, "bot", RECDB_QSTRING);
    if (!str)
        return 0;
    snoop_cfg.bot = GetUserH(str);
    if (!snoop_cfg.bot)
        return 0;
    mod_chanmode_init(&change);
    change.argc = 1;
    change.args[0].mode = MODE_CHANOP;
    change.args[0].u.member = AddChannelUser(snoop_cfg.bot, snoop_cfg.channel);
    mod_chanmode_announce(snoop_cfg.bot, snoop_cfg.channel, &change);
    return 1;
}