mirror of
https://github.com/gissleh/irc.git
synced 2026-11-17 05:05:49 +00:00
Fixed NICK handler not firing, added away-notify w/tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user