From 4ce16e9e919ac214c5ee712dc3f55a3dcd13c3ea Mon Sep 17 00:00:00 2001 From: ilu33 Date: Thu, 24 Nov 2016 04:32:23 +0100 Subject: Configuring email notifications per channel --- util/nconfig.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 util/nconfig.php (limited to 'util/nconfig.php') diff --git a/util/nconfig.php b/util/nconfig.php new file mode 100644 index 000000000..cb24b2151 --- /dev/null +++ b/util/nconfig.php @@ -0,0 +1,56 @@ +#!/usr/bin/env php +' . PHP_EOL; + exit(1); +} + +require_once('include/cli_startup.php'); +require_once('include/channel.php'); + +cli_startup(); + + + if($argc != 2) { + echo 'Usage: util/nconfig channel_id|channel_address off|on' . PHP_EOL; + exit(1); + } + + if(ctype_digit($argv[1])) { + $c = channelx_by_n($argv[1]); + } + else { + $c = channelx_by_nick($argv[1]); + } + + if(! $c) { + echo t('Source channel not found.'); + exit(1); + } + + switch ($argv[2]) { + case 'off': + $result = notifications_off($c['channel_id']); + break; + case 'on': + $result = notifications_on($c['channel_id']); + break; + default: + echo 'Only on or off in lower cases are allowed' . PHP_EOL; + exit(1); + } + + if($result['success'] == false) { + echo $result['message']; + exit(1); + } + + exit(0); + -- cgit v1.2.3