From 7f19dfd1616945c7e8ee9f41bee610d4ef1ffbe5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 4 Jun 2018 09:45:25 +0200 Subject: bin/ii-answer,lib/common-functions: irc now turn-off-able --- lib/common-functions | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/common-functions') diff --git a/lib/common-functions b/lib/common-functions index 4c852ac..be35144 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -708,16 +708,26 @@ extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name() { # shellcheck disable=SC2120 irc_say() { local channel + local channel_in_pipe if [ -z "$1" ]; then channel='#archlinux32' else channel="$1" fi + if [ -s "${work_dir}/irc-shut-up" ] && \ + [ "$(date '+%s')" -gt "$(cat "${work_dir}/irc-shut-up")" ]; then + rm "${work_dir}/irc-shut-up" + fi + if [ -s "${work_dir}/irc-shut-up" ]; then + channel_in_pipe='/dev/null' + else + channel_in_pipe="${irc_dir}/${channel}/in" + fi if [ -p "${irc_dir}/${channel}/in" ]; then if [ "$2" = 'copy' ]; then - pee cat 'sponge '"${irc_dir}/${channel}/in" + pee cat 'sponge '"${channel_in_pipe}" else - sponge "${irc_dir}/${channel}/in" + sponge "${channel_in_pipe}" fi fi } -- cgit v1.2.3-54-g00ecf