add custom plugin commands; start developing 'artifical star' plugin to generate 'vagrant stars'

This commit is contained in:
2024-02-07 17:01:58 +03:00
parent 869421d52f
commit 0f4fcf5015
13 changed files with 780 additions and 277 deletions

View File

@@ -958,11 +958,14 @@ static cc_hresult inftyhandler(int fd, _U_ const char *key, const char *val){
// custom camera plugin command
static cc_hresult pluginhandler(int fd, _U_ const char *key, const char *val){
if(!camera->plugincmd) return RESULT_BADKEY;
const char *r = camera->plugincmd(val);
if(!r) return RESULT_FAIL;
if(*r == 0) return RESULT_OK;
if(!cc_sendstrmessage(fd, r)) return RESULT_DISCONNECTED;
return RESULT_SILENCE;
static cc_charbuff *ans = NULL;
if(!ans) ans = cc_charbufnew();
cc_buff_lock(ans);
cc_charbufclr(ans);
cc_hresult r = camera->plugincmd(val, ans);
cc_buff_unlock(ans);
if(ans->buflen && !cc_sendstrmessage(fd, ans->buf)) r = RESULT_DISCONNECTED;
return r;
}
// get headers