4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-05 20:44:04 +00:00

Upgrade to latest girc version (irc) (#718)

This commit is contained in:
Wim
2019-02-16 17:24:04 +01:00
committed by GitHub
parent 777af73e2b
commit 3123695869
14 changed files with 172 additions and 189 deletions

View File

@ -309,17 +309,17 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error {
c.Config.Name = c.Config.User
}
c.write(&Event{Command: USER, Params: []string{c.Config.User, "*", "*"}, Trailing: c.Config.Name})
c.write(&Event{Command: USER, Params: []string{c.Config.User, "*", "*", c.Config.Name}})
// Send a virtual event allowing hooks for successful socket connection.
c.RunHandlers(&Event{Command: INITIALIZED, Trailing: c.Server()})
c.RunHandlers(&Event{Command: INITIALIZED, Params: []string{c.Server()}})
// Wait for the first error.
var result error
select {
case <-ctx.Done():
c.debug.Print("received request to close, beginning clean up")
c.RunHandlers(&Event{Command: CLOSED, Trailing: c.Server()})
c.RunHandlers(&Event{Command: CLOSED, Params: []string{c.Server()}})
case err := <-errs:
c.debug.Print("received error, beginning clean up")
result = err
@ -336,7 +336,7 @@ func (c *Client) internalConnect(mock net.Conn, dialer Dialer) error {
c.conn.mu.Unlock()
c.mu.RUnlock()
c.RunHandlers(&Event{Command: DISCONNECTED, Trailing: c.Server()})
c.RunHandlers(&Event{Command: DISCONNECTED, Params: []string{c.Server()}})
// Once we have our error/result, let all other functions know we're done.
c.debug.Print("waiting for all routines to finish")
@ -396,9 +396,9 @@ func (c *Client) Send(event *Event) {
<-time.After(c.conn.rate(event.Len()))
}
if c.Config.GlobalFormat && event.Trailing != "" &&
if c.Config.GlobalFormat && len(event.Params) > 0 && event.Params[len(event.Params)-1] != "" &&
(event.Command == PRIVMSG || event.Command == TOPIC || event.Command == NOTICE) {
event.Trailing = Fmt(event.Trailing)
event.Params[len(event.Params)-1] = Fmt(event.Params[len(event.Params)-1])
}
c.write(event)