func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) { if gw.ignoreMessage(&msg) { return } // only relay join/part when configged if msg.Event == config.EVENT_JOIN_LEAVE && !gw.Bridges[dest.Account].Config.ShowJoinPart { return } originchannel := msg.Channel channels := gw.getDestChannel(&msg, dest.Account) for _, channel := range channels { // do not send the message to the bridge we come from if also the channel is the same if msg.Account == dest.Account && channel == originchannel { continue } msg.Channel = channel if msg.Channel == "" { log.Debug("empty channel") return } log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel) gw.modifyUsername(&msg, dest) err := dest.Send(msg) if err != nil { fmt.Println(err) } } }
func (gw *SameChannelGateway) handleMessage(msg config.Message, dest *bridge.Bridge) { // is this a configured channel if !gw.validChannel(msg.Channel) { return } // do not send the message to the bridge we come from if also the channel is the same if msg.Account == dest.Account { return } gw.modifyUsername(&msg, dest) log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, msg.Channel, dest.Account, msg.Channel) err := dest.Send(msg) if err != nil { log.Error(err) } }