diff options
author | Kevin Chabowski <kevin@kch42.de> | 2014-03-25 13:30:20 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2014-03-25 13:30:20 +0100 |
commit | 74f01b3117ae49d2d42facc362d8c932f5769d9d (patch) | |
tree | ec5ca7f202966a865c44a73831b2a6c3f2affba2 /rooms.go | |
parent | 07ab116456823b92e9c8963eaca5a6ae648390ec (diff) | |
download | simplechat-74f01b3117ae49d2d42facc362d8c932f5769d9d.tar.gz simplechat-74f01b3117ae49d2d42facc362d8c932f5769d9d.tar.bz2 simplechat-74f01b3117ae49d2d42facc362d8c932f5769d9d.zip |
We need the room too when joining
Diffstat (limited to 'rooms.go')
-rw-r--r-- | rooms.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -42,7 +42,7 @@ func (r *Room) Broadcast() { var rooms = make(map[string]Room) -func Join(room, nick string) (*Buddy, error) { +func Join(room, nick string) (*Buddy, *Room, error) { r, ok := rooms[room] if !ok { r = NewRoom() @@ -50,11 +50,11 @@ func Join(room, nick string) (*Buddy, error) { } if _, there := r.Buddies[nick]; there { - return nil, errors.New("Nickname is already in use") + return nil, room, errors.New("Nickname is already in use") } if len(r.Buddies) >= *perroom { - return nil, errors.New("Room is full") + return nil, room, errors.New("Room is full") } r.Messages <- Message{ |