func (c *Controller) handleInput() { if len(c.editBuffer) == 0 { return } tokens := strings.Split(string(c.editBuffer), " ") if tokens[0][0] == '/' { switch tokens[0] { case "/save": case "/whitelistfriends": for _, f := range config.Friends() { c.cHandler.Whitelist(f.Addr) } case "/whitelist": addrs := tokens[1:] for _, addr := range addrs { c.cHandler.Whitelist(addr) } case "/friends": } } else { c.chatroom.Broadcast(string(c.editBuffer)) c.window.MsgQ <- &iMessage{ SenderID: c.self.ID(), SenderName: c.self.Name(), Type: Public, Body: string(c.editBuffer), } } c.editBuffer = []rune{} c.window.EditBuffer <- c.editBuffer }
// Start starts this feature func (app *FriendApp) Start() { app.quit = make(chan bool) app.listView = NewListView() w, h := termbox.Size() app.listView.Start(w, h, config.Friends()) go app.listenEvents() }