-/* cmd_neonserv_invite.c - NeonServ v5.3
+/* cmd_neonserv_invite.c - NeonServ v5.4
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
cache->chan = chan;
cache->event = event;
cache->nick = strdup(argv[0]);
- get_userauth(cuser, neonserv_cmd_invite_nick_lookup, cache);
+ get_userauth(cuser, module_id, neonserv_cmd_invite_nick_lookup, cache);
}
}
if(auth) {
MYSQL_RES *res;
MYSQL_ROW row;
- printf_mysql_query("SELECT `user_id` FROM `users` WHERE `user_user` = '%s'", escape_string(auth));
+ printf_mysql_query("SELECT `user_id`, `user_block_invites` FROM `users` WHERE `user_user` = '%s'", escape_string(auth));
res = mysql_use();
if ((row = mysql_fetch_row(res)) != NULL) {
+ //check if the user has blocked invites globally
+ if(!strcmp(row[1], "1")) {
+ reply(textclient, user, "NS_INVITE_GLOBALLY_BLOCKED", nick);
+ return;
+ }
//check if the user has set noinvite
printf_mysql_query("SELECT `id` FROM `noinvite` WHERE `uid` = '%s' AND `cid` = '%d'", row[0], chan->channel_id);
res = mysql_use();
}
}
struct neonserv_cmd_invite_timeout *timeout = neonserv_cmd_invite_add_timeout(nick, chan->name);
- timeq_add(INVITE_TIMEOUT, neonserv_cmd_invite_timeout_timeout, timeout);
+ timeq_add(INVITE_TIMEOUT, module_id, neonserv_cmd_invite_timeout_timeout, timeout);
putsock(client, "INVITE %s %s", nick, chan->name);
struct UserNode *tmpu = getUserByNick(nick);
if(!tmpu) {