public function run() { $line = new ReceivedLine($this->runMessage); $line->parse(); ChannelManager::rename($this->senderNick, $this->targetNick); UserManager::rename($this->senderNick, $line->targetNick, $line->senderIdent, $line->senderHost); }
public function run() { if ($this->eventType == ReceivedLineTypes::SERVERREPLYTHREEONEONE) { $workingLine = explode(" ", $this->runMessage, 8); $nick = $workingLine[3]; $ident = $workingLine[4]; $host = $workingLine[5]; $realName = str_replace(":", "", $workingLine[7]); $realName = trim($realName); $user = new User(); $user->nickname = $nick; $user->ident = $ident; $user->host = $host; $user->realName = $realName; UserManager::store($nick, $user); } else { if ($this->eventType == ReceivedLineTypes::SERVERREPLYTHREETHREEZERO || $this->eventType == ReceivedLineTypes::SERVERREPLYTHREEZEROSEVEN) { $workingLine = explode(" ", $this->runMessage); $nick = $workingLine[3]; $user = UserManager::get($nick); $user->isIdentified = true; UserManager::store($nick, $user); if (Config::$users[$nick]) { $permissionLevel = Config::$users[$nick]; } else { $permissionLevel = 0; } $server = Server::getInstance(); $server->notify($nick, "You have been successfully authorized via NickServ with the permission level " . $permissionLevel); } } }
public function run() { $line = new ReceivedLine($this->runMessage); $line->parse(); $user = UserManager::get($this->senderNick); $server = Server::getInstance(); //$server->message($user->nickname, "Welcome to Persian Mafia game. This channel is logged, check this for more info : http://cyberrabbits.net/non/mafia/"); }
public function run() { $line = new ReceivedLine($this->runMessage); $line->parse(); $user = UserManager::get($this->senderNick); $db = Database::getInstance(); $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, message, time) VALUES (?,?,?,?,?,?,?)"); $stmt->execute(array(ReceivedLineTypes::CHANMSG, $this->senderNick, $user->host, $user->ident, $this->channel, $line->message, time())); }
public function run() { $channel = ChannelManager::get($this->channel); $channel->removeConnectedNick($this->targetNick); ChannelManager::store($this->channel, $channel); if (!ChannelManager::isConnectedToTrackedChannel($this->targetNick)) { UserManager::remove($this->targetNick); } }
public function run() { $line = new ReceivedLine($this->runMessage); $line->parse(); $user = UserManager::get($this->senderNick); $user->nickname = $line->senderNick; $user->ident = $line->senderIdent; $user->host = $line->senderHost; UserManager::store($this->senderNick, $user); }
public function run() { $channel = ChannelManager::get($this->channel); $channel->addConnectedNick($this->senderNick); ChannelManager::store($this->channel, $channel); $line = new ReceivedLine($this->runMessage); $line->parse(); $user = UserManager::get($this->senderNick); $user->nickname = $line->senderNick; $user->ident = $line->senderIdent; $user->host = $line->senderHost; UserManager::store($this->senderNick, $user); }
public function run() { $user = UserManager::get($this->senderNick); if (!$user->nickname) { $user = UserManager::get($this->targetNick); } $channels = ChannelManager::getCommonChannels($this->senderNick); if (!$channels) { $channels = ChannelManager::getCommonChannels($this->targetNick); } $db = Database::getInstance(); foreach ($channels as $channel) { $stmt = $db->prepare("INSERT INTO channel_actions (type, nickname, host, ident, channel_name, target_nick, time, message) VALUES (?,?,?,?,?,?,?,?)"); $stmt->execute(array(ReceivedLineTypes::NICK, $this->senderNick, $user->host, $user->ident, $channel, $this->targetNick, time(), "changed nick to " . $this->target_nick)); } }
public function run() { // Channel $workingLine = explode(" ", $this->runMessage); $channel = $workingLine[4]; // Names $workingLine = explode(" :", $this->runMessage); $names = trim($workingLine[1]); $names = explode(" ", $names); // Fetch the channel object $channelObject = ChannelManager::get($channel); // Loop through the names adding them to the channel and UserManager foreach ($names as $name) { $privileges = false; if (strpos($name, "~") === 0) { $privileges = "~"; } if (strpos($name, "&") === 0) { $privileges = "&"; } if (strpos($name, "@") === 0) { $privileges = "@"; } if (strpos($name, "%") === 0) { $privileges = "%"; } if (strpos($name, "+") === 0) { $privileges = "+"; } $nick = str_replace(array("~", "@", "&", "%", "+"), "", $name); $channelObject->addConnectedNick($nick, $privileges); $user = UserManager::get($nick); $user->nickname = $nick; UserManager::store($nick, $user); } // Store away the channel object ChannelManager::store($channel, $channelObject); }
public function run() { $harassedNicks = DataManager::retrieve("harassedNicks", "modules\\funstuff\\Harass"); $harassedHosts = DataManager::retrieve("harassedHosts", "modules\\funstuff\\Harass"); if ($harassedNicks) { if (in_array($this->senderNick, $harassedNicks) !== false) { $server = Server::getInstance(); $server->message($this->channel, "Shutup " . $this->senderNick . "! We all hate you."); return true; } } if ($harassedHosts) { $user = UserManager::get($this->senderNick); $host = $user->host; foreach ($harassedHosts as $harassedHost) { if (preg_match($harassedHost, $host)) { $server = Server::getInstance(); $server->message($this->channel, "Shutup " . $this->senderNick . "! We all hate you."); return true; } } } }
public function run() { $workingLine = explode(" ", $this->runMessage, 4); $message = $workingLine[3]; // Chan, ident, host, server, nick $workingLine = explode(" ", $message); //$channel = $workingLine[0]; $ident = $workingLine[1]; $host = $workingLine[2]; //$server = $workingLine[3]; $nickname = $workingLine[4]; // Real name $workingLine = explode(":", $message); $hopsAndRealName = trim($workingLine[1]); $workingHopsAndRealName = explode(" ", $hopsAndRealName, 2); $realName = $workingHopsAndRealName[1]; // Fetch and update the user object $u = UserManager::get($nickname); $u->nickname = $nickname; $u->ident = $ident; $u->host = $host; $u->realName = $realName; UserManager::store($nickname, $u); }
/** * Runs the module associated with a trigger * * @param string full message the user sent * @param string nickname of the user who sent the command * @param string channel the message was sent on */ public static function runTrigger($message, $senderNick, $channel) { foreach (static::$mappedTriggers as $regexString => $module) { if (preg_match($regexString, $message)) { if ($module::$requiredUserLevel) { $user = UserManager::get($senderNick); if (!$user->isIdentified) { return 2; } else { if ($module::$requiredUserLevel > Config::$users[$senderNick]) { return 2; } } } if (strpos("#", $channel) !== false) { if ($module::$requiredChannelPrivilege) { $channel = ChannelManager::get($channel); if (!$channel->hasPrivilegeOrHigher($senderNick)) { return 2; } } } $moduleInstance = new $module($message, $senderNick, $channel); $moduleInstance->run(); return true; } } }
public function run() { ChannelManager::removeConnectedNickFromAll($this->senderNick); UserManager::remove($this->senderNick); }
/** * Force sets a real name (GECOS) on a user (oper only) */ public function chgName($user, $name) { // Send it ErrorLog::log(ErrorCategories::DEBUG, "Force changing real name (GECOS) of " . $user . " to " . $name); fwrite(static::$serverHandle, "CHGNAME " . $user . " " . $name . "\n"); UserManager::rename($user, false, false, false, $name); }