shithub: hell

ref: 213ae0b56ce5cc1c2d618d9155fa851039e78712
dir: /dispatch.go/

View raw version
package main

import (
	"fmt"
	
	"github.com/mattn/go-mastodon"
)

func (hc *Hellclient) clientDispatch() {	
	for {
		select {
			case statustoot := <- hc.dispatch:
				hc.lock()
				var err error
				status, err := postStatusDetailed(*hc.client, *statustoot)
				if err != nil {
					fmt.Println(err)
				}
				hc.recentpost = status
				hc.unlock()
		}
	}
}

func (hc *Hellclient) dispatchStatus(status string, visibility string) {
	hc.dispatch <- postStatus(status, visibility)
}

func (hc *Hellclient) dispatchReply(posttext string, replyto mastodon.ID, postItem *mastodon.Status) {
	hc.dispatch <- postReply(posttext, replyto, hc.currentuser.ID, postItem)
}