mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
temp *badbadbad*
This commit is contained in:
parent
16a55cbba8
commit
8bc2c0ee67
@ -9,7 +9,7 @@ import "github.com/goshuirc/irc-go/ircmsg"
|
|||||||
|
|
||||||
// Command represents a command accepted from a client.
|
// Command represents a command accepted from a client.
|
||||||
type Command struct {
|
type Command struct {
|
||||||
handler func(server *Server, client *Client, msg ircmsg.IrcMessage) bool
|
handler func(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool
|
||||||
oper bool
|
oper bool
|
||||||
usablePreReg bool
|
usablePreReg bool
|
||||||
leaveClientActive bool // if true, leaves the client active time alone. reversed because we can't default a struct element to True
|
leaveClientActive bool // if true, leaves the client active time alone. reversed because we can't default a struct element to True
|
||||||
@ -42,7 +42,12 @@ func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) b
|
|||||||
if !cmd.leaveClientIdle {
|
if !cmd.leaveClientIdle {
|
||||||
client.Touch()
|
client.Touch()
|
||||||
}
|
}
|
||||||
exiting := cmd.handler(server, client, msg)
|
rb := NewResponseBuffer(client)
|
||||||
|
rb.Label = GetLabel(msg)
|
||||||
|
|
||||||
|
exiting := cmd.handler(server, client, msg, rb)
|
||||||
|
|
||||||
|
rb.Send()
|
||||||
|
|
||||||
// after each command, see if we can send registration to the client
|
// after each command, see if we can send registration to the client
|
||||||
if !client.registered {
|
if !client.registered {
|
||||||
|
12
irc/modes.go
12
irc/modes.go
@ -210,13 +210,13 @@ func GetLowestChannelModePrefix(prefixes string) *Mode {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// MODE <target> [<modestring> [<mode arguments>...]]
|
// MODE <target> [<modestring> [<mode arguments>...]]
|
||||||
func modeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
func modeHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||||
_, errChan := CasefoldChannel(msg.Params[0])
|
_, errChan := CasefoldChannel(msg.Params[0])
|
||||||
|
|
||||||
if errChan == nil {
|
if errChan == nil {
|
||||||
return cmodeHandler(server, client, msg)
|
return cmodeHandler(server, client, msg, rb)
|
||||||
}
|
}
|
||||||
return umodeHandler(server, client, msg)
|
return umodeHandler(server, client, msg, rb)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseUserModeChanges returns the valid changes, and the list of unknown chars.
|
// ParseUserModeChanges returns the valid changes, and the list of unknown chars.
|
||||||
@ -325,11 +325,7 @@ func (client *Client) applyUserModeChanges(force bool, changes ModeChanges) Mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MODE <target> [<modestring> [<mode arguments>...]]
|
// MODE <target> [<modestring> [<mode arguments>...]]
|
||||||
func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||||
rb := NewResponseBuffer(client)
|
|
||||||
rb.Label = GetLabel(msg)
|
|
||||||
defer rb.Send()
|
|
||||||
|
|
||||||
nickname, err := CasefoldName(msg.Params[0])
|
nickname, err := CasefoldName(msg.Params[0])
|
||||||
target := server.clients.Get(nickname)
|
target := server.clients.Get(nickname)
|
||||||
if err != nil || target == nil {
|
if err != nil || target == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user