|
Revision 66, 2.1 KB
(checked in by tobias382, 5 years ago)
|
|
* Added missing onKick handler method to the base plugin class
* Reverted Pong plugin to return hostname specified by the server
* Moved alternate nick functionality from the Nickserv plugin into its own plugin, Altnick
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | require_once 'Phergie/Plugin/Abstract/Command.php'; |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | class Phergie_Plugin_Nickserv extends Phergie_Plugin_Abstract_Command |
|---|
| 16 | { |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | protected $nick; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | public function init() |
|---|
| 30 | { |
|---|
| 31 | $this->nick = $this->getIni('nick'); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | public function onNotice() |
|---|
| 42 | { |
|---|
| 43 | if ($this->event->getNick() == 'NickServ') { |
|---|
| 44 | $message = $this->event->getArgument(1); |
|---|
| 45 | if ($message == 'This nickname is owned by someone else') { |
|---|
| 46 | $password = $this->getIni('password'); |
|---|
| 47 | if (! empty($password)) { |
|---|
| 48 | $this->doPrivmsg('NickServ', 'IDENTIFY ' . $password); |
|---|
| 49 | } |
|---|
| 50 | } elseif (preg_match('/^.*' . $this->nick . '.* has been killed/', $message)) { |
|---|
| 51 | $this->doNick($this->nick); |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | public function onNick() |
|---|
| 63 | { |
|---|
| 64 | if ($this->event->getSource() == $this->getIni('nick')) { |
|---|
| 65 | $this->setIni('nick', $this->event->getArgument(0)); |
|---|
| 66 | } |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | public function onDoGhostbust() |
|---|
| 75 | { |
|---|
| 76 | $password = $this->getIni('password'); |
|---|
| 77 | |
|---|
| 78 | if (!empty ($password) && $this->index != -1) { |
|---|
| 79 | $this->doPrivmsg( |
|---|
| 80 | 'NickServ', |
|---|
| 81 | 'GHOST ' . $this->nick . ' ' . $password |
|---|
| 82 | ); |
|---|
| 83 | } |
|---|
| 84 | } |
|---|
| 85 | } |
|---|