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

Improve prefix parsing and ambiguous prefix handling #249

Merged
merged 7 commits into from
Sep 12, 2020

Conversation

osa1
Copy link
Owner

@osa1 osa1 commented Sep 11, 2020

Previously when we see an ambiguous prefix (e.g. "localhost") we'd assume
server. We now have a prefix variant Ambiguous for such cases and resolving
the ambiguity is left to the caller.

When there's an ambiguity we try to do the reasonable thing depending on the
type of the message:

  • When the message is a numeric reply we assume server.
  • In all other cases (e.g. in JOIN/PART/QUIT/PRIVMSG) we assume nick.

Other changes:

  • Removed wildcard patterns to make the code future-proof.
  • Refactored some logging and comments.

Fixes #247

@osa1
Copy link
Owner Author

osa1 commented Sep 11, 2020

@kennylevinsen could you try this branch and let me know if it fixes #247?

@osa1
Copy link
Owner Author

osa1 commented Sep 11, 2020

We should add a new variant Ambiguous in Pfx and leave resolving the ambiguity to the users.

@osa1 osa1 force-pushed the improve_pfx_parsing branch from 837a397 to f9d981b Compare September 11, 2020 12:24
@osa1 osa1 changed the title libtiny_wire: Improve prefix parsing Improve prefix parsing and ambiguous prefix handling Sep 11, 2020
@osa1 osa1 force-pushed the improve_pfx_parsing branch from f9d981b to a1451dd Compare September 11, 2020 12:27
Previously when we see an ambiguous prefix (e.g. "localhost") we'd
assume server. We now have a prefix variant `Ambiguous` for such cases
and resolving the ambiguity is left to the caller.

When there's an ambiguity we try to do the reasonable thing depending on
the type of the message:

- When the message is a numeric reply we assume server.
- In all other cases (e.g. in JOIN/PART/QUIT/PRIVMSG) we assume nick.

Other changes:

- Removed wildcard patterns to make the code future-proof.
- Refactored some logging and comments.

Fixes #247
@osa1 osa1 force-pushed the improve_pfx_parsing branch from a1451dd to 4b0fea0 Compare September 12, 2020 03:46
@osa1 osa1 merged commit fc55f0a into master Sep 12, 2020
@osa1 osa1 deleted the improve_pfx_parsing branch September 12, 2020 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefix without '!' assumed to be a server
1 participant