Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

turing: account for -slack nicks when adding 0-length spaces #91

Merged
merged 1 commit into from
Feb 8, 2019

Conversation

cg505
Copy link
Member

@cg505 cg505 commented Jan 20, 2019

as advertised in #test

@cg505 cg505 requested a review from kkuehlz January 20, 2019 01:54
# the end of a nick, to avoid inserting a space like
# abcde|-slack (thus pinging abcde).
def insert_space(w):
halfway = len(re.sub('-slack([^A-Za-z0-9_\\-\\\\\\[\\]{}^`|]|\\Z)', '\\1', w)) // 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an r-string to make this more readable?

# This is also much simpler than using crazy IRC nick regex.
# Put it in the middle of the word since nicks are quoted
# using "<@keur>" syntax.
# using "<@keur>" syntax. Additionally, remove any -slack at
# the end of a nick, to avoid inserting a space like
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use the middle? I think it would be better to find where the nick actually starts, and put it after the first letter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a better approach, but it's notably harder. It's not that easy to break the message into each discrete nick.

@cg505
Copy link
Member Author

cg505 commented Feb 8, 2019

I'm going to merge this. I opened an issue (#100) for handling better 0-length spaces in nicks in general.

@cg505 cg505 merged commit e7444a1 into ocf:master Feb 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants