mirror of
https://github.com/muesli/telephant
synced 2025-02-16 19:48:24 +00:00
Add Search bridge method
This commit is contained in:
parent
ff977f8ded
commit
45af81d34c
2 changed files with 21 additions and 0 deletions
|
@ -263,6 +263,25 @@ func (mod *Account) Unfollow(id string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Search starts a search
|
||||
func (mod *Account) Search(token string, ch chan interface{}) error {
|
||||
tt, err := mod.client.Search(context.Background(), token, true)
|
||||
if err != nil {
|
||||
ev := accounts.ErrorEvent{
|
||||
Message: err.Error(),
|
||||
Internal: false,
|
||||
}
|
||||
mod.evchan <- ev
|
||||
return err
|
||||
}
|
||||
|
||||
for _, s := range tt.Statuses {
|
||||
ch <- mod.handleStatus(s)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Tag starts a hashtag stream
|
||||
func (mod *Account) Tag(token string, ch chan interface{}) error {
|
||||
tt, err := mod.client.GetTimelineHashtag(context.Background(), token, false, &mastodon.Pagination{
|
||||
|
|
|
@ -24,6 +24,7 @@ type UIBridge struct {
|
|||
_ func(url string) `slot:"uploadAttachment"`
|
||||
_ func(id string) `slot:"loadConversation"`
|
||||
_ func(id string) `slot:"loadAccount"`
|
||||
_ func(token string) `slot:"search"`
|
||||
_ func(token string) `slot:"tag"`
|
||||
|
||||
_ func(idx int64) `slot:"closePane"`
|
||||
|
@ -116,6 +117,7 @@ func setupQmlBridges() {
|
|||
uiBridge.ConnectUploadAttachment(uploadAttachment)
|
||||
uiBridge.ConnectLoadConversation(loadConversation)
|
||||
uiBridge.ConnectLoadAccount(loadAccount)
|
||||
uiBridge.ConnectSearch(search)
|
||||
uiBridge.ConnectTag(tag)
|
||||
uiBridge.ConnectClosePane(closePane)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue