Overview

Namespaces

  • Budabot
    • Core
      • Modules
    • User
      • Modules
  • None
  • Tyrence
    • Modules

Classes

  • AccessLevel
  • Budabot\Core\AccessManager
  • Budabot\Core\AdminManager
  • Budabot\Core\AOChat
  • Budabot\Core\AOChatPacket
  • Budabot\Core\AOChatQueue
  • Budabot\Core\AOExtMsg
  • Budabot\Core\AsyncHttp
  • Budabot\Core\AutoInject
  • Budabot\Core\BotRunner
  • Budabot\Core\Budabot
  • Budabot\Core\BuddylistManager
  • Budabot\Core\CacheManager
  • Budabot\Core\CacheResult
  • Budabot\Core\ClassLoader
  • Budabot\Core\ColorSettingHandler
  • Budabot\Core\CommandAlias
  • Budabot\Core\CommandManager
  • Budabot\Core\ConfigFile
  • Budabot\Core\DB
  • Budabot\Core\DBRow
  • Budabot\Core\EventLoop
  • Budabot\Core\EventManager
  • Budabot\Core\GuildChannelCommandReply
  • Budabot\Core\GuildManager
  • Budabot\Core\HelpManager
  • Budabot\Core\Http
  • Budabot\Core\HttpRequest
  • Budabot\Core\LegacyLogger
  • Budabot\Core\LimitsController
  • Budabot\Core\LoggerWrapper
  • Budabot\Core\MMDBParser
  • Budabot\Core\Modules\AdminController
  • Budabot\Core\Modules\AliasController
  • Budabot\Core\Modules\AltInfo
  • Budabot\Core\Modules\AltsController
  • Budabot\Core\Modules\BanController
  • Budabot\Core\Modules\BuddylistController
  • Budabot\Core\Modules\ColorsController
  • Budabot\Core\Modules\CommandlistController
  • Budabot\Core\Modules\CommandSearchController
  • Budabot\Core\Modules\ConfigController
  • Budabot\Core\Modules\EventlistController
  • Budabot\Core\Modules\HelpController
  • Budabot\Core\Modules\LogsController
  • Budabot\Core\Modules\PlayerLookupController
  • Budabot\Core\Modules\ProfileCommandReply
  • Budabot\Core\Modules\ProfileController
  • Budabot\Core\Modules\SettingsController
  • Budabot\Core\Modules\SQLController
  • Budabot\Core\Modules\SystemController
  • Budabot\Core\Modules\UsageController
  • Budabot\Core\Modules\WhitelistController
  • Budabot\Core\NumberSettingHandler
  • Budabot\Core\OptionsSettingHandler
  • Budabot\Core\PlayerHistory
  • Budabot\Core\PlayerHistoryManager
  • Budabot\Core\PlayerManager
  • Budabot\Core\Preferences
  • Budabot\Core\PrivateChannelCommandReply
  • Budabot\Core\PrivateMessageCommandReply
  • Budabot\Core\Registry
  • Budabot\Core\SettingHandler
  • Budabot\Core\SettingManager
  • Budabot\Core\SettingObject
  • Budabot\Core\SocketManager
  • Budabot\Core\SocketNotifier
  • Budabot\Core\SubcommandManager
  • Budabot\Core\Text
  • Budabot\Core\TextSettingHandler
  • Budabot\Core\Timer
  • Budabot\Core\TimerEvent
  • Budabot\Core\TimeSettingHandler
  • Budabot\Core\Util
  • Budabot\Core\xml
  • Budabot\User\Modules\AlienArmorController
  • Budabot\User\Modules\AlienBioController
  • Budabot\User\Modules\AlienMiscController
  • Budabot\User\Modules\AOSpeakController
  • Budabot\User\Modules\AOUController
  • Budabot\User\Modules\AXPController
  • Budabot\User\Modules\BankController
  • Budabot\User\Modules\BosslootController
  • Budabot\User\Modules\BroadcastController
  • Budabot\User\Modules\BuffPerksController
  • Budabot\User\Modules\CacheController
  • Budabot\User\Modules\ChatAssistController
  • Budabot\User\Modules\ChatCheckController
  • Budabot\User\Modules\ChatLeaderController
  • Budabot\User\Modules\ChatRallyController
  • Budabot\User\Modules\ChatSayController
  • Budabot\User\Modules\ChatTopicController
  • Budabot\User\Modules\CityWaveController
  • Budabot\User\Modules\CloakController
  • Budabot\User\Modules\ClusterController
  • Budabot\User\Modules\CountdownController
  • Budabot\User\Modules\DevController
  • Budabot\User\Modules\DingController
  • Budabot\User\Modules\EventsController
  • Budabot\User\Modules\FightController
  • Budabot\User\Modules\FindOrgController
  • Budabot\User\Modules\FindPlayerController
  • Budabot\User\Modules\FunController
  • Budabot\User\Modules\GitController
  • Budabot\User\Modules\GuideController
  • Budabot\User\Modules\GuildController
  • Budabot\User\Modules\HelpbotController
  • Budabot\User\Modules\HtmlDecodeController
  • Budabot\User\Modules\ImplantController
  • Budabot\User\Modules\ImplantDesignerController
  • Budabot\User\Modules\InactiveMemberController
  • Budabot\User\Modules\ItemsController
  • Budabot\User\Modules\KillOnSightController
  • Budabot\User\Modules\LevelController
  • Budabot\User\Modules\LinksController
  • Budabot\User\Modules\LootListsController
  • Budabot\User\Modules\MdbController
  • Budabot\User\Modules\MessageInfoCommandReply
  • Budabot\User\Modules\MockCommandReply
  • Budabot\User\Modules\NanoController
  • Budabot\User\Modules\NewsController
  • Budabot\User\Modules\NotesController
  • Budabot\User\Modules\OnlineController
  • Budabot\User\Modules\OrgHistoryController
  • Budabot\User\Modules\OrglistController
  • Budabot\User\Modules\OrgMembersController
  • Budabot\User\Modules\OSController
  • Budabot\User\Modules\PlayerHistoryController
  • Budabot\User\Modules\PlayfieldController
  • Budabot\User\Modules\PocketbossController
  • Budabot\User\Modules\PremadeImplantController
  • Budabot\User\Modules\PrivateChannelController
  • Budabot\User\Modules\QuoteController
  • Budabot\User\Modules\RaffleController
  • Budabot\User\Modules\RaidController
  • Budabot\User\Modules\RandomController
  • Budabot\User\Modules\RecipeController
  • Budabot\User\Modules\RelayController
  • Budabot\User\Modules\ReputationController
  • Budabot\User\Modules\ResearchController
  • Budabot\User\Modules\RunAsController
  • Budabot\User\Modules\SendTellController
  • Budabot\User\Modules\ShoppingController
  • Budabot\User\Modules\SilenceController
  • Budabot\User\Modules\SkillsController
  • Budabot\User\Modules\SpiritsController
  • Budabot\User\Modules\StopwatchController
  • Budabot\User\Modules\Teamspeak3
  • Budabot\User\Modules\TeamspeakController
  • Budabot\User\Modules\TestController
  • Budabot\User\Modules\TimeController
  • Budabot\User\Modules\TimerController
  • Budabot\User\Modules\TimezoneController
  • Budabot\User\Modules\TowerController
  • Budabot\User\Modules\TrackerController
  • Budabot\User\Modules\TrickleController
  • Budabot\User\Modules\UnixtimeController
  • Budabot\User\Modules\VoteController
  • Budabot\User\Modules\WeatherController
  • Budabot\User\Modules\WhatBuffsController
  • Budabot\User\Modules\WhereisController
  • Budabot\User\Modules\WhoisController
  • Budabot\User\Modules\WhoisOrgController
  • Budabot\User\Modules\WhompahController
  • Command
  • DefaultStatus
  • DefineCommand
  • Description
  • Event
  • HandlesCommand
  • Help
  • Inject
  • Instance
  • Intoptions
  • Matches
  • Options
  • Setting
  • Setup
  • Type
  • Tyrence\Modules\DemoResponseCommandReply
  • Tyrence\Modules\SameChannelResponseController
  • Visibility

