Fixed a bug with irc parsing.
This commit is contained in:
@@ -12,6 +12,18 @@ channelName="$2"
|
||||
shift 2
|
||||
message="$*"
|
||||
|
||||
# Sanitize username (extract just the nickname, max 30 chars per IRC RFC)
|
||||
# Remove any IRC protocol remnants, hostmask info, etc.
|
||||
name="${name%%!*}" # Remove hostmask if present
|
||||
name="${name%%[[:space:]]*}" # Remove any trailing data
|
||||
name="${name//[^a-zA-Z0-9_\[\]\{\}\\|\^-]/}" # Only allow valid IRC nick chars
|
||||
name="${name:0:30}" # Limit to max IRC nickname length
|
||||
|
||||
# If name is empty or invalid after sanitization, skip
|
||||
if [[ -z "$name" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Sanitize channel name (remove any IRC protocol remnants)
|
||||
channelName="${channelName%%[[:space:]]*}"
|
||||
channelName="${channelName//[^a-zA-Z0-9#_-]/}"
|
||||
|
||||
Reference in New Issue
Block a user