-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlegacy.go
51 lines (45 loc) · 1.2 KB
/
legacy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package ircx
import (
"crypto/tls"
)
// Classic creates an instance of ircx poised to connect to the given server
// with the given IRC name.
func Classic(server string, name string) *Bot {
cfg := Config{
User: name,
}
return New(server, name, cfg)
}
// WithLogin creates an instance with the specified server, name user and password
// for the IRC server
func WithLogin(server string, name string, user string, password string) *Bot {
cfg := Config{
User: user,
Password: password,
}
return New(server, name, cfg)
}
// WithTLS creates an instance of ircx poised to connect to the given server
// using TLS with the given IRC name.
func WithTLS(server string, name string, tlsConfig *tls.Config) *Bot {
if tlsConfig == nil {
tlsConfig = &tls.Config{}
}
cfg := Config{
TLSConfig: tlsConfig,
User: name,
}
return New(server, name, cfg)
}
// WithLoginTLS creates an instance with the specified information + TLS config
func WithLoginTLS(server string, name string, user string, password string, tlsConfig *tls.Config) *Bot {
if tlsConfig == nil {
tlsConfig = &tls.Config{}
}
cfg := Config{
TLSConfig: tlsConfig,
User: user,
Password: password,
}
return New(server, name, cfg)
}