summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/42wim/matterbridge-plus/bridge/helper.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-04-10 23:39:38 +0200
committerWim <wim@42.be>2016-04-10 23:39:38 +0200
commitde4c7804101a47a01d0c9b88ea34d2b153e2b6b9 (patch)
treefa379bc2e706951a913e0c7009d9906e42363655 /vendor/github.com/42wim/matterbridge-plus/bridge/helper.go
parent6b18257185b1830bd2eff83fae30bdd2055f78b0 (diff)
downloadmatterbridge-msglm-de4c7804101a47a01d0c9b88ea34d2b153e2b6b9.tar.gz
matterbridge-msglm-de4c7804101a47a01d0c9b88ea34d2b153e2b6b9.tar.bz2
matterbridge-msglm-de4c7804101a47a01d0c9b88ea34d2b153e2b6b9.zip
Vendor libs
Diffstat (limited to 'vendor/github.com/42wim/matterbridge-plus/bridge/helper.go')
-rw-r--r--vendor/github.com/42wim/matterbridge-plus/bridge/helper.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/vendor/github.com/42wim/matterbridge-plus/bridge/helper.go b/vendor/github.com/42wim/matterbridge-plus/bridge/helper.go
new file mode 100644
index 00000000..7669ad57
--- /dev/null
+++ b/vendor/github.com/42wim/matterbridge-plus/bridge/helper.go
@@ -0,0 +1,59 @@
+package bridge
+
+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
+}