aboutsummaryrefslogtreecommitdiff
path: root/connector/irc
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-17 19:02:26 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-17 19:02:26 +0100
commita4dd3b310d68f5c6147bdeaf8ecd3556c2cf7859 (patch)
tree14d4dbdcc03803f4a40b06f2862bce78df318a76 /connector/irc
parent531b59bf953ad6c1fb7adfb6554dcc412fbe47e5 (diff)
downloadeasybridge-a4dd3b310d68f5c6147bdeaf8ecd3556c2cf7859.tar.gz
easybridge-a4dd3b310d68f5c6147bdeaf8ecd3556c2cf7859.zip
Go fmt
Diffstat (limited to 'connector/irc')
-rw-r--r--connector/irc/irc.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/connector/irc/irc.go b/connector/irc/irc.go
index ccbd803..318c663 100644
--- a/connector/irc/irc.go
+++ b/connector/irc/irc.go
@@ -1,10 +1,10 @@
package irc
import (
- "time"
+ "fmt"
_ "os"
"strings"
- "fmt"
+ "time"
"github.com/lrstanley/girc"
@@ -19,19 +19,19 @@ type IRC struct {
handler Handler
connected bool
- timeout int
+ timeout int
- nick string
- name string
+ nick string
+ name string
server string
- conn *girc.Client
+ conn *girc.Client
}
func (irc *IRC) SetHandler(h Handler) {
irc.handler = h
}
-func(irc *IRC) Protocol() string {
+func (irc *IRC) Protocol() string {
return "irc"
}
@@ -64,9 +64,9 @@ func (irc *IRC) Configure(c Configuration) error {
client := girc.New(girc.Config{
Server: irc.server,
- Port: port,
- Nick: irc.nick,
- User: irc.nick,
+ Port: port,
+ Nick: irc.nick,
+ User: irc.nick,
//Out: os.Stderr,
SSL: ssl,
})
@@ -85,7 +85,7 @@ func (irc *IRC) Configure(c Configuration) error {
go irc.connectLoop(client)
for i := 0; i < 42; i++ {
- time.Sleep(time.Duration(1)*time.Second)
+ time.Sleep(time.Duration(1) * time.Second)
if irc.conn != client {
break
}
@@ -245,9 +245,9 @@ func (irc *IRC) ircConnected(c *girc.Client, e girc.Event) {
func (irc *IRC) ircPrivmsg(c *girc.Client, e girc.Event) {
ev := &Event{
- Type: EVENT_MESSAGE,
+ Type: EVENT_MESSAGE,
Author: UserID(e.Source.Name + "@" + irc.server),
- Text: e.Last(),
+ Text: e.Last(),
}
if e.IsFromChannel() {
ev.Room = RoomID(e.Params[0] + "@" + irc.server)
@@ -265,9 +265,9 @@ func (irc *IRC) ircJoin(c *girc.Client, e girc.Event) {
} else {
user := UserID(e.Source.Name + "@" + irc.server)
ev := &Event{
- Type: EVENT_JOIN,
+ Type: EVENT_JOIN,
Author: user,
- Room: room,
+ Room: room,
}
irc.handler.Event(ev)
irc.handler.UserInfoUpdated(user, &UserInfo{
@@ -283,9 +283,9 @@ func (irc *IRC) ircPart(c *girc.Client, e girc.Event) {
} else {
user := UserID(e.Source.Name + "@" + irc.server)
ev := &Event{
- Type: EVENT_LEAVE,
+ Type: EVENT_LEAVE,
Author: user,
- Room: room,
+ Room: room,
}
irc.handler.Event(ev)
irc.handler.UserInfoUpdated(user, &UserInfo{
@@ -304,9 +304,9 @@ func (irc *IRC) ircNamreply(c *girc.Client, e girc.Event) {
src := girc.ParseSource(name)
if src.Name != irc.nick {
irc.handler.Event(&Event{
- Type: EVENT_JOIN,
+ Type: EVENT_JOIN,
Author: UserID(src.Name + "@" + irc.server),
- Room: room,
+ Room: room,
})
}
}