├── .gitignore ├── package.json ├── routing.yml ├── LICENSE ├── gulpfile.js ├── Plugin.php ├── README.md └── Controller └── OperatorStatusController.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Do not index node.js modules that are used for building 2 | node_modules 3 | package-lock.json 4 | 5 | # Do not index releases 6 | release -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.4.0", 3 | "devDependencies": { 4 | "event-stream": "3.3.4", 5 | "gulp": "^4.0.0", 6 | "gulp-chmod": "~3.0.0", 7 | "gulp-gzip": "~1.1.0", 8 | "gulp-rename": "~1.2.2", 9 | "gulp-tar": "~3.1.0", 10 | "gulp-zip": "~3.0.2" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /routing.yml: -------------------------------------------------------------------------------- 1 | mibew_operator_status_has_online_operators: 2 | path: /opstatus 3 | defaults: 4 | _controller: Mibew\Mibew\Plugin\OperatorStatus\Controller\OperatorStatusController::hasOnlineOperatorsAction 5 | 6 | mibew_operator_status_has_online_group_operators: 7 | path: /opstatus/group/{group_id} 8 | defaults: 9 | _controller: Mibew\Mibew\Plugin\OperatorStatus\Controller\OperatorStatusController::isOperatorGroupOnlineAction 10 | 11 | mibew_operator_status_is_operator_online: 12 | path: /opstatus/{opcode} 13 | defaults: 14 | _controller: Mibew\Mibew\Plugin\OperatorStatus\Controller\OperatorStatusController::isOperatorOnlineAction 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 罗光盛 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var eventStream = require('event-stream'), 2 | gulp = require('gulp'), 3 | chmod = require('gulp-chmod'), 4 | zip = require('gulp-zip'), 5 | tar = require('gulp-tar'), 6 | gzip = require('gulp-gzip'), 7 | rename = require('gulp-rename'); 8 | 9 | gulp.task('prepare-release', function() { 10 | var version = require('./package.json').version; 11 | 12 | return eventStream.merge( 13 | getSources() 14 | .pipe(zip('operator-status-plugin-' + version + '.zip')), 15 | getSources() 16 | .pipe(tar('operator-status-plugin-' + version + '.tar')) 17 | .pipe(gzip()) 18 | ) 19 | .pipe(chmod(0644)) 20 | .pipe(gulp.dest('release')); 21 | }); 22 | 23 | // Builds and packs plugins sources 24 | gulp.task('default', gulp.series('prepare-release')); 25 | 26 | /** 27 | * Returns files stream with the plugin sources. 28 | * 29 | * @returns {Object} Stream with VinylFS files. 30 | */ 31 | var getSources = function() { 32 | return gulp.src([ 33 | 'Controller/*', 34 | 'LICENSE', 35 | 'Plugin.php', 36 | 'README.md', 37 | 'routing.yml' 38 | ], 39 | {base: './'} 40 | ) 41 | .pipe(rename(function(path) { 42 | path.dirname = 'Mibew/Mibew/Plugin/OperatorStatus/' + path.dirname; 43 | })); 44 | } -------------------------------------------------------------------------------- /Plugin.php: -------------------------------------------------------------------------------- 1 | /opstatus`. 9 | * return `true` when any operators is online and `false` when not. 10 | 11 | 2. Get any operators online status in specificed group: 12 | 13 | * request URL: `/opstatus/group/`. 14 | * return `true` when any operators in this group is online and `false` when not. 15 | 16 | 3. Get an operator online status by operator code: 17 | 18 | * Request URL: `/opstatus/`. 19 | * return `true` when operator is online or `false` when not. 20 | 21 | 4. Use callback parameter: 22 | 23 | Just insert `