function channel_msg_sms_search($fp, $rdata, $account, $player) { if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sms search (.*)\\s$/i', $rdata, $msg)) { $nick = $msg[1]; $user = $msg[2]; $host = $msg[3]; $channel = $msg[4]; $recv = trim($msg[5]); echo_r('[SMS_SEARCH] by ' . $nick . ' in ' . $channel . ' for ' . $recv); if (($blacklist_reason = $account->isSmsBlacklisted()) !== false) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you are not allowed to send text messages via ' . IRC_BOT_NICK . '. Reason: ' . $blacklist_reason . EOL); return true; } // check if we know this user we try to send a text too $recv_account =& SmrAccount::findAccountByIrcNick($recv, true); if ($recv_account == null) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', I don\'t know a player that goes by the nick \'' . $recv . '\'.' . EOL); return true; } // multiple results (we don't hint who and what) if ($recv_account === true) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your query matches more than one player.' . EOL); return true; } // no cell phone? if (strlen($recv_account->getCellPhone()) == 0) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', ' . $recv_account->getIrcNick() . ' has not provided a cell phone number.' . EOL); } else { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', ' . $recv_account->getIrcNick() . ' has provided a cell phone number and can receive text messages.' . EOL); } return true; } return false; }