mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-25 16:25:40 +00:00
Remove unused code
This commit is contained in:
parent
3311c7f923
commit
e06efbad9f
@ -1,59 +0,0 @@
|
||||
package bmattermost
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func tableformatter(nicks []string, nicksPerRow int, continued bool) string {
|
||||
result := "|IRC users"
|
||||
if continued {
|
||||
result = "|(continued)"
|
||||
}
|
||||
for i := 0; i < 2; i++ {
|
||||
for j := 1; j <= nicksPerRow && j <= len(nicks); j++ {
|
||||
if i == 0 {
|
||||
result += "|"
|
||||
} else {
|
||||
result += ":-|"
|
||||
}
|
||||
}
|
||||
result += "\r\n|"
|
||||
}
|
||||
result += nicks[0] + "|"
|
||||
for i := 1; i < len(nicks); i++ {
|
||||
if i%nicksPerRow == 0 {
|
||||
result += "\r\n|" + nicks[i] + "|"
|
||||
} else {
|
||||
result += nicks[i] + "|"
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func plainformatter(nicks []string, nicksPerRow int) string {
|
||||
return strings.Join(nicks, ", ") + " currently on IRC"
|
||||
}
|
||||
|
||||
func IsMarkup(message string) bool {
|
||||
switch message[0] {
|
||||
case '|':
|
||||
fallthrough
|
||||
case '#':
|
||||
fallthrough
|
||||
case '_':
|
||||
fallthrough
|
||||
case '*':
|
||||
fallthrough
|
||||
case '~':
|
||||
fallthrough
|
||||
case '-':
|
||||
fallthrough
|
||||
case ':':
|
||||
fallthrough
|
||||
case '>':
|
||||
fallthrough
|
||||
case '=':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
@ -138,11 +138,6 @@ func (b *Bmattermost) handleMatter() {
|
||||
}
|
||||
flog.mm.Info("Start listening for Mattermost messages")
|
||||
for message := range mchan {
|
||||
/*
|
||||
if b.ignoreMessage(message.Username, message.Text, "mattermost") {
|
||||
continue
|
||||
}
|
||||
*/
|
||||
texts := strings.Split(message.Text, "\n")
|
||||
for _, text := range texts {
|
||||
flog.mm.Debug("Sending message from " + message.Username + " to " + message.Channel)
|
||||
@ -177,19 +172,3 @@ func (b *Bmattermost) handleMatterHook(mchan chan *MMMessage) {
|
||||
mchan <- m
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bmattermost) formatnicks(nicks []string, continued bool) string {
|
||||
switch b.Config.Mattermost.NickFormatter {
|
||||
case "table":
|
||||
return tableformatter(nicks, b.nicksPerRow(), continued)
|
||||
default:
|
||||
return plainformatter(nicks, b.nicksPerRow())
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bmattermost) nicksPerRow() int {
|
||||
if b.Config.Mattermost.NicksPerRow < 1 {
|
||||
return 4
|
||||
}
|
||||
return b.Config.Mattermost.NicksPerRow
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user