From a53ed534c0e521ae169634f38f391b5bf7ca21b3 Mon Sep 17 00:00:00 2001 From: pk910 Date: Wed, 27 Jul 2011 12:26:13 +0200 Subject: [PATCH] added ModCMD.class.php with simple binding principle --- ModCMD/Binding.class.php | 40 ++++++++++ ModCMD/ModCMD.class.php | 159 +++++++++++++++++++++++++++++++++++++++ main.php | 2 + 3 files changed, 201 insertions(+) create mode 100644 ModCMD/Binding.class.php create mode 100644 ModCMD/ModCMD.class.php diff --git a/ModCMD/Binding.class.php b/ModCMD/Binding.class.php new file mode 100644 index 0000000..dfb247f --- /dev/null +++ b/ModCMD/Binding.class.php @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/ModCMD/ModCMD.class.php b/ModCMD/ModCMD.class.php new file mode 100644 index 0000000..cbd6511 --- /dev/null +++ b/ModCMD/ModCMD.class.php @@ -0,0 +1,159 @@ +trigger(); + } + } + } + + public function event_newserver($server, $isBurst) { + $this->event(self::EVENT_NEWSERVER, array($server, $isBurst)); + } + + public function event_squit($server){ + $this->event(self::EVENT_SQUIT, array($server)); + } + + public function event_connect($user, $isBurst) { + $this->event(self::EVENT_CONNECT, array($user, $isBurst)); + } + + public function event_nick($user, $newNick) { + $this->event(self::EVENT_NICK, array($user, $newNick)); + } + + public function event_usermode($user, $modes) { + $this->event(self::EVENT_USERMODE, array($user, $modes)); + } + + public function event_quit($user, $reason) { + $this->event(self::EVENT_QUIT, array($user, $reason)); + } + + public function event_join($user, $channel, $isBurst) { + $this->event(self::EVENT_JOIN, array($user, $channel, $isBurst)); + } + + public function event_part($user, $channel, $reason) { + $this->event(self::EVENT_PART, array($user, $channel, $reason)); + } + + public function event_kick($user, $target, $channel, $reason) { + $this->event(self::EVENT_KICK, array($user, $target, $channel, $reason)); + } + + public function event_chanmode($user, $channel, $modes) { + $this->event(self::EVENT_CHANMODE, array($user, $channel, $modes)); + } + + public function event_chanmessage($user, $channel, $message) { + $this->event(self::EVENT_CHANMSG, array($user, $channel, $message)); + } + + public function event_channotice($user, $channel, $message) { + $this->event(self::EVENT_CHANNOTICE, array($user, $channel, $message)); + } + + public function event_privmessage($user, $channel, $message) { + $this->event(self::EVENT_PRIVMSG, array($user, $channel, $message)); + } + + public function event_privnotice($user, $channel, $message) { + $this->event(self::EVENT_PRIVNOTICE, array($user, $channel, $message)); + } + + public function event_preparse($from, $command, $arguments) { + $this->event(self::EVENT_PREPARSE, array($from, $command, $arguments)); + } + + public function event_unknown_cmd($from, $command, $arguments) { + $this->event(self::EVENT_UNKNOWNCMD, array($from, $command, $arguments)); + } + +} + +?> \ No newline at end of file diff --git a/main.php b/main.php index a217c69..95e82b2 100644 --- a/main.php +++ b/main.php @@ -33,6 +33,8 @@ $uplink->setUplinkHost("192.168.2.103", 4401); $uplink->setUplinkServer(5, "PHP.TestNet", "very_weak_password", "Test Server"); $uplink->setValidateServer("test.localhost", "very_weak_password"); +$uplink->setEventHandler(ModCMD::getEventHandler()); + $uplink->initialize(); while(true) { -- 2.20.1