diff options
author | Joshua Judson Rosen | 2017-04-17 00:53:18 -0400 |
---|---|---|
committer | Joshua Judson Rosen | 2017-04-17 00:53:18 -0400 |
commit | b15b9dd3e8c47c7dead249031089896b8c24b348 (patch) | |
tree | 732617f1829a55d0b71d775004c33bf8cda3f518 | |
parent | Fix #16 Accept command-line arguments. (diff) | |
download | ejabberd-auth-php-master.tar.gz |
-rw-r--r-- | plugins/gnusocial/BridgeGnusocial.php | 14 | ||||
-rw-r--r-- | plugins/gnusocial/gnusocial.module | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/plugins/gnusocial/BridgeGnusocial.php b/plugins/gnusocial/BridgeGnusocial.php new file mode 100644 index 0000000..bfac3fb --- /dev/null +++ b/plugins/gnusocial/BridgeGnusocial.php @@ -0,0 +1,14 @@ +<?php + +/** + * Implements EjabberdAuthBridge. + */ +class BridgeGnusocial extends EjabberdAuthBridge { + function isuser($username, $server) { + return Nickname::isTaken($username) != null; + } + + function auth($username, $server, $password) { + return common_check_user($username, $password) instanceof User; + } +} diff --git a/plugins/gnusocial/gnusocial.module b/plugins/gnusocial/gnusocial.module new file mode 100644 index 0000000..33e6e7d --- /dev/null +++ b/plugins/gnusocial/gnusocial.module @@ -0,0 +1,18 @@ +<?php + +function gnusocial_init($config) { + define('INSTALLDIR', $config['root_path']); + define('EJABBERD', true); + define('GNUSOCIAL', true); + define('STATUSNET', true); // compatibility + + $server = $config['server']; + require_once $config['root_path'] . 'lib/common.php'; + require_once $config['root_path'] . 'lib/util.php'; + + common_config_set('syslog', 'appname', 'ejabberd'); // too late for init... + + // Load the plugin. + require_once __DIR__ . '/BridgeGnusocial.php'; + return new BridgeGnusocial(); +} |