Added /quit, the server IRC client gets cleaned up properly when quitting, pulled command handling out into a separate file

This commit is contained in:
khlieng 2015-02-09 01:00:30 +01:00
parent d11aa3ff4e
commit 99ef788906
8 changed files with 83 additions and 49 deletions

View file

@ -43,7 +43,7 @@ func handleWS(ws *websocket.Conn) {
sessionLock.Unlock()
session = storedSession
log.Println(addr, "attached to existing IRC connections")
log.Println(addr, "attached to", session.numIRC(), "existing IRC connections")
channels := session.user.GetChannels()
for i, channel := range channels {
@ -124,9 +124,10 @@ func handleWS(ws *websocket.Conn) {
json.Unmarshal(req.Request, &data)
if irc, ok := session.getIRC(data.Server); ok {
irc.Quit()
session.deleteIRC(data.Server)
channelStore.RemoveUserAll(irc.GetNick(), data.Server)
session.user.RemoveServer(data.Server)
irc.Quit()
}
case "chat":