Ejemplo n.º 1
0
// Switchinput dispatches actions via input
func SwitchInput(ipmsg *goipmsg.IPMSG, input string, quit chan string) {
	switch input {
	case "help":
		fmt.Println("usage:")
		fmt.Println("\thelp: show this help.")
		fmt.Println("\tquit: quit this programme.")
		fmt.Println("\tjoin: let others know U.")
		fmt.Println("\tlist: list up users U know.")
		fmt.Println("\tsend: send message to user.")
		fmt.Println("\tread: read received message.")
	case "quit":
		fmt.Println("quitting...")
		ipmsg.Close()
		quit <- "quitting"
	case "join":
		Join(ipmsg)
	case "list":
		List(ipmsg)
	case "send":
		Send(ipmsg)
	case "read":
		Read(ipmsg)
	}
}