Exemple #1
0
<?php

# :gizmore!gizmore@localhost PRIVMSG Dog :.join #sr
if (false === ($user = Dog::getOrCreateUser())) {
    return;
}
$serv = Dog::getServer();
$serv->addUser($user);
$user = Dog::setupUser();
$chan = Dog::setupChannel();
if ($user === false) {
    return Dog::suppressModules();
}
# Log PRIVMSGs
$msg = Dog::getIRCMsg()->getArg(1);
if (Dog::getIRCMsg()->shouldLog()) {
    Dog_Log::user($user, $msg);
    Dog_Log::channel($chan, $msg);
}
# Exec Stuff
if (!$user->isBot()) {
    if ('' !== ($trigger = Common::substrUntil($msg, ' '))) {
        if (Dog_Init::isTrigger($serv, $chan, $trigger[0])) {
            if ($user->isFlooding()) {
                return;
            }
            Dog::setTriggered();
            $trigger = substr($trigger, 1);
            if (false !== ($plug = Dog_Plugin::getPlug($trigger))) {
                if (!$plug->isInScope($serv, $chan)) {
                    Dog::scopeError($plug->getScope());
Exemple #2
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));
        }
    }