parent
b24e1bafa1
commit
0c19716f44
|
@ -67,6 +67,20 @@ func (b *Birc) handleFiles(msg *config.Message) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Birc) handleInvite(client *girc.Client, event girc.Event) {
|
||||||
|
if len(event.Params) != 2 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
channel := event.Params[1]
|
||||||
|
|
||||||
|
b.Log.Debugf("got invite for %s", channel)
|
||||||
|
|
||||||
|
if _, ok := b.channels[channel]; ok {
|
||||||
|
b.i.Cmd.Join(channel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Birc) handleJoinPart(client *girc.Client, event girc.Event) {
|
func (b *Birc) handleJoinPart(client *girc.Client, event girc.Event) {
|
||||||
if len(event.Params) == 0 {
|
if len(event.Params) == 0 {
|
||||||
b.Log.Debugf("handleJoinPart: empty Params? %#v", event)
|
b.Log.Debugf("handleJoinPart: empty Params? %#v", event)
|
||||||
|
@ -117,6 +131,7 @@ func (b *Birc) handleNewConnection(client *girc.Client, event girc.Event) {
|
||||||
i.Handlers.Add("PART", b.handleJoinPart)
|
i.Handlers.Add("PART", b.handleJoinPart)
|
||||||
i.Handlers.Add("QUIT", b.handleJoinPart)
|
i.Handlers.Add("QUIT", b.handleJoinPart)
|
||||||
i.Handlers.Add("KICK", b.handleJoinPart)
|
i.Handlers.Add("KICK", b.handleJoinPart)
|
||||||
|
i.Handlers.Add("INVITE", b.handleInvite)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Birc) handleNickServ() {
|
func (b *Birc) handleNickServ() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ type Birc struct {
|
||||||
Local chan config.Message // local queue for flood control
|
Local chan config.Message // local queue for flood control
|
||||||
FirstConnection, authDone bool
|
FirstConnection, authDone bool
|
||||||
MessageDelay, MessageQueue, MessageLength int
|
MessageDelay, MessageQueue, MessageLength int
|
||||||
|
channels map[string]bool
|
||||||
|
|
||||||
*bridge.Config
|
*bridge.Config
|
||||||
}
|
}
|
||||||
|
@ -40,6 +41,8 @@ func New(cfg *bridge.Config) bridge.Bridger {
|
||||||
b.Nick = b.GetString("Nick")
|
b.Nick = b.GetString("Nick")
|
||||||
b.names = make(map[string][]string)
|
b.names = make(map[string][]string)
|
||||||
b.connected = make(chan error)
|
b.connected = make(chan error)
|
||||||
|
b.channels = make(map[string]bool)
|
||||||
|
|
||||||
if b.GetInt("MessageDelay") == 0 {
|
if b.GetInt("MessageDelay") == 0 {
|
||||||
b.MessageDelay = 1300
|
b.MessageDelay = 1300
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,6 +115,7 @@ func (b *Birc) Disconnect() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Birc) JoinChannel(channel config.ChannelInfo) error {
|
func (b *Birc) JoinChannel(channel config.ChannelInfo) error {
|
||||||
|
b.channels[channel.Name] = true
|
||||||
// need to check if we have nickserv auth done before joining channels
|
// need to check if we have nickserv auth done before joining channels
|
||||||
for {
|
for {
|
||||||
if b.authDone {
|
if b.authDone {
|
||||||
|
|
Loading…
Reference in New Issue