aboutsummaryrefslogtreecommitdiff
path: root/connector/irc
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-17 21:04:21 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-17 21:04:21 +0100
commit31bba8d946940df4858818f5efcc31cfd5a0a035 (patch)
treee9d2b7a6d6152fc45413648316a8ff7a514580b9 /connector/irc
parent5ab2608ee8bd36b7c7b0d670d24b5851250e3887 (diff)
downloadeasybridge-31bba8d946940df4858818f5efcc31cfd5a0a035.tar.gz
easybridge-31bba8d946940df4858818f5efcc31cfd5a0a035.zip
Talking to Easybridge is now possible for some things
Diffstat (limited to 'connector/irc')
-rw-r--r--connector/irc/irc.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/connector/irc/irc.go b/connector/irc/irc.go
index 318c663..aa9723f 100644
--- a/connector/irc/irc.go
+++ b/connector/irc/irc.go
@@ -102,7 +102,7 @@ func (irc *IRC) User() UserID {
func (irc *IRC) checkRoomId(id RoomID) (string, error) {
x := strings.Split(string(id), "@")
- if len(x) != 2 || x[1] != irc.server || x[0][0] != '#' {
+ if x[0][0] != '#' || (len(x) == 2 && x[1] != irc.server) {
return "", fmt.Errorf("Invalid room ID: %s", id)
}
return x[0], nil
@@ -110,7 +110,7 @@ func (irc *IRC) checkRoomId(id RoomID) (string, error) {
func (irc *IRC) checkUserId(id UserID) (string, error) {
x := strings.Split(string(id), "@")
- if len(x) != 2 || x[1] != irc.server || x[0][0] == '#' {
+ if x[0][0] == '#' || (len(x) == 2 && x[1] != irc.server) {
return "", fmt.Errorf("Invalid user ID: %s", id)
}
return x[0], nil
@@ -149,6 +149,10 @@ func (irc *IRC) Join(roomId RoomID) error {
}
func (irc *IRC) Invite(userId UserID, roomId RoomID) error {
+ if roomId == "" {
+ return nil
+ }
+
ch, err := irc.checkRoomId(roomId)
if err != nil {
return err