function channel_msg_with_registration($fp, $rdata) { if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!(money|forces|seed|seedlist|op|sd|sms)\\s/i', $rdata, $msg)) { $nick = $msg[1]; $user = $msg[2]; $host = $msg[3]; $channel = $msg[4]; // check if the query is in public channel if ($channel == '#smr' || $channel == '#smr-bar') { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', that command can only be used in an alliance controlled channel.' . EOL); return true; } if (check_for_registration($account, $player, $fp, $nick, $channel, 'channel_msg_with_registration($fp, \'' . $rdata . '\');')) { return true; } if (channel_msg_money($fp, $rdata, $account, $player)) { return true; } if (channel_msg_forces($fp, $rdata, $account, $player)) { return true; } if (channel_msg_seed($fp, $rdata, $account, $player)) { return true; } if (channel_msg_seedlist_add($fp, $rdata, $account, $player)) { return true; } if (channel_msg_seedlist_del($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_info($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_cancel($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_set($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_turns($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_response($fp, $rdata, $account, $player)) { return true; } if (channel_msg_op_list($fp, $rdata, $account, $player)) { return true; } if (channel_msg_sd_set($fp, $rdata, $account, $player)) { return true; } if (channel_msg_sd_del($fp, $rdata, $account, $player)) { return true; } if (channel_msg_sd_list($fp, $rdata, $account, $player)) { return true; } if (channel_msg_sms_search($fp, $rdata, $account, $player)) { return true; } if (channel_msg_sms_send($fp, $rdata, $account, $player)) { return true; } } return false; }
function channel_op_notification($fp, $rdata, $nick, $channel) { echo_r('[OP_ATTENDANCE_CHECK] ' . $nick); if (check_for_registration($account, $player, $fp, $nick, $channel, 'channel_op_notification($fp, \'' . $rdata . '\', \'' . $nick . '\', \'' . $channel . '\');', false)) { return true; } $db = new SmrMySqlDatabase(); // check if there is an upcoming op $db->query('SELECT 1 FROM alliance_has_op WHERE alliance_id = ' . $player->getAllianceID() . ' AND game_id = ' . $player->getGameID() . ' AND time > ' . time()); if (!$db->nextRecord()) { return true; } $db->query('SELECT 1 FROM alliance_has_op_response WHERE alliance_id = ' . $player->getAllianceID() . ' AND game_id = ' . $player->getGameID() . ' AND account_id = ' . $player->getAccountID()); if (!$db->nextRecord()) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your alliance leader has scheduled an OP, which you have not signed up yet. Please use the !op yes/no/maybe command to do so.' . EOL); } return true; }