X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FIrc%2FIrcPlugin.php;h=99dc4b2bc125e54e22b86b6e4beca3fded6cf301;hb=26703076f66f77f337559416cc02101c532d7aa8;hp=7a53e5cbf5821af2101c3c2a995f71348c1c46fb;hpb=1513b8eeb921538e4e342c2c6d64b2c0d1aed2dd;p=quix0rs-gnu-social.git diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php index 7a53e5cbf5..99dc4b2bc1 100644 --- a/plugins/Irc/IrcPlugin.php +++ b/plugins/Irc/IrcPlugin.php @@ -47,7 +47,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/ext * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class IrcPlugin extends ImPlugin { public $host = null; public $port = null; @@ -76,6 +75,7 @@ class IrcPlugin extends ImPlugin { * @return string Name of service */ public function getDisplayName() { + // TRANS: Service name for IRC. return _m('IRC'); } @@ -120,24 +120,13 @@ class IrcPlugin extends ImPlugin { * @return boolean hook value; true means continue processing, false means stop. */ public function onAutoload($cls) { - $dir = dirname(__FILE__); - - switch ($cls) { - case 'IrcManager': - include_once $dir . '/'.strtolower($cls).'.php'; - return false; - case 'Fake_Irc': - case 'Irc_waiting_message': - case 'ChannelResponseChannel': - include_once $dir . '/'. $cls .'.php'; - return false; - default: - if (substr($cls, 0, 7) == 'Phergie') { - include_once str_replace('_', DIRECTORY_SEPARATOR, $cls) . '.php'; - return false; - } - return true; + // in the beginning of this file, we have added an include path + if (substr($cls, 0, 7) == 'Phergie') { + include_once str_replace('_', DIRECTORY_SEPARATOR, $cls) . '.php'; + return false; } + + return parent::onAutoload($cls); } /* @@ -147,7 +136,7 @@ class IrcPlugin extends ImPlugin { * @return boolean */ public function onStartImDaemonIoManagers(&$classes) { - parent::onStartImDaemonIoManagers(&$classes); + parent::onStartImDaemonIoManagers($classes); $classes[] = new IrcManager($this); // handles sending/receiving return true; } @@ -160,15 +149,7 @@ class IrcPlugin extends ImPlugin { $schema = Schema::get(); // For storing messages while sessions become ready - $schema->ensureTable('irc_waiting_message', - array(new ColumnDef('id', 'integer', null, - false, 'PRI', null, null, true), - new ColumnDef('data', 'blob', null, false), - new ColumnDef('prioritise', 'tinyint', 1, false), - new ColumnDef('attempts', 'integer', null, false), - new ColumnDef('created', 'datetime', null, false), - new ColumnDef('claimed', 'datetime'))); - + $schema->ensureTable('irc_waiting_message', Irc_waiting_message::schemaDef()); return true; } @@ -290,12 +271,15 @@ class IrcPlugin extends ImPlugin { * @return boolean success value */ public function sendConfirmationCode($screenname, $code, $user, $checked = false) { - $body = sprintf(_('User "%s" on %s has said that your %s screenname belongs to them. ' . + // TRANS: Body text for e-mail confirmation message for IRC. + // TRANS: %1$s is a user nickname, %2$s is the StatusNet sitename, + // TRANS: %3$s is the plugin display name ("IRC"), %4$s is the confirm address URL. + $body = sprintf(_m('User "%1$s" on %2$s has said that your %3$s screenname belongs to them. ' . 'If that\'s true, you can confirm by clicking on this URL: ' . - '%s' . + '%4$s' . ' . (If you cannot click it, copy-and-paste it into the ' . - 'address bar of your browser). If that user isn\'t you, ' . - 'or if you didn\'t request this confirmation, just ignore this message.'), + 'address bar of your browser). If that user is not you, ' . + 'or if you did not request this confirmation, just ignore this message.'), $user->nickname, common_config('site', 'name'), $this->getDisplayName(), common_local_url('confirmaddress', array('code' => $code))); if ($this->regcheck && !$checked) { @@ -339,16 +323,20 @@ class IrcPlugin extends ImPlugin { */ public function initialize() { if (!isset($this->host)) { - throw new Exception('must specify a host'); + // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration. + throw new Exception(_m('You must specify a host.')); } if (!isset($this->username)) { - throw new Exception('must specify a username'); + // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration. + throw new Exception(_m('You must specify a username.')); } if (!isset($this->realname)) { - throw new Exception('must specify a "real name"'); + // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration. + throw new Exception(_m('You must specify a "real name".')); } if (!isset($this->nick)) { - throw new Exception('must specify a nickname'); + // TRANS: Exception thrown when initialising the IRC plugin fails because of an incorrect configuration. + throw new Exception(_m('You must specify a nickname.')); } if (!isset($this->port)) { @@ -368,7 +356,7 @@ class IrcPlugin extends ImPlugin { $this->regcheck = true; } - $this->fake_irc = new Fake_Irc; + $this->fake_irc = new FakeIrc; /* * Commands allowed to return output to a channel @@ -384,12 +372,13 @@ class IrcPlugin extends ImPlugin { * @param array $versions Array to insert information into * @return void */ - public function onPluginVersion(&$versions) { + public function onPluginVersion(array &$versions) { $versions[] = array('name' => 'IRC', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Luke Fitzgerald', 'homepage' => 'http://status.net/wiki/Plugin:IRC', 'rawdescription' => + // TRANS: Plugin description. _m('The IRC plugin allows users to send and receive notices over an IRC network.')); return true; }