class Circed::Services::MessageValidator

Overview

IRC message validation service implementing RFC 1459 compliance

Defined in:

circed/services/message_validator.cr

Constant Summary

MAX_CHANNEL_NAME_LENGTH = 200
MAX_KICK_REASON_LENGTH = 307
MAX_MESSAGE_LENGTH = 512

RFC 1459 states messages should not exceed 512 characters including CR-LF

MAX_NICK_LENGTH = 30
MAX_TOPIC_LENGTH = 307

Class Method Summary

Class Method Detail

def self.validate_away_message(message : String | Nil) : Bool #

Validate away message


[View source]
def self.validate_channel_name(name : String | Nil) : Bool #

Validate IRC channel name according to RFC 1459


[View source]
def self.validate_command_params(command : String, params : Array(String)) : Bool #

Validate IRC command parameters count


[View source]
def self.validate_irc_command(command : String, params : Array(String)) : String | Nil #

Comprehensive validation for IRC commands


[View source]
def self.validate_kick_reason(reason : String | Nil) : Bool #

Validate kick reason length


[View source]
def self.validate_message_text(message : String | Nil) : Bool #

Validate PRIVMSG/NOTICE message


[View source]
def self.validate_mode_string(mode_string : String | Nil) : Bool #

Validate mode string


[View source]
def self.validate_nickname(nickname : String | Nil) : Bool #

Validate IRC nickname according to RFC 1459


[View source]
def self.validate_raw_message(raw_message : String) : Bool #

Validate raw IRC message before parsing


[View source]
def self.validate_server_name(server_name : String | Nil) : Bool #

Validate server name


[View source]
def self.validate_topic(topic : String | Nil) : Bool #

Validate topic length


[View source]
def self.validate_username(username : String | Nil) : Bool #

Validate username according to RFC 1459


[View source]