Example #1
0
 public static function connect(Dog_Server $server)
 {
     if (false === ($nick = self::getNickData($server))) {
         return Dog_Log::warn(sprintf('No nicks for %s.', $server->displayName()));
     }
     $server->addUser(Dog::getOrCreateUserByName($nick->getName()));
     $conn = $server->getConnection();
     return self::sendUser($conn, $server, $nick) && self::sendNick($conn, $server, $nick);
 }
Example #2
0
<?php

# :irc.giz.org 353 Dog = #sr :@gizmore Dog
$msg = Dog::getIRCMsg();
$serv = Dog::getServer();
$chan_name = $msg->getArg(2);
if (false === ($channel = $serv->getChannelByName($chan_name))) {
    return Dog::suppressModules();
}
Dog::setChannel($channel);
$sid = $serv->getID();
foreach (explode(' ', $msg->getArg(3)) as $username) {
    if (false !== ($user = Dog::getOrCreateUserByName(ltrim($username, Dog_IRCPriv::allSymbols())))) {
        $serv->addUser($user);
        $channel->addUser($user, Dog_IRCPriv::matchSymbols($username));
    }
}
Example #3
0
<?php

# :Dog!gizmore@localhost NICK gizmore
$old_user = Dog::setupUser();
$serv = Dog::getServer();
if (false === ($new_user = Dog::getOrCreateUserByName(Dog::argv(0)))) {
    Dog::suppressModules();
    return Dog_Log::critical('Cannot create user!');
}
# Copy channels with privs
if ($old_user) {
    $old_uid = $old_user->getID();
    $serv->addUser($new_user);
    foreach ($serv->getChannels() as $channel) {
        $channel instanceof Dog_Channel;
        if (false !== $channel->getUserByID($old_uid)) {
            $channel->addUser($new_user, $channel->getPriv($old_user));
        }
    }
    $serv->removeUser($old_user);
    echo "OLD DOG: {$old_user->getName()}\n";
    echo "OLD DOG: " . Dog::getNickname() . "\n";
    if ($old_user->getName() === Dog::getNickname()) {
        if (false !== ($nick = Dog_Nick::getExistingNick($serv, Dog::argv(0)))) {
            $serv->setNick($nick);
            $serv->setNicknum(0);
            $nick->identify();
        } else {
            $serv->setNickName(Dog::argv(0));
        }
    }
Example #4
0
<?php

# :irc.gizmore.org 319 Dog gizmore :~#wechall ~#shadowlamb ~#sr
# WHOIS CHANNELS / PERMS
$msg = Dog::getIRCMsg();
if (false === ($user = Dog::getOrCreateUserByName($msg->getArg(1)))) {
    return Dog::suppressModules();
}
Dog::setUser($user);
$server instanceof Dog_Server;
foreach (explode(' ', $msg->getArg(2)) as $chan_name) {
    echo "{$chan_name}\n";
    // 	$symbols = Dog_IRCPriv::matchSymbols($chan_name);
    // 	$chan_name = Dog_IRCPriv::trimSymbols($chan_name);
    // 	if (false !== ($channel = $server->getChannelByName($chan_name)))
    // 	{
    // 		$channel->addUser($user, $symbols);
    // 	}
}
Example #5
0
<?php

# :irc.giz.org 001 Dog :Welcome to the gizmore IRC Network Dog!Dawg@localhost
# Set bot mode
$server = Dog::getServer();
$nick = Dog::getNickname();
Dog::getOrCreateUserByName(Dog::argv(0));
if (!$server->isOptionEnabled(Dog_Server::NO_BOTFLAG)) {
    $server->sendRAW("MODE {$nick} +b");
    $server->sendRAW("MODE {$nick} +B");
}
if (false !== ($connector = $server->getVarDefault('dog_connector', false))) {
    $server->unsetVar('dog_connector');
    $connector instanceof Dog_User;
    $connector->sendPRIVMSG(Dog::lang('msg_connected', array($server->displayLongName(), Dog::getNickname(), $server->getConf('ircoppass'))));
}
$server->saveOption(Dog_Server::HAS_CONNECTED_ONCE);
$server->getNick()->identify();