diff --git a/src/parse.c b/src/parse.c --- a/src/parse.c +++ b/src/parse.c @@ -152,13 +152,19 @@ case JOIN: if ((token = strtok (NULL, "\r\n"))) - snprintf (msg, 512, "JOIN %s\r\n", token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "JOIN %s\r\n", token); + } return msg; case LEAVE: if (*message->channel != '#') return NULL; - snprintf (msg, 512, "PART %s :Leaving.\r\n", message->channel); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "PART %s :Leaving.\r\n", message->channel); + } return msg; case ADD: @@ -288,44 +294,56 @@ case OP: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token); + } } return msg; case DEOP: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "MODE %s -o %s\r\n", message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "MODE %s -o %s\r\n", message->channel, token); + } } return msg; case KICK: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "KICK %s %s\r\n", message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "KICK %s %s\r\n", message->channel, token); + } } return msg; case BAN: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "MODE %s +b %s\r\n", message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "MODE %s +b %s\r\n", message->channel, token); + } } return msg; case UNBAN: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "MODE %s -b %s\r\n", message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "MODE %s -b %s\r\n", message->channel, token); + } } return msg; case KICKBAN: if ((token = strtok (NULL, "\r\n")) != NULL) { - if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) - snprintf (msg, 512, "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token, - message->channel, token); + if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { + if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) + snprintf (msg, 512, "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token, + message->channel, token); + } } return msg; }