Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit chatting to users in your group and allow to exclude certain groups #57

Merged
merged 15 commits into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 56 additions & 7 deletions appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
use OCA\OJSXC\StanzaLogger;
use OCA\OJSXC\RawRequest;
use OCA\OJSXC\DataRetriever;
use OCP\AppFramework\App;
use OCA\OJSXC\UserProvider;
use OCA\OJSXC\ILock;
use OCA\OJSXC\DbLock;
use OCA\OJSXC\MemLock;
use OCA\OJSXC\Hooks;
use OCA\OJSXC\UserManagerUserProvider;
use OCA\OJSXC\ContactsStoreUserProvider;
use OCP\AppFramework\App;
use OCP\IContainer;
use OCP\IRequest;

Expand All @@ -50,6 +53,9 @@ public function __construct(array $urlParams=array()){
['locking' => false]);


/**
* Controllers
*/
$container->registerService('HttpBindController', function(IContainer $c) {
return new HttpBindController(
$c->query('AppName'),
Expand Down Expand Up @@ -153,7 +159,8 @@ public function __construct(array $urlParams=array()){
$c->query('OJSXC_UserId'),
$c->query('MessageMapper'),
$c->query('NewContentContainer'),
self::$config['polling']['timeout']
self::$config['polling']['timeout'],
$c->query('UserProvider')
);
});

Expand All @@ -166,7 +173,8 @@ public function __construct(array $urlParams=array()){
$c->query('OJSXC_UserId'),
$c->query('Host'),
$c->query('OCP\IUserManager'),
$c->query('OCP\IConfig')
$c->query('OCP\IConfig'),
$c->query('UserProvider')
);
});

Expand All @@ -183,7 +191,9 @@ public function __construct(array $urlParams=array()){
return new Message(
$c->query('OJSXC_UserId'),
$c->query('Host'),
$c->query('MessageMapper')
$c->query('MessageMapper'),
$c->query('UserProvider'),
$c->query('OCP\ILogger')
);
});

Expand All @@ -196,6 +206,9 @@ public function __construct(array $urlParams=array()){
return $request->getServerHost();
});

/**
* Helpers
*/
$container->registerService('NewContentContainer', function() {
return new NewContentContainer();
});
Expand All @@ -214,7 +227,8 @@ public function __construct(array $urlParams=array()){
$c->query('ServerContainer')->getUserSession(),
$c->query('Host'),
$c->query('IQRosterPushMapper'),
$c->query('ServerContainer')->getDatabaseConnection()
$c->query('ServerContainer')->getDatabaseConnection(),
$c->query('UserProvider')
);
});

Expand All @@ -224,14 +238,36 @@ public function __construct(array $urlParams=array()){
$c->query('ServerContainer')->getUserSession(),
$c->query('RosterPush'),
$c->query('PresenceMapper'),
$c->query('StanzaMapper')
$c->query('StanzaMapper'),
$c->query('ServerContainer')->query('GroupManager')
);
});

$container->registerService('UserProvider', function(IContainer $c) {
if (self::contactsStoreApiSupported()) {
return new ContactsStoreUserProvider(
$c->query('OCP\Contacts\ContactsMenu\IContactsStore'),
$c->query('ServerContainer')->getUserSession(),
$c->query('ServerContainer')->getUserManager(),
$c->query('OCP\IGroupManager'),
$c->query('OCP\IConfig')
);
} else {
return new UserManagerUserProvider(
$c->query('ServerContainer')->getUserManager()
);
}
});


/**
* Commands
*/
$container->registerService('RefreshRosterCommand', function($c) {
return new RefreshRoster(
$c->query('ServerContainer')->getUserManager(),
$c->query('RosterPush')
$c->query('RosterPush'),
$c->query('PresenceMapper')
);
});

Expand All @@ -257,6 +293,10 @@ public function __construct(array $urlParams=array()){
return new DataRetriever();
});


/**
* Migrations
*/
$container->registerService('OCA\OJSXC\Migration\RefreshRoster', function(IContainer $c) {
return new RefreshRosterMigration(
$c->query('RosterPush'),
Expand Down Expand Up @@ -304,4 +344,13 @@ static public function santizeUserId($userId) {
)
);
}

/**
* @return bool whether the ContactsStore API is enabled
*/
public static function contactsStoreApiSupported() {
$version = \OCP\Util::getVersion();
return $version[0] >= 13;
}

}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"sabre/uri": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "*.*",
"phpunit/phpunit": "^6.5|^5.7",
"friendsofphp/php-cs-fixer": "^2.4|^2.10"
}
}
Loading