Added title bar and basic message and command input
This commit is contained in:
parent
508a04cf4c
commit
f42d6011c6
23 changed files with 399 additions and 83 deletions
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/khlieng/irc/storage"
|
||||
|
@ -16,7 +16,7 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
for msg := range irc.Messages {
|
||||
switch msg.Command {
|
||||
case JOIN:
|
||||
user := parseUser(msg.Prefix)
|
||||
user := msg.Prefix
|
||||
|
||||
session.sendJSON("join", Join{
|
||||
Server: irc.Host,
|
||||
|
@ -34,7 +34,7 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
}
|
||||
|
||||
case PART:
|
||||
user := parseUser(msg.Prefix)
|
||||
user := msg.Prefix
|
||||
|
||||
session.sendJSON("part", Join{
|
||||
Server: irc.Host,
|
||||
|
@ -65,15 +65,18 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
}
|
||||
|
||||
case QUIT:
|
||||
/*
|
||||
session.sendJSON("quit", Quit{
|
||||
Server: irc.Host,
|
||||
User: user,
|
||||
})
|
||||
*/
|
||||
user := msg.Prefix
|
||||
|
||||
session.sendJSON("quit", Quit{
|
||||
Server: irc.Host,
|
||||
User: user,
|
||||
})
|
||||
|
||||
channelStore.RemoveUserAll(user, irc.Host)
|
||||
|
||||
case RPL_WELCOME,
|
||||
RPL_YOURHOST,
|
||||
RPL_CREATED,
|
||||
RPL_LUSERCLIENT,
|
||||
RPL_LUSEROP,
|
||||
RPL_LUSERUNKNOWN,
|
||||
|
@ -92,6 +95,8 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
Topic: msg.Trailing,
|
||||
})
|
||||
|
||||
channelStore.SetTopic(msg.Trailing, irc.Host, msg.Params[1])
|
||||
|
||||
case RPL_NAMREPLY:
|
||||
users := strings.Split(msg.Trailing, " ")
|
||||
|
||||
|
@ -138,10 +143,5 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
}
|
||||
|
||||
func printMessage(msg *Message, irc *IRC) {
|
||||
fmt.Printf("%s: %s %s %s\n", irc.nick, msg.Prefix, msg.Command, msg.Params)
|
||||
|
||||
if msg.Trailing != "" {
|
||||
fmt.Println(msg.Trailing)
|
||||
}
|
||||
fmt.Println()
|
||||
log.Println(irc.nick+":", msg.Prefix, msg.Command, msg.Params, msg.Trailing)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue