Skip to content

another handful of fixes#485

Merged
DanielOaks merged 7 commits intoergochat:masterfrom
slingamn:utc.2
May 13, 2019
Merged

another handful of fixes#485
DanielOaks merged 7 commits intoergochat:masterfrom
slingamn:utc.2

Conversation

@slingamn
Copy link
Copy Markdown
Member

The individual commits should be mostly self-documenting.

slingamn added 7 commits May 12, 2019 20:57
Some clients seem to automatically poll for channel state
If you were banned and the ban was only detected when you proxied
(because you were proxying from a DLINE'd IP), you'd get an incorrect
quit message: `QUIT: Bad or unauthorized PROXY command`. This propagates
the correct ban message as the quit line.
@DanielOaks
Copy link
Copy Markdown
Member

While I don't mind removing most of the indirection, I find it a little more interesting to explicitly need to declare the maps yourself now before safe use (unless you use the ApplyConfig, obv). Weird tradeoff of being indirect and having the maps defined for you vs direct and if you use 'em directly them you'll run into issues. Looks like it shouldn't be a drama though given how we use them (gosh I wish Go just make()'d the maps for you when you created a struct, that'd make it so dang easy).

@DanielOaks
Copy link
Copy Markdown
Member

Great set of QoL fixes, thanks for the lovely PR

@DanielOaks DanielOaks merged commit 12b2a07 into ergochat:master May 13, 2019
@slingamn
Copy link
Copy Markdown
Member Author

Yeah, the pattern I've been going for in general is to replace NewBazBat() with func (bb *BazBat) Initialize(), which I have been thinking of as replacing one call with another (i.e., forgetting to call NewBazBat() is a nil pointer dereference, and forgetting to call Initialize() is some analogous panic), but the wider golang community and the stdlib seem to prefer the NewBazBat pattern and I'm not sure why.

I asked in #go-nuts about that map behavior and they called it autovivification and said it was bad, and I remember being moderately convinced at the time but I don't remember their arguments. ergochat/irc-go#11 did some autovivification-like behavior on the IrcMessage object (the tag maps became private members and were initialized only during the first relevant SetTag call).

@slingamn slingamn deleted the utc.2 branch May 20, 2019 06:24
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.

2 participants