Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package main
  2. import (
  3. "github.com/thoj/go-ircevent"
  4. "strings"
  5. )
  6. func (i *IRCCat) authorisedUser(nick string) bool {
  7. _, exists := i.auth_users[nick]
  8. return exists
  9. }
  10. func (i *IRCCat) handleJoin(e *irc.Event) {
  11. if e.Arguments[0] == i.auth_channel {
  12. i.auth_users[e.Nick] = true
  13. }
  14. }
  15. func (i *IRCCat) handlePart(e *irc.Event) {
  16. if e.Arguments[0] == i.auth_channel {
  17. delete(i.auth_users, e.Nick)
  18. }
  19. }
  20. func (i *IRCCat) handleQuit(e *irc.Event) {
  21. delete(i.auth_users, e.Nick)
  22. }
  23. func (i *IRCCat) handleNames(e *irc.Event) {
  24. if e.Arguments[2] == i.auth_channel {
  25. nicks := strings.Split(e.Arguments[3], " ")
  26. for _, nick := range nicks {
  27. // TODO: this is probably not an optimal way of trimming the mode characters.
  28. nick = strings.TrimLeft(nick, "@%+")
  29. i.auth_users[nick] = true
  30. }
  31. }
  32. }
  33. func (i *IRCCat) handleNick(e *irc.Event) {
  34. if i.auth_users[e.Nick] {
  35. delete(i.auth_users, e.Nick)
  36. i.auth_users[e.Arguments[0]] = true
  37. }
  38. }