Mirror of github.com/gissleh/irc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
737 B

7 years ago
  1. package list
  2. // A User represents a member of a userlist.
  3. type User struct {
  4. Nick string `json:"nick"`
  5. User string `json:"user,omitempty"`
  6. Host string `json:"host,omitempty"`
  7. Account string `json:"account,omitempty"`
  8. Modes string `json:"modes"`
  9. Prefixes string `json:"prefixes"`
  10. PrefixedNick string `json:"prefixedNick"`
  11. }
  12. // HighestMode returns the highest mode.
  13. func (user *User) HighestMode() rune {
  14. if len(user.Modes) == 0 {
  15. return 0
  16. }
  17. return rune(user.Modes[0])
  18. }
  19. // PrefixedNick gets the full nick.
  20. func (user *User) updatePrefixedNick() {
  21. if len(user.Prefixes) == 0 {
  22. user.PrefixedNick = user.Nick
  23. return
  24. }
  25. user.PrefixedNick = string(user.Prefixes[0]) + user.Nick
  26. }