Interfaces

  • Budabot\Core\CommandReply

Exceptions

  • Budabot\Core\InvalidHttpRequest
  • Budabot\Core\SQLException
  • Budabot\Core\StopExecutionException

Functions

  • Budabot\Core\isWindows
  • Budabot\Core\Modules\read_input
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace Budabot\Core;
  4: 
  5: /*
  6: * $Id: aochat.php,v 1.1 2006/12/08 15:17:54 genesiscl Exp $
  7: *
  8: * Modified to handle the recent problem with the integer overflow
  9: *
 10: * Copyright (C) 2002-2005  Oskari Saarenmaa <auno@auno.org>.
 11: *
 12: * AOChat, a PHP class for talking with the Anarchy Online chat servers.
 13: * It requires the sockets extension (to connect to the chat server..)
 14: * from PHP 4.2.0+ and either the GMP or BCMath extension (for generating
 15: * and calculating the login keys) to work.
 16: *
 17: * A disassembly of the official java chat client[1] for Anarchy Online
 18: * and Slicer's AO::Chat perl module[2] were used as a reference for this
 19: * class.
 20: *
 21: * [1]: <http://www.anarchy-online.com/content/community/forumsandchat/>
 22: * [2]: <http://www.hackersquest.org/ao/>
 23: *
 24: * Updates to this class can be found from the following web site:
 25: *   http://auno.org/dev/aochat.html
 26: *
 27: **************************************************************************
 28: *
 29: * This program is free software; you can redistribute it and/or modify
 30: * it under the terms of the GNU General Public License as published by
 31: * the Free Software Foundation; either version 2 of the License, or
 32: * (at your option) any later version.
 33: *
 34: * This program is distributed in the hope that it will be useful, but
 35: * WITHOUT ANY WARRANTY; without even the implied warranty of
 36: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37: * General Public License for more details.
 38: *
 39: * You should have received a copy of the GNU General Public License
 40: * along with this program; if not, write to the Free Software
 41: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 42: * USA
 43: *
 44: */
 45: 
 46: /* Prioritized chat message queue. */
 47: 
 48: define('AOC_PRIORITY_HIGH',           1000);
 49: define('AOC_PRIORITY_MED',             500);
 50: define('AOC_PRIORITY_LOW',             100);
 51: 
 52: class AOChatQueue {
 53: 
 54:     var $queue;
 55:     var $qsize;  // the number of items in the queue for any priority
 56:     var $point;  // the next time we can send a message
 57:     var $limit;  // the amount of messages that can be sent before metering kicks in
 58:     var $increment;  // the amount of time in seconds to wait after the limit has been reached
 59: 
 60:     function __construct($limit, $increment) {
 61:         $this->limit = $limit;
 62:         $this->increment = $increment;
 63:         $this->point = 0;
 64:         $this->queue = array();
 65:         $this->qsize = 0;
 66:     }
 67: 
 68:     function push($priority, $item) {
 69:         $now = time();
 70: 
 71:         if (isset($this->queue[$priority])) {
 72:             $this->queue[$priority][] = $item;
 73:         } else {
 74:             $this->queue[$priority] = array($item);
 75:             krsort($this->queue);
 76:         }
 77:         $this->qsize++;
 78:     }
 79: 
 80:     function getNext() {
 81:         if ($this->qsize === 0) {
 82:             return null;
 83:         }
 84:         $now = time();
 85:         if ($this->point > $now) {
 86:             return null;
 87:         }
 88: 
 89:         forEach (array_keys($this->queue) as $priority) {
 90:             while (true) {
 91:                 $item = array_shift($this->queue[$priority]);
 92:                 if ($item === null) {
 93:                     unset($this->queue[$priority]);
 94:                     break;
 95:                 }
 96: 
 97:                 // $limit specifies how much buffer we have
 98:                 // this check makes sure we don't go beyond that buffer
 99:                 if ($this->point < ($now - $this->limit)) {
100:                     $this->point = $now - $this->limit;
101:                 }
102: 
103:                 $this->point += $this->increment;
104:                 $this->qsize--;
105:                 return $item;
106:             }
107:         }
108:         return null;
109:     }
110: }
111: 
Budabot 4 Docs API documentation generated by ApiGen