summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gnusocial/BridgeGnusocial.php14
-rw-r--r--plugins/gnusocial/gnusocial.module18
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();
+}