Exemplo n.º 1
0
/**
 * Handle seen fantasy command.
 **/
int do_fantasy_seen(int argc, char **argv)
{
    User *u;
    char *target = NULL;
    ChannelStats *cs;
    char *message = NULL;

    if (denora->debug)
        protocol_debug(NULL, argc, argv);

    if (argc >= 3 && stricmp(argv[0], "seen") == 0) {
        u = finduser(argv[1]);
        cs = find_cs(argv[2]);
        if (argc == 3) {
            if (cs->flags & CS_NOTICE)
                moduleNoticeLang(s_StatServ, u, SEEN_USAGE,
                                 ChanStatsTrigger);
            else
                moduleNoticeChanLang(s_StatServ, cs, SEEN_USAGE,
                                     ChanStatsTrigger);
        } else {
            target = myStrGetToken(argv[3], ' ', 0);
            message = do_seen(u, target);
            if (cs->flags & CS_NOTICE)
                notice(s_StatServ, u->nick, message);
            else
                denora_cmd_privmsg(s_StatServ, cs->name, message);
        }
    }
    return MOD_CONT;
}
Exemplo n.º 2
0
int my_version(int argc, char **argv)
{
    if (argc >= 2) {
	    /* argv[0] = nick, argv[1] = version */
        if (stricmp(ServerName, argv[0])) {
            denora_cmd_privmsg(s_StatServ, sstrdup(LOGTARGET), "\x02VERSION\x02 %s has version %s", argv[0], argv[1]);
        }
    }
    return MOD_CONT;
}
Exemplo n.º 3
0
/**
 * Handle seen fantasy command.
 * @param argc Argument count
 * @param argv Argument list
 * @return MOD_CONT or MOD_STOP
 **/
int do_fantasy(int argc, char **argv)
{
    User *u;
    char *chan;
#ifdef USE_MYSQL
    MYSQL_RES *mysql_res;
    int i = 1;
#endif
    ChannelStats *cs;

    if (argc < 3) {
        return MOD_CONT;
    }

    if (!denora->do_sql) {
        return MOD_CONT;
    }

    if (stricmp(argv[0], "top10") == 0) {
        u = finduser(argv[1]);
        chan = rdb_escape(argv[2]);
        cs = find_cs(argv[2]);
        rdb_query
            (QUERY_HIGH,
             "SELECT * FROM %s WHERE chan=\'%s\' AND type=0 ORDER BY letters DESC LIMIT 10;",
             UStatsTable, chan);
        free(chan);
#ifdef USE_MYSQL
        mysql_res = mysql_store_result(mysql);
        if (mysql_num_rows(mysql_res) > 0) {
            if (cs->flags & CS_NOTICE) {
                notice_lang(s_StatServ, u, STATS_TOP10_CHANNEL, argv[2]);
            } else {
                denora_cmd_privmsg(s_StatServ, argv[2],
                                   getstring(NULL,
                                             STATS_TOP10_CHANNEL),
                                   argv[2]);
            }
            SET_SEGV_LOCATION();
            while ((mysql_row = mysql_fetch_row(mysql_res)) != NULL) {
                if (cs->flags & CS_NOTICE) {
                    notice_lang(s_StatServ, u, STATS_MESSAGE,
                                i, mysql_row[0], mysql_row[3],
                                mysql_row[4], mysql_row[5],
                                mysql_row[7], mysql_row[6]);
                } else {
                    denora_cmd_privmsg(s_StatServ, argv[2],
                                       getstring(NULL,
                                                 STATS_MESSAGE), i,
                                       mysql_row[0], mysql_row[3],
                                       mysql_row[4], mysql_row[5],
                                       mysql_row[7], mysql_row[6]);
                }
                i++;
            }
        }
        SET_SEGV_LOCATION();
        mysql_free_result(mysql_res);
#endif
    }

    return MOD_CONT;
}