printf_mysql_query("SELECT `botid`, `botclass` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` LEFT JOIN `channels` ON `bot_channels`.`chanid` = `channels`.`channel_id` WHERE `channel_name` = '%s'", escape_string(channel));
res = mysql_use();
while ((row = mysql_fetch_row(res)) != NULL) {
- if(atoi(row[1]) == client->botid) {
+ if(atoi(row[1]) == client->botid && (client->botid || client->clientid == atoi(row[0]))) {
reply(getTextBot(), user, "NS_REGISTER_ALREADY", argv[0], client->user->nick);
return;
} else
userid = (int) mysql_insert_id(mysql_conn);
}
}
- printf_mysql_query("SELECT `id`, `max_channels`, `defaulttrigger`, `nick` FROM `bots` WHERE `botclass` = '%d' ORDER BY `register_priority` DESC", client->botid);
+ printf_mysql_query("SELECT `id`, `max_channels`, `defaulttrigger`, `nick` FROM `bots` WHERE `botclass` = '%d' AND `active` = '1' ORDER BY `register_priority` DESC", client->botid);
res = mysql_use();
int botid = 0;
char *bottrigger;
if(bot) {
putsock(bot, "JOIN %s", channel);
} else
- reply(textclient, user, "NS_REGISTER_DISCONNECTED");
+ reply(textclient, user, "NS_REGISTER_DISCONNECTED", channel);
printf_mysql_query("INSERT INTO `bot_channels` (`botid`, `chanid`, `trigger`) VALUES ('%d', '%d', '%s')", botid, chanid, bottrigger);
if(multibot != 2) {
if(multibot) {