diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 3c4d5408..cfc6a81d 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -96,7 +96,7 @@ func (b *Bdiscord) JoinChannel(channel config.ChannelInfo) error { } func (b *Bdiscord) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) channelID := b.getChannelID(msg.Channel) if channelID == "" { @@ -180,8 +180,8 @@ func (b *Bdiscord) messageDelete(s *discordgo.Session, m *discordgo.MessageDelet if b.UseChannelID { rmsg.Channel = "ID:" + m.ChannelID } - b.Log.Debugf("Sending message from %s to gateway", b.Account) - b.Log.Debugf("Message is %#v", rmsg) + b.Log.Debugf("<= Sending message from %s to gateway", b.Account) + b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg } @@ -219,7 +219,7 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat rmsg := config.Message{Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg", UserID: m.Author.ID, ID: m.ID} if m.Content != "" { - b.Log.Debugf("Receiving message %#v", m.Message) + b.Log.Debugf("== Receiving event %#v", m.Message) m.Message.Content = b.stripCustomoji(m.Message.Content) m.Message.Content = b.replaceChannelMentions(m.Message.Content) rmsg.Text, err = m.ContentWithMoreMentionsReplaced(b.c) @@ -261,8 +261,8 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat rmsg.Event = config.EVENT_USER_ACTION } - b.Log.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.Account) - b.Log.Debugf("Message is %#v", rmsg) + b.Log.Debugf("<= Sending message from %s on %s to gateway", m.Author.Username, b.Account) + b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg } diff --git a/bridge/gitter/gitter.go b/bridge/gitter/gitter.go index 0cd8e520..b7f69b1f 100644 --- a/bridge/gitter/gitter.go +++ b/bridge/gitter/gitter.go @@ -71,7 +71,7 @@ func (b *Bgitter) JoinChannel(channel config.ChannelInfo) error { case *gitter.MessageReceived: // ignore message sent from ourselves if ev.Message.From.ID != b.User.ID { - b.Log.Debugf("Sending message from %s on %s to gateway", ev.Message.From.Username, b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", ev.Message.From.Username, b.Account) rmsg := config.Message{Username: ev.Message.From.Username, Text: ev.Message.Text, Channel: room, Account: b.Account, Avatar: b.getAvatar(ev.Message.From.Username), UserID: ev.Message.From.ID, ID: ev.Message.ID} @@ -79,7 +79,7 @@ func (b *Bgitter) JoinChannel(channel config.ChannelInfo) error { rmsg.Event = config.EVENT_USER_ACTION rmsg.Text = strings.Replace(rmsg.Text, "@"+ev.Message.From.Username+" ", "", -1) } - b.Log.Debugf("Message is %#v", rmsg) + b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg } case *gitter.GitterConnectionClosed: @@ -91,7 +91,7 @@ func (b *Bgitter) JoinChannel(channel config.ChannelInfo) error { } func (b *Bgitter) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) roomID := b.getRoomID(msg.Channel) if roomID == "" { b.Log.Errorf("Could not find roomID for %v", msg.Channel) diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index afe436bc..5f89d295 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -156,7 +156,7 @@ func (b *Birc) Send(msg config.Message) (string, error) { return "", nil } - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) // Execute a command if strings.HasPrefix(msg.Text, "!") { @@ -289,9 +289,9 @@ func (b *Birc) handleJoinPart(client *girc.Client, event girc.Event) { } } if event.Source.Name != b.Nick { - b.Log.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account) + b.Log.Debugf("<= Sending JOIN_LEAVE event from %s to gateway", b.Account) msg := config.Message{Username: "system", Text: event.Source.Name + " " + strings.ToLower(event.Command) + "s", Channel: channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE} - b.Log.Debugf("Message is %#v", msg) + b.Log.Debugf("<= Message is %#v", msg) b.Remote <- msg return } @@ -352,7 +352,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) { return } rmsg := config.Message{Username: event.Source.Name, Channel: strings.ToLower(event.Params[0]), Account: b.Account, UserID: event.Source.Ident + "@" + event.Source.Host} - b.Log.Debugf("Receiving PRIVMSG: %s %s %#v", event.Source.Name, event.Trailing, event) + b.Log.Debugf("== Receiving PRIVMSG: %s %s %#v", event.Source.Name, event.Trailing, event) // set action event if event.IsAction() { @@ -393,7 +393,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) { output, _ := ioutil.ReadAll(r) rmsg.Text = string(output) - b.Log.Debugf("Sending message from %s on %s to gateway", event.Params[0], b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", event.Params[0], b.Account) b.Remote <- rmsg } diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index e7f7159a..d6fd68e7 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -65,7 +65,7 @@ func (b *Bmatrix) JoinChannel(channel config.ChannelInfo) error { } func (b *Bmatrix) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) channel := b.getRoomID(msg.Channel) b.Log.Debugf("Channel %s maps to channel id %s", msg.Channel, channel) @@ -140,7 +140,7 @@ func (b *Bmatrix) handlematrix() error { } func (b *Bmatrix) handleEvent(ev *matrix.Event) { - b.Log.Debugf("Received: %#v", ev) + b.Log.Debugf("== Receiving event: %#v", ev) if ev.Sender != b.UserID { b.RLock() channel, ok := b.RoomMap[ev.RoomID] @@ -189,7 +189,7 @@ func (b *Bmatrix) handleEvent(ev *matrix.Event) { } } - b.Log.Debugf("Sending message from %s on %s to gateway", ev.Sender, b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", ev.Sender, b.Account) b.Remote <- rmsg } } diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index af52270a..dffb421d 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -115,7 +115,7 @@ func (b *Bmattermost) JoinChannel(channel config.ChannelInfo) error { } func (b *Bmattermost) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) // Make a action /me of the message if msg.Event == config.EVENT_USER_ACTION { @@ -185,8 +185,8 @@ func (b *Bmattermost) handleMatter() { if ok { message.Event = config.EVENT_USER_ACTION } - b.Log.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account) - b.Log.Debugf("Message is %#v", message) + b.Log.Debugf("<= Sending message from %s on %s to gateway", message.Username, b.Account) + b.Log.Debugf("<= Message is %#v", message) b.Remote <- *message } } @@ -205,7 +205,7 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) { b.handleDownloadAvatar(message.UserID, message.Channel) } - b.Log.Debugf("Receiving from matterclient %#v", message) + b.Log.Debugf("== Receiving event %#v", message) rmsg := &config.Message{Username: message.Username, UserID: message.UserID, Channel: message.Channel, Text: message.Text, ID: message.Post.Id, Extra: make(map[string][]interface{})} diff --git a/bridge/rocketchat/rocketchat.go b/bridge/rocketchat/rocketchat.go index 8f025d2f..fa6bdd5b 100644 --- a/bridge/rocketchat/rocketchat.go +++ b/bridge/rocketchat/rocketchat.go @@ -50,7 +50,7 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) { if msg.Event == config.EVENT_MSG_DELETE { return "", nil } - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL, Channel: rmsg.Channel, UserName: rmsg.Username, @@ -88,7 +88,7 @@ func (b *Brocketchat) handleRocketHook() { if message.UserName == b.Config.Nick { continue } - b.Log.Debugf("Sending message from %s on %s to gateway", message.UserName, b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", message.UserName, b.Account) b.Remote <- config.Message{Text: message.Text, Username: message.UserName, Channel: message.ChannelName, Account: b.Account, UserID: message.UserID} } } diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 7f506409..009a33a4 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -108,7 +108,7 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error { } func (b *Bslack) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) // Make a action /me of the message if msg.Event == config.EVENT_USER_ACTION { @@ -190,7 +190,6 @@ func (b *Bslack) Send(msg config.Message) (string, error) { } // Post normal message - b.Log.Debugf("NP IS %#v", np) _, id, err := b.sc.PostMessage(schannel.ID, msg.Text, np) if err != nil { return "", err @@ -246,7 +245,7 @@ func (b *Bslack) handleSlack() { time.Sleep(time.Second) b.Log.Debug("Start listening for Slack messages") for message := range messages { - b.Log.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", message.Username, b.Account) // cleanup the message message.Text = b.replaceURL(message.Text) @@ -258,7 +257,7 @@ func (b *Bslack) handleSlack() { // Add the avatar message.Avatar = b.getAvatar(message.Username) - b.Log.Debugf("Message is %#v", message) + b.Log.Debugf("<= Message is %#v", message) b.Remote <- *message } } @@ -266,7 +265,7 @@ func (b *Bslack) handleSlack() { func (b *Bslack) handleSlackClient(messages chan *config.Message) { for msg := range b.rtm.IncomingEvents { if msg.Type != "user_typing" && msg.Type != "latency_report" { - b.Log.Debugf("Receiving from slackclient %#v", msg.Data) + b.Log.Debugf("== Receiving event %#v", msg.Data) } switch ev := msg.Data.(type) { case *slack.MessageEvent: diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go index ab6b06c7..c11d3daa 100644 --- a/bridge/sshchat/sshchat.go +++ b/bridge/sshchat/sshchat.go @@ -55,7 +55,7 @@ func (b *Bsshchat) Send(msg config.Message) (string, error) { if msg.Event == config.EVENT_MSG_DELETE { return "", nil } - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { b.w.Write([]byte(rmsg.Username + rmsg.Text + "\r\n")) @@ -124,7 +124,7 @@ func (b *Bsshchat) handleSshChat() error { continue } if !wait { - b.Log.Debugf("message %#v", res) + b.Log.Debugf("<= Message %#v", res) rmsg := config.Message{Username: res[0], Text: strings.Join(res[1:], ":"), Channel: "sshchat", Account: b.Account, UserID: "nick"} b.Remote <- rmsg } diff --git a/bridge/steam/steam.go b/bridge/steam/steam.go index 0a3a03e9..a0bf757c 100644 --- a/bridge/steam/steam.go +++ b/bridge/steam/steam.go @@ -92,7 +92,7 @@ func (b *Bsteam) handleEvents() { switch e := event.(type) { case *steam.ChatMsgEvent: b.Log.Debugf("Receiving ChatMsgEvent: %#v", e) - b.Log.Debugf("Sending message from %s on %s to gateway", b.getNick(e.ChatterId), b.Account) + b.Log.Debugf("<= Sending message from %s on %s to gateway", b.getNick(e.ChatterId), b.Account) var channel int64 if e.ChatRoomId == 0 { channel = int64(e.ChatterId) diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index b407e0ce..073eda7c 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -50,7 +50,7 @@ func (b *Btelegram) JoinChannel(channel config.ChannelInfo) error { } func (b *Btelegram) Send(msg config.Message) (string, error) { - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) // get the chatid chatid, err := strconv.ParseInt(msg.Channel, 10, 64) @@ -119,7 +119,7 @@ func (b *Btelegram) Send(msg config.Message) (string, error) { func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { for update := range updates { - b.Log.Debugf("Receiving from telegram: %#v", update.Message) + b.Log.Debugf("== Receiving event: %#v", update.Message) if update.Message == nil && update.ChannelPost == nil { b.Log.Error("Getting nil messages, this shouldn't happen.") @@ -226,8 +226,8 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { if rmsg.Text != "" || len(rmsg.Extra) > 0 { rmsg.Avatar = helper.GetAvatar(b.avatarMap, strconv.Itoa(message.From.ID), b.General) - b.Log.Debugf("Sending message from %s on %s to gateway", rmsg.Username, b.Account) - b.Log.Debugf("Message is %#v", rmsg) + b.Log.Debugf("<= Sending message from %s on %s to gateway", rmsg.Username, b.Account) + b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg } } diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 990d6f3b..b1c12555 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -72,7 +72,7 @@ func (b *Bxmpp) Send(msg config.Message) (string, error) { if msg.Event == config.EVENT_MSG_DELETE { return "", nil } - b.Log.Debugf("Receiving %#v", msg) + b.Log.Debugf("=> Receiving %#v", msg) // Upload a file (in xmpp case send the upload URL because xmpp has no native upload support) if msg.Extra != nil { @@ -161,8 +161,8 @@ func (b *Bxmpp) handleXMPP() error { if ok { rmsg.Event = config.EVENT_USER_ACTION } - b.Log.Debugf("Sending message from %s on %s to gateway", rmsg.Username, b.Account) - b.Log.Debugf("Message is %#v", rmsg) + b.Log.Debugf("<= Sending message from %s on %s to gateway", rmsg.Username, b.Account) + b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg } case xmpp.Presence: diff --git a/gateway/gateway.go b/gateway/gateway.go index dc3a3576..27ffed70 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -256,7 +256,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM continue } } - flog.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel.Name) + flog.Debugf("=> Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel.Name) msg.Channel = channel.Name msg.Avatar = gw.modifyAvatar(origmsg, dest) msg.Username = gw.modifyUsername(origmsg, dest) @@ -281,6 +281,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM } // append the message ID (mID) from this bridge (dest) to our brMsgIDs slice if mID != "" { + flog.Debugf("mID %s: %s", dest.Account, mID) brMsgIDs = append(brMsgIDs, &BrMsgID{dest, mID, channel.ID}) } }