diff --git a/chatIn.go b/chatIn.go index ef2249d..332464b 100644 --- a/chatIn.go +++ b/chatIn.go @@ -149,7 +149,7 @@ func createFiltersString(channels []Channel) string { } // Run `keybase chat api-listen` to get new messages coming into keybase and send them into the channel -func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) { +func getNewMessages(k *Keybase, c chan<- ChatIn, execOptions []string) { execString := []string{"chat", "api-listen"} if len(execOptions) > 0 { execString = append(execString, execOptions...) @@ -171,7 +171,7 @@ func getNewMessages(k Keybase, c chan<- ChatIn, execOptions []string) { } // Run runs `keybase chat api-listen`, and passes incoming messages to the message handler func -func (k Keybase) Run(handler func(ChatIn), options ...RunOptions) { +func (k *Keybase) Run(handler func(ChatIn), options ...RunOptions) { var heartbeatFreq int64 runOptions := make([]string, 0) if len(options) > 0 { @@ -190,6 +190,7 @@ func (k Keybase) Run(handler func(ChatIn), options ...RunOptions) { if len(options[0].FilterChannels) > 0 { runOptions = append(runOptions, "--filter-channels") runOptions = append(runOptions, createFiltersString(options[0].FilterChannels)) + } if options[0].FilterChannel.Name != "" { runOptions = append(runOptions, "--filter-channel") diff --git a/chatOut.go b/chatOut.go index d4de132..935043e 100644 --- a/chatOut.go +++ b/chatOut.go @@ -131,7 +131,7 @@ func (c Chat) Delete(messageId int) (ChatOut, error) { } // ChatList returns a list of all conversations. -func (k Keybase) ChatList() ([]conversation, error) { +func (k *Keybase) ChatList() ([]conversation, error) { m := chatOut{} m.Method = "list" diff --git a/keybase.go b/keybase.go index a02c88e..8ec674c 100644 --- a/keybase.go +++ b/keybase.go @@ -27,7 +27,7 @@ type Keybase struct { // Chat holds basic information about a specific conversation type Chat struct { - keybase Keybase + keybase *Keybase Channel Channel } @@ -53,8 +53,8 @@ type status struct { } // NewKeybase returns a new Keybase. Optionally, you can pass a string containing the path to the Keybase executable as the first argument. -func NewKeybase(path ...string) Keybase { - k := Keybase{} +func NewKeybase(path ...string) *Keybase { + k := &Keybase{} if len(path) < 1 { k.Path = "keybase" } else { @@ -69,7 +69,7 @@ func NewKeybase(path ...string) Keybase { } // NewChat returns a new Chat instance -func (k Keybase) NewChat(channel Channel) Chat { +func (k *Keybase) NewChat(channel Channel) Chat { return Chat{ keybase: k, Channel: channel, @@ -77,7 +77,7 @@ func (k Keybase) NewChat(channel Channel) Chat { } // username returns the username of the currently logged-in Keybase user. -func (k Keybase) username() string { +func (k *Keybase) username() string { cmd := exec.Command(k.Path, "status", "-j") cmdOut, err := cmd.Output() if err != nil { @@ -91,7 +91,7 @@ func (k Keybase) username() string { } // loggedIn returns true if Keybase is currently logged in, otherwise returns false. -func (k Keybase) loggedIn() bool { +func (k *Keybase) loggedIn() bool { cmd := exec.Command(k.Path, "status", "-j") cmdOut, err := cmd.Output() if err != nil { @@ -105,7 +105,7 @@ func (k Keybase) loggedIn() bool { } // version returns the version string of the client. -func (k Keybase) version() string { +func (k *Keybase) version() string { cmd := exec.Command(k.Path, "version", "-S", "-f", "s") cmdOut, err := cmd.Output() if err != nil { diff --git a/wallet.go b/wallet.go index 6d08ea0..3516bd2 100644 --- a/wallet.go +++ b/wallet.go @@ -93,7 +93,7 @@ func walletAPIOut(keybasePath string, w walletOut) (walletOutResult, error) { } // TxDetail returns details of a stellar transaction -func (k Keybase) TxDetail(txid string) (WalletResult, error) { +func (k *Keybase) TxDetail(txid string) (WalletResult, error) { m := walletOut{} m.Method = "details" m.Params.Options.Txid = txid @@ -103,7 +103,7 @@ func (k Keybase) TxDetail(txid string) (WalletResult, error) { } // StellarAddress returns the primary stellar address of a given user -func (k Keybase) StellarAddress(user string) (string, error) { +func (k *Keybase) StellarAddress(user string) (string, error) { m := walletOut{} m.Method = "lookup" m.Params.Options.Name = user