From 68258b65eeadbf68c3491dc142f034ed7e8a77b2 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Mon, 12 Jul 2021 00:41:59 -0500 Subject: [PATCH] Add more irc commands --- rowbot | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/rowbot b/rowbot index 21851ad..4f83a08 100755 --- a/rowbot +++ b/rowbot @@ -629,6 +629,24 @@ irc_nick() { net_send "NICK :%s" "$1" } +irc_notice() { + local msg=$2 msg_len + + if [[ -v config[host] ]]; then + (( msg_len = 494 - (${#config[nick]} + ${#config[ident]} + ${#config[host]} + ${#1}) )) + log_debug "max message length is %d" "$msg_len" + + while (( ${#msg} > msg_len )); do + net_send "NOTICE %s :"$'\xe2\x80\x8b'"%s" "$1" "${msg:0:$msg_len}" + log_info "[%s/%s] %s" "${config[nick]}" "$1" "${msg:0:$msg_len}" + msg=${msg:$msg_len} + done + fi + + net_send "NOTICE %s :"$'\xe2\x80\x8b'"%s" "$1" "$msg" + log_info "[%s/%s] %s" "${config[nick]}" "$1" "$msg" +} + irc_ping() { net_send "PING :%s" "$1" } @@ -667,6 +685,24 @@ irc_who() { fi } +irc_part() { + if (( $# )); then + if (( $# > 1 )); then + net_send "PART $1 :$2" + else + net_send "PART $1" + fi + fi +} + +irc_quit() { + if (( $# )); then + net_send "QUIT :%s" "$1" + else + net_send QUIT + fi +} + ### # plugin api ###