void module_enter(irc_t *irc, const char *channel, const char *user, const char *message) { if (!message) return quote_entry_random(irc, channel, user); list_t *list = strnsplit(message, " ", 2); const char *method = list_shift(list); if (!strcmp(method, "-help")) return quote_help(irc, channel, user); if (!strcmp(method, "-add")) return quote_add(irc, channel, user, list); if (!strcmp(method, "-forget")) return quote_forget(irc, channel, user, list); if (!strcmp(method, "-stats")) return quote_stats(irc, channel, user, list); if (!strcmp(method, "-reauthor")) return quote_reauthor(irc, channel, user, list); return quote_entry(irc, channel, user, method); }
s32 ws__setHotbSilenceInterfaces(WS_ENV* soap, s8 *silenceIfNames, s32 *ret) { s8 *ifnames[HOTB_IFNAMES_MAX_COUNT]; s32 ifcount = 0; u32 i; u32 ifindex[HOTB_IFNAMES_MAX_COUNT]; sqlite3 *db = NULL; db = sqlite3_open_ex(1, HOTB_DB); if (NULL == db) { return ws_send_soap_error(soap, "Open database failed!"); } snprintf(g_sqlite_sql_buf, sizeof(g_sqlite_sql_buf), "delete from tb_hotb_silence_if;"); if (SQLITE_OK != sqlite3_exec_ex(db, g_sqlite_sql_buf)) { sqlite3_close_ex(db); db = NULL; return ws_send_soap_error(soap, "SQL execute failed!"); } ifcount = strnsplit(',', silenceIfNames, HOTB_IFNAMES_MAX_COUNT, ifnames); for(i=0; i<ifcount; i++) { /*获取接口索引*/ if (ERROR_SUCCESS != if_get_index_by_name(ifnames[i],(s32 *)&ifindex[i])) { continue; } snprintf(g_sqlite_sql_buf, sizeof(g_sqlite_sql_buf), "insert into tb_hotb_silence_if (ifname, ifindex) values('%s', '%d');", ifnames[i], ifindex[i]); if (SQLITE_OK != sqlite3_exec_ex(db, g_sqlite_sql_buf)) { sqlite3_close_ex(db); db = NULL; return ws_send_soap_error(soap, "SQL execute failed!"); } } hotb_silence_cp_interfaces_update(ifcount, ifindex); sqlite3_close_ex(db); db = NULL; return WS_OK; }