Fixed NICK handler not firing, added away-notify w/tests

This commit is contained in:
2018-06-25 17:31:47 +02:00
parent 6256f6a6fe
commit f37cb1751e
5 changed files with 72 additions and 3 deletions
+4
View File
@@ -253,6 +253,10 @@ func (list *List) Patch(nick string, patch UserPatch) (ok bool) {
user.Account = patch.Account
}
if patch.Away != "" || patch.ClearAway {
user.Away = patch.Away
}
if patch.User != "" {
user.User = patch.User
}
+8
View File
@@ -6,6 +6,7 @@ type User struct {
User string `json:"user,omitempty"`
Host string `json:"host,omitempty"`
Account string `json:"account,omitempty"`
Away string `json:"away,omitempty"`
Modes string `json:"modes"`
Prefixes string `json:"prefixes"`
PrefixedNick string `json:"prefixedNick"`
@@ -17,6 +18,8 @@ type UserPatch struct {
Host string
Account string
ClearAccount bool
Away string
ClearAway bool
}
// HighestMode returns the highest mode.
@@ -28,6 +31,11 @@ func (user *User) HighestMode() rune {
return rune(user.Modes[0])
}
// IsAway returns true if user.Away is non-empty
func (user *User) IsAway() bool {
return user.Away != ""
}
// PrefixedNick gets the full nick.
func (user *User) updatePrefixedNick() {
if len(user.Prefixes) == 0 {