summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-12 12:30:05 +0200
committerErich Eckner <git@eckner.net>2019-07-12 12:30:05 +0200
commit7ad66ef22310927aa8956766f8207c1b4a9cb526 (patch)
tree46e1a4e0aca2b728374a0c8dc6211a4b1abd6b46 /lib
parentcc89a2abeaaa02b5e6c225733cc426f5018d1483 (diff)
downloadbuilder-7ad66ef22310927aa8956766f8207c1b4a9cb526.tar.xz
lib/common-functions: irc_say(): correctly handle starting of (pm) conversation
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 73628b7..b8eb383 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -768,7 +768,7 @@ extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name() {
# shellcheck disable=SC2120
irc_say() {
local channel
- local channel_in_pipe
+ local content
if [ -z "$1" ]; then
channel='#archlinux32'
else
@@ -778,18 +778,21 @@ irc_say() {
[ "$(date '+%s')" -gt "$(cat "${work_dir}/irc-shut-up")" ]; then
rm "${work_dir}/irc-shut-up"
fi
+ content=$(cat)
+ if [ "$2" = 'copy' ]; then
+ printf '%s\n' "${content}"
+ fi
if [ -s "${work_dir}/irc-shut-up" ] && \
[ -z "${channel%%#*}" ]; then
- channel_in_pipe='/dev/null'
- else
- channel_in_pipe="${irc_dir}/${channel}/in"
+ return
fi
if [ -p "${irc_dir}/${channel}/in" ]; then
- if [ "$2" = 'copy' ]; then
- pee cat 'sponge '"${channel_in_pipe}"
- else
- sponge "${channel_in_pipe}"
- fi
+ printf '%s\n' "${content}" \
+ | sponge "${irc_dir}/${channel}/in"
+ else
+ printf '%s\n' "${content}" \
+ sed 's@^@/j '"${channel}"' @' \
+ | sponge "${irc_dir}/${channel}/in"
fi
}