summaryrefslogtreecommitdiffstats
path: root/bridge/irc/helper.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-08-14 21:48:51 +0200
committerWim <wim@42.be>2016-08-14 22:44:59 +0200
commitff9479670070c0f1de4cf66622df7b69736dd22a (patch)
treec3003f19d8821900398b5b2803188555725030b6 /bridge/irc/helper.go
parent1f72ca4c4ecb5ab3ef831b8e70c74909f5720fb8 (diff)
downloadmatterbridge-msglm-ff9479670070c0f1de4cf66622df7b69736dd22a.tar.gz
matterbridge-msglm-ff9479670070c0f1de4cf66622df7b69736dd22a.tar.bz2
matterbridge-msglm-ff9479670070c0f1de4cf66622df7b69736dd22a.zip
Refactor bridge. Allows bridging between every protocol
Diffstat (limited to 'bridge/irc/helper.go')
-rw-r--r--bridge/irc/helper.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/bridge/irc/helper.go b/bridge/irc/helper.go
new file mode 100644
index 00000000..355dc552
--- /dev/null
+++ b/bridge/irc/helper.go
@@ -0,0 +1,59 @@
+package birc
+
+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
+}