]> Cypherpunks.ru repositories - goircd.git/blobdiff - daemon.go
Continuation after negative replies
[goircd.git] / daemon.go
index 59d6372b4a64b3e611e28cfd48ac53737ad69e8e..a5b2d77dcd822d257132fe045cee53473bf89757 100644 (file)
--- a/daemon.go
+++ b/daemon.go
@@ -84,7 +84,7 @@ func (daemon *Daemon) SendMotd(client *Client) {
                        }
 
                        client.ReplyNicknamed("375", "- "+daemon.hostname+" Message of the day -")
-                       for _, s := range bytes.Split(motd, []byte("\n")) {
+                       for _, s := range bytes.Split(bytes.TrimRight(motd, "\n"), []byte("\n")) {
                                client.ReplyNicknamed("372", "- "+string(s))
                        }
                        client.ReplyNicknamed("376", "End of /MOTD command")
@@ -239,7 +239,6 @@ func (daemon *Daemon) HandlerJoin(client *Client, cmd string) {
                }
                if denied {
                        client.ReplyNicknamed("475", room, "Cannot join channel (+k) - bad key")
-                       continue
                }
                if denied || joined {
                        continue
@@ -247,6 +246,7 @@ func (daemon *Daemon) HandlerJoin(client *Client, cmd string) {
                room_new, room_sink := daemon.RoomRegister(room)
                if key != "" {
                        room_new.key = key
+                       room_new.StateSave()
                }
                room_sink <- ClientEvent{client, EVENT_NEW, ""}
        }
@@ -348,6 +348,7 @@ func (daemon *Daemon) Processor(events chan ClientEvent) {
                                        r, found := daemon.rooms[room]
                                        if !found {
                                                client.ReplyNoChannel(room)
+                                               continue
                                        }
                                        daemon.room_sinks[r] <- ClientEvent{client, EVENT_DEL, ""}
                                }
@@ -395,6 +396,7 @@ func (daemon *Daemon) Processor(events chan ClientEvent) {
                                r, found := daemon.rooms[cols[0]]
                                if !found {
                                        client.ReplyNoChannel(cols[0])
+                                       continue
                                }
                                var change string
                                if len(cols) > 1 {
@@ -412,6 +414,7 @@ func (daemon *Daemon) Processor(events chan ClientEvent) {
                                r, found := daemon.rooms[room]
                                if !found {
                                        client.ReplyNoChannel(room)
+                                       continue
                                }
                                daemon.room_sinks[r] <- ClientEvent{client, EVENT_WHO, ""}
                        case "WHOIS":