Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit aa65e8fe authored by rswindell's avatar rswindell

Created bbs select_shell() and select_editor() methods.

parent 0e193484
......@@ -1698,14 +1698,7 @@ int sbbs_t::exec(csi_t *csi)
RESTORELINE;
return(0);
case CS_SELECT_SHELL:
csi->logic=LOGIC_TRUE;
for(i=0;i<cfg.total_shells;i++)
uselect(1,i,"Command Shell",cfg.shell[i]->name,cfg.shell[i]->ar);
if((i=uselect(0,useron.shell,0,0,0))>=0) {
useron.shell=i;
putuserrec(&cfg,useron.number,U_SHELL,8,cfg.shell[i]->code); }
else
csi->logic=LOGIC_FALSE;
csi->logic=select_shell() ? LOGIC_TRUE:LOGIC_FALSE;
return(0);
case CS_SET_SHELL:
csi->logic=LOGIC_TRUE;
......@@ -1721,15 +1714,7 @@ int sbbs_t::exec(csi_t *csi)
return(0);
case CS_SELECT_EDITOR:
csi->logic=LOGIC_TRUE;
for(i=0;i<cfg.total_xedits;i++)
uselect(1,i,"External Editor",cfg.xedit[i]->name,cfg.xedit[i]->ar);
if(useron.xedit) useron.xedit--;
if((i=uselect(0,useron.xedit,0,0,0))>=0) {
useron.xedit=i+1;
putuserrec(&cfg,useron.number,U_XEDIT,8,cfg.xedit[i]->code); }
else
csi->logic=LOGIC_FALSE;
csi->logic=select_editor() ? LOGIC_TRUE:LOGIC_FALSE;
return(0);
case CS_SET_EDITOR:
csi->logic=LOGIC_TRUE;
......@@ -1832,3 +1817,31 @@ int sbbs_t::exec(csi_t *csi)
return(0); }
}
bool sbbs_t::select_shell(void)
{
int i;
for(i=0;i<cfg.total_shells;i++)
uselect(1,i,"Command Shell",cfg.shell[i]->name,cfg.shell[i]->ar);
if((i=uselect(0,useron.shell,0,0,0))>=0) {
useron.shell=i;
putuserrec(&cfg,useron.number,U_SHELL,8,cfg.shell[i]->code);
return(true);
}
return(false);
}
bool sbbs_t::select_editor(void)
{
int i;
for(i=0;i<cfg.total_xedits;i++)
uselect(1,i,"External Editor",cfg.xedit[i]->name,cfg.xedit[i]->ar);
if(useron.xedit) useron.xedit--;
if((i=uselect(0,useron.xedit,0,0,0))>=0) {
useron.xedit=i+1;
putuserrec(&cfg,useron.number,U_XEDIT,8,cfg.xedit[i]->code);
return(true);
}
return(false);
}
\ No newline at end of file
......@@ -2437,6 +2437,30 @@ js_getnstime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return(JS_TRUE);
}
static JSBool
js_select_shell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
sbbs_t* sbbs;
if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
*rval = BOOLEAN_TO_JSVAL(sbbs->select_shell());
return(JS_TRUE);
}
static JSBool
js_select_editor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
sbbs_t* sbbs;
if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
*rval = BOOLEAN_TO_JSVAL(sbbs->select_editor());
return(JS_TRUE);
}
static jsMethodSpec js_bbs_functions[] = {
{"atcode", js_atcode, 1, JSTYPE_STRING, JSDOCSTR("string code")
,JSDOCSTR("return @-code value")
......@@ -2676,6 +2700,12 @@ static jsMethodSpec js_bbs_functions[] = {
{"get_newscantime", js_getnstime, 1, JSTYPE_NUMBER, JSDOCSTR("number time")
,JSDOCSTR("get newscan time, returns new newscan time value (time_t)")
},
{"select_shell", js_select_shell, 0, JSTYPE_BOOLEAN, ""
,JSDOCSTR("allows user to select a new command shell")
},
{"select_editor", js_select_editor, 0, JSTYPE_BOOLEAN, ""
,JSDOCSTR("allows user to select a new external message editor")
},
{0}
};
......
......@@ -361,6 +361,9 @@ public:
bool ftp_get(csi_t* csi, SOCKET ctrl_sock, char* src, char* dest, bool dir=false);
SOCKET ftp_data_sock(csi_t* csi, SOCKET ctrl_sock, SOCKADDR_IN*);
bool select_shell(void);
bool select_editor(void);
void sys_info(void);
void user_info(void);
void xfer_policy(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment