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

Core - Add a way for all handlers to specify a Regex object instead of just a string #34

Closed
xforever1313 opened this issue Apr 29, 2018 · 3 comments

Comments

@xforever1313
Copy link
Owner

A user may wish to include RegexOptions, which we can't do if we can only pass in a string.

@xforever1313
Copy link
Owner Author

Not sure what the best way to go about this is; should we pass in RegexOptions to MessageHandler, or a full-blown Regex object? The probably with the latter is the part where we liquefy strings here in MessageHandler.

@xforever1313
Copy link
Owner Author

I think the best way to handle this one is to pass in RegexOptions to the MessageHandler object, instead of a Regex object, since we'll just recreate the Regex anyways after liquefying the string.

This does, however, create a problem. This makes the constructor for MessageHandler take in a lot of things. I think we should create a MessageHandlerConfig and pass that into the constructor. Add a Validate() function and set sane default values. It will also clean up some things from codacy since we'll get rid of default parameters.

We should extend this to all handler types, so we only have one breaking change instead of many.

xforever1313 added a commit that referenced this issue Sep 2, 2018
Moved Handler classes into their own folder.
xforever1313 added a commit that referenced this issue Sep 2, 2018
AllHandler now takes in an AllHandlerConfig object, so if want to expand it, we can.
xforever1313 added a commit that referenced this issue Sep 2, 2018
JoinHandlers now take in a JoinHandlerConfig.
xforever1313 added a commit that referenced this issue Sep 2, 2018
Forgot to remove useless parameter.
xforever1313 added a commit that referenced this issue Sep 2, 2018
Added PartHandlerConfig.

Renamed DeepCopy -> Clone().
xforever1313 added a commit that referenced this issue Sep 2, 2018
Added MessageHandlerConfig, did not plug in to anything yet.
xforever1313 added a commit that referenced this issue Sep 2, 2018
MessageHandler takes in MessageHandlerConfig.  All plugins have been affected.
@xforever1313
Copy link
Owner Author

This task is completed, MessageHandler now has a MessageHandlerConfig. MessageHandlerConfig has a RegexOptions property. MessageHandler takes in this while constructing the regex:

Regex lineRegex = new Regex(
                    Parsing.LiquefyStringWithIrcConfig(
                        this.LineRegex,
                        remoteUser,
                        args.IrcConfig.Nick,
                        channel
                    ),
                    this.RegexOptions // HERE
                );

Wiki has also been updated.

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant