Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irc: rework parsing of modestrings #2131

Merged
merged 11 commits into from
Nov 11, 2021
Merged

Commits on Nov 7, 2021

  1. irc: add modes submodule to handle MODE messages

    Co-authored-by: dgw <dgw@technobabbl.es>
    Exirel and dgw committed Nov 7, 2021
    Configuration menu
    Copy the full SHA
    d88c3de View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c9738e0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    611068d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ed6c298 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c171bfc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c8c43fa View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    cbee851 View commit details
    Browse the repository at this point in the history
  8. bot, coretasks: add bot.modeparser

    Instead of creating an instance of `ModeParser` at each MODE event, the
    bot has a `modeparser` attribute with appropriate default values for its
    chanmodes, privileges, and param types.
    
    For that to work, when the bot received new ISUPPORT parameters, it
    updates the chanmodes and privileges of the mode parser if necessary.
    
    This required to adapt the list of default modes, as `a` and `q` are
    more commonly used as privilege rather than modes.
    
    Tests have been updated to manually update the modeparser. This may
    require new methods on the test IRC server to streamline an ISUPPORT
    configuration, because right now it's a bit too manual.
    Exirel committed Nov 7, 2021
    Configuration menu
    Copy the full SHA
    6d9a176 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cd86adf View commit details
    Browse the repository at this point in the history
  10. irc: improve behavior of ModeParser.parse method

    Several improvements of the ModeParser.parse method, which was renamed
    from ModeParser.parse_modestring (renamed to prevent name conflict with
    sopel.irc.modes.parse_modestring function).
    
    The method ModeParser.get_mode_info doesn't try to parse privileges
    anymore, which make it more type-safe as the letter is now str instead
    of Optional[str]. This makes the logic in ModeParser.parse a little
    different in a good way.
    
    Overall, a better type definition helped built a better interface with
    less potential for issues later. Functionnal tests for ModeParser.parse
    are kept the same, as nothing has change on this side.
    
    Thanks to mal who caught the type inconsistency in the first place!
    Exirel committed Nov 7, 2021
    Configuration menu
    Copy the full SHA
    96043ea View commit details
    Browse the repository at this point in the history
  11. coretasks: add comments and link to spec about MODE handling

    Co-authored-by: mal <mal@sec.gd>
    Exirel and half-duplex committed Nov 7, 2021
    Configuration menu
    Copy the full SHA
    ee5dca2 View commit details
    Browse the repository at this point in the history