irc-core-2.13: IRC core library for glirc

Copyright | (c) Eric Mertens 2016
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | Safe-Inferred
Language | Haskell2010

Irc.Modes

Contents

- Interpretation of modes
- Operations for working with MODE command parameters

Description

This module provides support for interpreting the modes changed by a MODE command.

Synopsis

- data ModeTypes = ModeTypes {
  - _modesLists :: [Char]
  - _modesAlwaysArg :: [Char]
  - _modesSetArg :: [Char]
  - _modesNeverArg :: [Char]
  - _modesPrefixModes :: [(Char, Char)]
  }
- modesLists :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes
- modesAlwaysArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes
- modesSetArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes
- modesNeverArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes
- modesPrefixModes :: Functor f => ([(Char, Char)] -> f [(Char, Char)]) -> ModeTypes -> f ModeTypes
- defaultModeTypes :: ModeTypes
- defaultUmodeTypes :: ModeTypes
- splitModes :: ModeTypes -> Text -> [Text] -> Maybe [(Bool, Char, Text)]
- unsplitModes :: [(Bool, Char, Text)] -> [Text]

# Interpretation of modes

data ModeTypes Source #

Settings that describe how to interpret channel modes

Constructors

ModeTypes |

Fields

- _modesLists :: [Char]

  modes for channel lists (e.g. ban)

- _modesAlwaysArg :: [Char]

  modes that always have an argument

- _modesSetArg :: [Char]

  modes that have an argument when set

- _modesNeverArg :: [Char]

  modes that never have arguments

- _modesPrefixModes :: [(Char, Char)]

  modes requiring a nickname argument (mode,sigil)

#### Instances

Instances details

Show ModeTypes Source # |
Instance details Defined in Irc.Modes Methods showsPrec :: Int -> ModeTypes -> ShowS Source # show :: ModeTypes -> String Source # showList :: [ModeTypes] -> ShowS Source #

modesLists :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes Source #

Lens for `_modesList`

modesAlwaysArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes Source #

Lens for `_modesAlwaysArg`

modesSetArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes Source #

Lens for `_modesSetArg`

modesNeverArg :: Functor f => ([Char] -> f [Char]) -> ModeTypes -> f ModeTypes Source #

Lens for `_modesNeverArg`

modesPrefixModes :: Functor f => ([(Char, Char)] -> f [(Char, Char)]) -> ModeTypes -> f ModeTypes Source #

Lens for `_modesPrefixModes`

defaultModeTypes :: ModeTypes Source #

The channel modes used by Solanum

defaultUmodeTypes :: ModeTypes Source #

The default UMODE used by Solanum

# Operations for working with MODE command parameters

splitModes Source #

Arguments

:: ModeTypes | mode interpretation
-> Text | modes
-> [Text] | arguments
-> Maybe [(Bool, Char, Text)] | (set, mode, parameter)

Split up a mode change command and arguments into individual changes given a configuration.

unsplitModes Source #

Arguments

:: [(Bool, Char, Text)] | (set,mode,parameter)
-> [Text] |

Construct the arguments to a MODE command corresponding to the given mode changes.