BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Khalem on October 16, 2006, 09:10:39 pm

Title: Buddylist cache to prevent logoff spam
Post by: Khalem on October 16, 2006, 09:10:39 pm
I'm still testing this as it was just thrown together in a few minutes to combat todays massive chatserver instability and the following massive spamming.
Use at your own risk etc, but it works for me.

Bot.php, function inc_buddy
Find
Code: [Select]
<?php
/*
Buddy logging on/off
*/
function inc_buddy($args)
{
$user $this -> aoc -> get_uname($args[0]);

$mem $this -> is_member($user);

$end "";
if (!$mem)
{
?>


Change to:
Code: [Select]
<?php
/*
Buddy logging on/off
*/
function inc_buddy($args)
{
$user $this -> aoc -> get_uname($args[0]);

$mem $this -> is_member($user);

// Make sure we only cache members and guests to prevent any issues with !is and anything else that might do buddy actions on non members.
if ($mem)
{
// Buddy logging on
if ($args[1] == 1)
{
// Do we have a logon for a user already logged on?
if (isset($this -> glob["online"][$user]))
{
$this -> log("BUDDY""ERROR"$user " logged on despite of already being marked as logged on!!");
return;
}
else
{
// Enter the user into the online buddy list
$this -> glob["online"][$user] = $user;
}
}
else
{
// Do we have a logoff without a prior login?
if (!isset($this -> glob["online"][$user]))
{
$this -> log("BUDDY""ERROR"$user " logged off with no prior logon!!");
return;
}
else
{
unset($this -> glob["online"][$user]);
}
}
}

$end "";
if (!$mem)
{
?>


Depending on what version of the bot you run, find the actual bot function near the top with all the variable declarations.
Make sure the following line appears:
Code: [Select]
$this -> glob = array();
Title: Re: Buddylist cache to prevent logoff spam
Post by: porter on October 17, 2006, 11:52:59 pm
Oh looks good! Rare as it is (after all) people understandably dislike the logoff spam very much and poor bot gets called names even though it is not his fault ;)
SimplePortal 2.3.7 © 2008-2024, SimplePortal