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

Colorize username sent to IRC using its crc32 IEEE checksum #423

Merged
merged 3 commits into from May 11, 2018

Conversation

yuvallanger
Copy link
Contributor

No description provided.

@42wim
Copy link
Owner

42wim commented May 11, 2018

Hi, looking good!
Would you mind also adding a config option (and documentation in matterbridge.toml.sample) ?
Like for example ColorNicks in https://github.com/42wim/matterbridge/blob/master/bridge/config/config.go#L60 which is by default false.
You can then do a if b.GetBool("colornicks") { ... }

@yuvallanger
Copy link
Contributor Author

yuvallanger commented May 11, 2018 via email

@42wim
Copy link
Owner

42wim commented May 11, 2018

Don't forget to let me know if the WIP is done :-)
Feel free to ask if you need more help/info!

@yuvallanger
Copy link
Contributor Author

It might be close to be done now. Could you test it?

@derram
Copy link

derram commented May 11, 2018

I compiled the binary and tested it.

Nicks on irc weren't colored and it seemed to reverse the telegram quote option, causing the bridge to drop the message but display the quote.

I don't know much about go, though, so there's always the possibility that I didn't compile it correctly. There was a lot more text in the console on start up than there is on the main branch, for instance.

username := msg.Username
if b.GetBool("Colornicks") {
checksum := crc32.ChecksumIEEE([]byte(msg.Username))
username = string(0x03) + string(checksum%0x10) + msg.Username + string(0x03)
Copy link
Owner

Choose a reason for hiding this comment

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

Doesn't work, but changing to
username = fmt.Sprintf("\x03%d%s\x03", checksum%0x10, msg.Username) works

@42wim
Copy link
Owner

42wim commented May 11, 2018

If you fix this small thing and also update the matterbridge.toml.sample with your new feature, I can merge this.

Thanks!

@yuvallanger
Copy link
Contributor Author

Where do I put the setting in matterbridge.toml.sample?

@42wim
Copy link
Owner

42wim commented May 11, 2018

As it is for IRC only please add on line 94

@yuvallanger
Copy link
Contributor Author

Please have a look now.

@42wim 42wim merged commit f0738a9 into 42wim:master May 11, 2018
@42wim
Copy link
Owner

42wim commented May 11, 2018

Thanks! merged

@yuvallanger yuvallanger changed the title [WIP] Colorize username sent to IRC using its crc32 IEEE checksum Colorize username sent to IRC using its crc32 IEEE checksum May 11, 2018
@yuvallanger
Copy link
Contributor Author

yuvallanger commented May 11, 2018

The commit message 1 starts with [WIP]. Sorry about that. :/

@42wim
Copy link
Owner

42wim commented May 11, 2018

Yeah, my mistake, should've been looking more carefully. But doesn't matter that much.

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.

None yet

3 participants