func (h *hipchatInput) Stream() (input.Conn, error) { h.Lock() defer h.Unlock() if !h.running { return nil, errors.New("not running") } // TODO: return conn // TODO: use server url c, err := hipchat.NewClient(h.username, h.password, "bot") if err != nil { return nil, err } return newConn(c), nil }
func (h *hipchatInput) Start() error { if len(h.username) == 0 || len(h.password) == 0 || len(h.server) == 0 { return errors.New("missing hipchat configuration") } h.Lock() defer h.Unlock() if h.running { return nil } // TODO: use server url c, err := hipchat.NewClient(h.username, h.password, "bot") if err != nil { return err } h.client = c h.exit = make(chan bool) h.running = true return nil }