Skip to content

Commit

Permalink
Merge pull request #57 from nextcloud/enhancy_privacy
Browse files Browse the repository at this point in the history
Limit chatting to users in your group and allow to exclude certain groups
  • Loading branch information
LEDfan authored Feb 10, 2018
2 parents 104cd91 + 6ee3ea7 commit 3902e6b
Show file tree
Hide file tree
Showing 30 changed files with 1,808 additions and 502 deletions.
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

0 comments on commit 3902e6b

Please sign in to comment.