mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
fix: remove unneeded check and create server channel before all other channels
This commit is contained in:
+5
-7
@@ -97,6 +97,10 @@ func (s *Client) Initialize(host string, port string, tlsEnabled bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Register(nick string, password string, channel string) {
|
func (c *Client) Register(nick string, password string, channel string) {
|
||||||
|
c.Channels[c.Host] = Channel{
|
||||||
|
Users: make(map[string]User),
|
||||||
|
}
|
||||||
|
|
||||||
c.SendCommand("CAP", "LS")
|
c.SendCommand("CAP", "LS")
|
||||||
if password != "" {
|
if password != "" {
|
||||||
c.SendCommand("PASS", password)
|
c.SendCommand("PASS", password)
|
||||||
@@ -112,11 +116,10 @@ func (c *Client) Register(nick string, password string, channel string) {
|
|||||||
if channel != "" {
|
if channel != "" {
|
||||||
c.ActiveChannel = channel
|
c.ActiveChannel = channel
|
||||||
c.SendCommand("JOIN", channel)
|
c.SendCommand("JOIN", channel)
|
||||||
}
|
|
||||||
|
|
||||||
c.Channels[c.ActiveChannel] = Channel{
|
c.Channels[c.ActiveChannel] = Channel{
|
||||||
Users: make(map[string]User),
|
Users: make(map[string]User),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) SendCommand(cmd string, params ...string) {
|
func (c Client) SendCommand(cmd string, params ...string) {
|
||||||
@@ -151,10 +154,5 @@ func (c Client) SendCommand(cmd string, params ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.TcpConn != nil {
|
|
||||||
c.TcpConn.Write([]byte(cmd + paramsString + CRLF))
|
c.TcpConn.Write([]byte(cmd + paramsString + CRLF))
|
||||||
} else {
|
|
||||||
// TODO: properly handle the error instead of Fatal-ing
|
|
||||||
log.Fatal("No valid connections to write to")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user