|
|
@ -754,36 +754,36 @@ func (k *Keybase) ListMembersOfConversation(convID chat1.ConvIDStr) (chat1.ChatM |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ListConvsOnName returns a list of all conversations for a chat1.ChatChannel
|
|
|
|
// ListConvsOnName returns a list of all conversations for a chat1.ChatChannel
|
|
|
|
func (k *Keybase) ListConvsOnName(channel chat1.ChatChannel) ([]chat1.ConvSummary, error) { |
|
|
|
func (k *Keybase) ListConvsOnName(channel chat1.ChatChannel) (*[]chat1.ConvSummary, error) { |
|
|
|
|
|
|
|
type result struct { |
|
|
|
|
|
|
|
Conversations []chat1.ConvSummary `json:"conversations"` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type res struct { |
|
|
|
type res struct { |
|
|
|
Result []chat1.ConvSummary `json:"result"` |
|
|
|
Result result `json:"result"` |
|
|
|
Error *Error `json:"error,omitempty"` |
|
|
|
Error *Error `json:"error,omitempty"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var r res |
|
|
|
var r res |
|
|
|
|
|
|
|
|
|
|
|
opts := SendMessageOptions{ |
|
|
|
arg := newListConvsOnNameArg(channel) |
|
|
|
Channel: channel, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arg := newSendMessageArg(opts) |
|
|
|
|
|
|
|
arg.Method = "listconvsonname" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonBytes, _ := json.Marshal(arg) |
|
|
|
jsonBytes, _ := json.Marshal(arg) |
|
|
|
|
|
|
|
fmt.Printf("%#v\n", arg) |
|
|
|
|
|
|
|
|
|
|
|
cmdOut, err := k.Exec("chat", "api", "-m", string(jsonBytes)) |
|
|
|
cmdOut, err := k.Exec("chat", "api", "-m", string(jsonBytes)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return r.Result, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(cmdOut, &r) |
|
|
|
err = json.Unmarshal(cmdOut, &r) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return r.Result, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if r.Error != nil { |
|
|
|
if r.Error != nil { |
|
|
|
return r.Result, fmt.Errorf("%v", r.Error.Message) |
|
|
|
return nil, fmt.Errorf("%v", r.Error.Message) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return r.Result, nil |
|
|
|
return &r.Result.Conversations, nil |
|
|
|
} |
|
|
|
} |
|
|
|