3 #Support xmpp via sendxmpp
5 #XMPP_BIN="/usr/bin/sendxmpp"
6 #XMPP_BIN_ARGS="-n -t --tls-ca-path=/etc/ssl/certs"
7 #XMPP_TO="zzzz@example.com"
12 _statusCode
="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
13 _debug
"_subject" "$_subject"
14 _debug
"_content" "$_content"
15 _debug
"_statusCode" "$_statusCode"
17 XMPP_BIN
="${XMPP_BIN:-$(_readaccountconf_mutable XMPP_BIN)}"
18 if [ -n "$XMPP_BIN" ] && ! _exists
"$XMPP_BIN"; then
19 _err
"It seems that the command $XMPP_BIN is not in path."
22 _XMPP_BIN
=$
(_xmpp_bin
)
23 if [ -n "$XMPP_BIN" ]; then
24 _saveaccountconf_mutable XMPP_BIN
"$XMPP_BIN"
26 _clearaccountconf
"XMPP_BIN"
29 XMPP_BIN_ARGS
="${XMPP_BIN_ARGS:-$(_readaccountconf_mutable XMPP_BIN_ARGS)}"
30 if [ -n "$XMPP_BIN_ARGS" ]; then
31 _saveaccountconf_mutable XMPP_BIN_ARGS
"$XMPP_BIN_ARGS"
33 _clearaccountconf
"XMPP_BIN_ARGS"
36 XMPP_TO
="${XMPP_TO:-$(_readaccountconf_mutable XMPP_TO)}"
37 if [ -n "$XMPP_TO" ]; then
38 if ! _xmpp_valid
"$XMPP_TO"; then
39 _err
"It seems that the XMPP_TO=$XMPP_TO is not a valid xmpp address."
43 _saveaccountconf_mutable XMPP_TO
"$XMPP_TO"
46 result
=$
({ _xmpp_message |
eval "$(_xmpp_cmnd)"; } 2>&1)
48 # shellcheck disable=SC2181
50 _debug
"xmpp send error."
55 _debug
"xmpp send success."
60 if [ -n "$XMPP_BIN" ]; then
62 elif _exists
"sendxmpp"; then
65 _err
"Please install sendxmpp first."
73 case $
(basename "$_XMPP_BIN") in
75 echo "'$_XMPP_BIN' '$XMPP_TO' $XMPP_BIN_ARGS"
78 _err
"Command $XMPP_BIN is not supported, use sendxmpp."