mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
Make NickServ actually work.
This commit is contained in:
parent
65af2b4320
commit
2ff93d74be
6 changed files with 103 additions and 40 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
type ClientNameMap map[string]*Client
|
||||
type ChannelNameMap map[string]*Channel
|
||||
type UserNameMap map[string]*User
|
||||
type ServiceNameMap map[string]*Service
|
||||
type ServiceNameMap map[string]Service
|
||||
|
||||
type Server struct {
|
||||
hostname string
|
||||
|
|
@ -40,7 +40,7 @@ func NewServer(name string) *Server {
|
|||
|
||||
func (server *Server) receiveCommands(commands <-chan Command) {
|
||||
for command := range commands {
|
||||
log.Printf("%s %T %+v", server.Id(), command, command)
|
||||
log.Printf("%s ← %s %s", server, command.Client(), command)
|
||||
command.Client().atime = time.Now()
|
||||
command.HandleServer(server)
|
||||
}
|
||||
|
|
@ -103,7 +103,11 @@ func (s *Server) tryRegister(c *Client) {
|
|||
}
|
||||
|
||||
func (s Server) Id() string {
|
||||
return s.hostname
|
||||
return s.name
|
||||
}
|
||||
|
||||
func (s Server) String() string {
|
||||
return s.Id()
|
||||
}
|
||||
|
||||
func (s Server) PublicId() string {
|
||||
|
|
@ -122,7 +126,7 @@ func (s *Server) DeleteChannel(channel *Channel) {
|
|||
// commands
|
||||
//
|
||||
|
||||
func (m *UnknownCommand) HandleServer(s *Server) {
|
||||
func (m UnknownCommand) HandleServer(s *Server) {
|
||||
m.Client().Replies() <- ErrUnknownCommand(s, m.command)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue