mirror of
https://github.com/fluffle/goirc
synced 2025-07-05 21:09:24 +00:00
Break out tweakable things into a Config struct.
This commit is contained in:
parent
45d7b3317f
commit
b1242aa351
4 changed files with 71 additions and 45 deletions
|
@ -54,7 +54,7 @@ func (conn *Conn) h_001(line *Line) {
|
|||
// Handler to deal with "433 :Nickname already in use"
|
||||
func (conn *Conn) h_433(line *Line) {
|
||||
// Args[1] is the new nick we were attempting to acquire
|
||||
neu := conn.NewNick(line.Args[1])
|
||||
neu := conn.cfg.NewNick(line.Args[1])
|
||||
conn.Nick(neu)
|
||||
// if this is happening before we're properly connected (i.e. the nick
|
||||
// we sent in the initial NICK command is in use) we will not receive
|
||||
|
@ -87,7 +87,7 @@ func (conn *Conn) h_NICK(line *Line) {
|
|||
// Handle PRIVMSGs that trigger Commands
|
||||
func (conn *Conn) h_PRIVMSG(line *Line) {
|
||||
txt := line.Args[1]
|
||||
if conn.CommandStripNick && strings.HasPrefix(txt, conn.Me.Nick) {
|
||||
if conn.cfg.CommandStripNick && strings.HasPrefix(txt, conn.Me.Nick) {
|
||||
// Look for '^${nick}[:;>,-]? '
|
||||
l := len(conn.Me.Nick)
|
||||
switch txt[l] {
|
||||
|
@ -102,7 +102,7 @@ func (conn *Conn) h_PRIVMSG(line *Line) {
|
|||
if cmd == nil {
|
||||
return
|
||||
}
|
||||
if conn.CommandStripPrefix {
|
||||
if conn.cfg.CommandStripPrefix {
|
||||
txt = strings.TrimSpace(txt[l:])
|
||||
}
|
||||
if txt != line.Args[1] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue