mirror of https://github.com/fluffle/goirc
Don't store the password. Be a good citizen.
This commit is contained in:
parent
c481300217
commit
6fde11a35f
|
@ -19,7 +19,6 @@ type Conn struct {
|
|||
Host string
|
||||
Me *state.Nick
|
||||
Network string
|
||||
password string
|
||||
|
||||
// Replaceable function to customise the 433 handler's new nick
|
||||
NewNick func(string) string
|
||||
|
@ -173,12 +172,9 @@ func (conn *Conn) Connect(host string, pass ...string) error {
|
|||
}
|
||||
}
|
||||
conn.Host = host
|
||||
if len(pass) > 0 {
|
||||
conn.password = pass[0]
|
||||
}
|
||||
conn.Connected = true
|
||||
conn.postConnect()
|
||||
conn.ED.Dispatch(INIT, conn, &Line{})
|
||||
conn.ED.Dispatch(INIT, conn, &Line{Args: pass})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ func (conn *Conn) addIntHandlers() {
|
|||
|
||||
// Password/User/Nick broadcast on connection.
|
||||
func (conn *Conn) h_INIT(line *Line) {
|
||||
if conn.password != "" {
|
||||
conn.Pass(conn.password)
|
||||
if len(line.Args) > 0 {
|
||||
conn.Pass(line.Args[0])
|
||||
}
|
||||
conn.Nick(conn.Me.Nick)
|
||||
conn.User(conn.Me.Ident, conn.Me.Name)
|
||||
|
|
|
@ -31,10 +31,9 @@ func TestINIT(t *testing.T) {
|
|||
s.nc.Expect("USER test 12 * :Testing IRC")
|
||||
s.nc.ExpectNothing()
|
||||
|
||||
c.password = "12345"
|
||||
c.Me.Ident = "idiot"
|
||||
c.Me.Name = "I've got the same combination on my luggage!"
|
||||
c.h_INIT(&Line{})
|
||||
c.h_INIT(&Line{Args: []string{"12345"}})
|
||||
s.nc.Expect("PASS 12345")
|
||||
s.nc.Expect("NICK test")
|
||||
s.nc.Expect("USER idiot 12 * :I've got the same combination on my luggage!")
|
||||
|
@ -278,7 +277,6 @@ func TestMODE(t *testing.T) {
|
|||
t.Errorf("Channel.ParseModes() not called correctly.")
|
||||
}
|
||||
|
||||
|
||||
// Send a nick mode line, returning Me
|
||||
gomock.InOrder(
|
||||
s.st.EXPECT().GetChannel("test").Return(nil),
|
||||
|
|
Loading…
Reference in New Issue