+ printf_mysql_query("SELECT `nick`, `ident`, `realname`, `server`, `port`, `pass`, `textbot`, `id`, `queue`, `ssl`, `bind`, `secret` FROM `bots` WHERE `botclass` = '0' AND `active` = '1'");
+ res = mysql_use();
+
+ while ((row = mysql_fetch_row(res)) != NULL) {
+ client = create_socket(row[3], atoi(row[4]), row[10], row[5], row[0], row[1], row[2]);
+ client->flags |= (strcmp(row[6], "0") ? SOCKET_FLAG_PREFERRED : 0);
+ client->flags |= (strcmp(row[8], "0") ? SOCKET_FLAG_USE_QUEUE : 0);
+ client->flags |= (strcmp(row[9], "0") ? SOCKET_FLAG_SSL : 0);
+ client->flags |= (strcmp(row[11], "0") ? SOCKET_FLAG_SECRET_BOT : 0);
+ client->botid = 0;
+ client->clientid = atoi(row[7]);
+ connect_socket(client);
+
+ printf_mysql_query("SELECT `command`, `function`, `parameters`, `global_access`, `chan_access`, `flags` FROM `bot_binds` WHERE `botclass` = '0' AND `botid` = '%d'", client->clientid);
+ res2 = mysql_use();
+ while ((row = mysql_fetch_row(res2)) != NULL) {
+ if(bind_botwise_cmd_to_command(0, client->clientid, row[0], row[1])) {
+ if(row[2] && strcmp(row[2], "")) {
+ bind_botwise_set_parameters(0, client->clientid, row[0], row[2]);
+ }
+ if(row[3]) {
+ bind_botwise_set_global_access(0, client->clientid, row[0], atoi(row[3]));
+ }
+ if(row[4]) {
+ bind_botwise_set_channel_access(0, client->clientid, row[0], row[4]);
+ }
+ if(strcmp(row[5], "0"))
+ bind_botwise_set_bind_flags(0, client->clientid, row[0], atoi(row[5]));
+ }
+ }
+ bind_botwise_unbound_required_functions(0, client->clientid);
+ }
+}
+
+static void zero_bots_trigger_callback(int clientid, struct ChanNode *chan, char *trigger) {