1
0
Fork 0
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:
Alex Bramley 2013-02-16 18:05:56 +00:00
parent 45d7b3317f
commit b1242aa351
4 changed files with 71 additions and 45 deletions

View file

@ -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] {