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

Sopel should keep track of its full hostmask #1322

Closed
freeboson opened this issue May 3, 2018 · 4 comments · Fixed by #1958
Closed

Sopel should keep track of its full hostmask #1322

freeboson opened this issue May 3, 2018 · 4 comments · Fixed by #1958

Comments

@freeboson
Copy link
Contributor

Can we properly setup Sopel.say() to construct PRIVMSGs that will actually be at the 512 limit?

@dgw
Copy link
Member

dgw commented May 5, 2018

This is actually harder to do than it sounds. I'd like for Sopel to use the full line length available, too, but external factors can change an IRC user's hostname without notice: server-side mode changes, HostServ or similar being turned on/off, cloaking applied after NickServ authentication, etc.

Is there a reliable way to monitor for changes in one's own hostname that I'm unaware of? Happy to look into doing this if it's technically possible without a kludge like polling. 😸

As an aside, I've used multiple other IRC clients and frameworks that conservatively truncate (split) lines because they don't want to deal with tracking hostname changes either.

@dgw
Copy link
Member

dgw commented Dec 15, 2019

Sopel tracks its hostmask as of #1537, but this is left open for the "512 limit" piece—that is, making Sopel actually use the stored hostmask to send as much as possible.

@dgw dgw added this to the 7.1.0 milestone Dec 15, 2019
@deathbybandaid
Copy link
Contributor

Just going to leave this here in regards to how many bytes the hostmask takes, and how many bytes it could portentially take as error handling.

        try:
            hostmaskbytes = len((bot.users.get(bot.nick).hostmask).encode('utf-8'))
        except AttributeError:
            hostmaskbytes = (len((bot.nick).encode('utf-8'))  # Bot's NICKLEN
                             + 1  # (! separator)
                             + len('~')  # (for the optional ~ in user)
                             + 9  # max username length
                             + 1  # (@ separator)
                             + 63  # <hostname> has a maximum length of 63 characters.
                             )

@dgw
Copy link
Member

dgw commented Dec 16, 2019

@deathbybandaid In 7.x we have bot.hostmask, FYI.

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