module
Circed::Utils::IrcUtils
Overview
Consolidated IRC utilities to eliminate duplicate validation and helper code
Defined in:
circed/utils/irc_utils.crClass Method Summary
- .each_list_param(param : String, & : String -> ) : Nil
- .format_hostmask(nickname : String, username : String, hostname : String) : String
- .mode_set(modes : String) : Set(Char)
- .mode_string(modes : Set(Char)) : String
- .send_bad_channel_key_error(sender : Client, channel_name : String)
- .send_banned_from_channel_error(sender : Client, channel_name : String)
- .send_cannot_send_to_channel_error(sender : Client, channel_name : String)
- .send_channel_error(sender : Client, channel_name : String)
- .send_channel_full_error(sender : Client, channel_name : String)
- .send_invite_only_error(sender : Client, channel_name : String)
- .send_nickname_in_use_error(sender : Client, nickname : String)
- .send_no_such_channel_error(sender : Client, channel_name : String)
-
.send_no_such_nick_error(sender : Client, nickname : String)
Common error sending helpers
- .send_not_on_channel_error(sender : Client, channel_name : String)
- .send_not_operator_error(sender : Client, channel_name : String)
- .send_not_registered_error(sender : Client)
- .send_user_on_channel_error(sender : Client, channel_name : String)
- .send_users_dont_match_error(sender : Client)
- .split_list_param(param : String) : Array(String)
- .split_list_param(param : String | Nil) : Array(String)
- .trailing_param(params : Array(String), start_index : Int32, default = "") : String
-
.user_has_channel_mode?(channel : Domain::Channel, nickname : String, mode : Char) : Bool
Check if a user has a specific mode in a channel
-
.user_is_operator?(channel : Domain::Channel, nickname : String) : Bool
Check if user is operator in channel
-
.valid_channel_name?(channel_name : String) : Bool
Channel validation utilities
-
.valid_nickname?(nickname : String) : Bool
Nickname validation utilities
-
.validate_channel_name(sender : Client, channel_name : String) : Bool
Validate channel name and send error if invalid
Class Method Detail
def self.format_hostmask(nickname : String, username : String, hostname : String) : String
#
Common error sending helpers
def self.trailing_param(params : Array(String), start_index : Int32, default = "") : String
#
def self.user_has_channel_mode?(channel : Domain::Channel, nickname : String, mode : Char) : Bool
#
Check if a user has a specific mode in a channel
def self.user_is_operator?(channel : Domain::Channel, nickname : String) : Bool
#
Check if user is operator in channel
Validate channel name and send error if invalid