Skip to content

Commit

Permalink
getSourceDirs: Don't always return empty list for own user
Browse files Browse the repository at this point in the history
Otherwise changes of ones own nick are not displayed in the appropriate
channels. Therefore: Only return an empty list if the user didn't join
any channels yet.

See also: lrstanley/girc#27
  • Loading branch information
nmeum committed Dec 10, 2018
1 parent 131a791 commit 07fc5bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hii.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ func getCmdChan(event *girc.Event) (string, bool) {

func getSourceDirs(client *girc.Client, event *girc.Event) ([]*string, error) {
var names []*string
if event.Source == nil || event.Source.Name == client.GetNick() {
if event.Source == nil {
return names, nil
}

user := client.LookupUser(event.Source.Name)
if user == nil {
if user == nil && client.GetNick() == event.Source.Name {
return names, nil // User didn't join any channels yet
} else if user == nil {
return names, fmt.Errorf("user %q doesn't exist", event.Source.Name)
}

Expand Down

0 comments on commit 07fc5bd

Please sign in to comment.