lrstanley / girc

:bomb: girc is a flexible IRC library for Go :ok_hand:
https://pkg.go.dev/github.com/lrstanley/girc
MIT License
137 stars 13 forks source link

client: Add GetID() function #28

Closed nmeum closed 5 years ago

nmeum commented 5 years ago

Makes it a bit less verbose to check if an event originated from once own client. While at it the existing code was modified accordingly.

codecov-io commented 5 years ago

Codecov Report

Merging #28 into master will increase coverage by 0.08%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #28      +/-   ##
=========================================
+ Coverage   56.02%   56.1%   +0.08%     
=========================================
  Files          13      13              
  Lines        2333    2333              
=========================================
+ Hits         1307    1309       +2     
+ Misses        919     917       -2     
  Partials      107     107
Impacted Files Coverage Δ
event.go 67.5% <100%> (+0.23%) :arrow_up:
conn.go 59.01% <100%> (ø) :arrow_up:
builtin.go 60.8% <66.66%> (ø) :arrow_up:
commands.go 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ec512ca...be5142a. Read the comment docs.

lrstanley commented 5 years ago

I think a better approach (passing around a large struct like *Client can get a bit messy), would be to simply add a Client.GetID() which returns the ID, then the user can use it to compare the source and client.

nmeum commented 5 years ago

Sounds good. Adjusted the changes accordingly.