|
|
@ -85,8 +85,6 @@ func (channel *Channel) loop() { |
|
|
|
select { |
|
|
|
case post := <-channel.ch: |
|
|
|
{ |
|
|
|
log.Printf("Received %s post from %s", post.Kind, post.Nick) |
|
|
|
|
|
|
|
// Handle bot commands, or add to queue otherwise.
|
|
|
|
if cmd := post.botCommand(); cmd != nil { |
|
|
|
switch cmd.Verb { |
|
|
@ -128,6 +126,25 @@ func (channel *Channel) loop() { |
|
|
|
log.Println("Could not set event name:", err) |
|
|
|
} |
|
|
|
} |
|
|
|
case "register": |
|
|
|
{ |
|
|
|
target := channel.client.Channel(channel.name) |
|
|
|
if target != nil { |
|
|
|
me, ok := target.UserList().User(channel.client.Nick()) |
|
|
|
if !ok || !strings.ContainsRune(me.Modes, 'o') { |
|
|
|
channel.client.Say(channel.name, "This unit require operator privileges to serve this request.") |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
chanServNick := config.Get().Names.ChanServ |
|
|
|
if chanServNick == "" { |
|
|
|
channel.client.Say(channel.name, "This function is not enabled.") |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
channel.client.Sayf(chanServNick, "REGISTER %s", target.Name()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
queue = append(queue, post) |
|
|
@ -137,6 +154,9 @@ func (channel *Channel) loop() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Posts after here aren't going to be bot commands, so log its reception.
|
|
|
|
log.Printf("Received %s post from %s", post.Kind, post.Nick) |
|
|
|
|
|
|
|
// Stop here if there's nothing to post.
|
|
|
|
if len(queue) == 0 { |
|
|
|
break |
|
|
|