Skip to content
Snippets Groups Projects
Commit bf897acf authored by deuce's avatar deuce
Browse files

Merge GHost, quiet and nostatus support contributed by Anonymous on

sourceforge.
https://sourceforge.net/p/syncterm/feature-requests/13/
This also addresses request 14
https://sourceforge.net/p/syncterm/feature-requests/14/
And disables uifc during startup.
parent 0178cb16
No related branches found
No related tags found
No related merge requests found
...@@ -164,6 +164,12 @@ struct sort_order_info sort_order[] = { ...@@ -164,6 +164,12 @@ struct sort_order_info sort_order[] = {
,offsetof(struct bbslist, font) ,offsetof(struct bbslist, font)
,sizeof(((struct bbslist *)NULL)->font) ,sizeof(((struct bbslist *)NULL)->font)
} }
,{
"Hide Popups"
,0
,offsetof(struct bbslist, hidepopups)
,sizeof(((struct bbslist *)NULL)->hidepopups)
}
,{ ,{
NULL NULL
,0 ,0
...@@ -230,7 +236,8 @@ char *conn_type_help= "`Connection Type`\n\n" ...@@ -230,7 +236,8 @@ char *conn_type_help= "`Connection Type`\n\n"
"`SSH`..............: Connect using the Secure Shell (SSH-2) protocol\n" "`SSH`..............: Connect using the Secure Shell (SSH-2) protocol\n"
"`Modem`............: Connect using a dial-up modem\n" "`Modem`............: Connect using a dial-up modem\n"
"`Serial`...........: Connect directly to a serial communications port\n" "`Serial`...........: Connect directly to a serial communications port\n"
"`Shell`............: Connect to a local PTY (*nix only)\n"; "`Shell`............: Connect to a local PTY (*nix only)\n"
"`MBBS GHost`.......: Communicate using the Major BBS 'GHost' protocol\n";
; ;
ini_style_t ini_style = { ini_style_t ini_style = {
...@@ -619,6 +626,7 @@ void read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id ...@@ -619,6 +626,7 @@ void read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id
entry->conn_type=CONN_TYPE_RAW; entry->conn_type=CONN_TYPE_RAW;
entry->screen_mode=iniGetEnum(section,NULL,"ScreenMode",screen_modes_enum,SCREEN_MODE_CURRENT); entry->screen_mode=iniGetEnum(section,NULL,"ScreenMode",screen_modes_enum,SCREEN_MODE_CURRENT);
entry->nostatus=iniGetBool(section,NULL,"NoStatus",FALSE); entry->nostatus=iniGetBool(section,NULL,"NoStatus",FALSE);
entry->hidepopups=iniGetBool(section,NULL,"HidePopups",FALSE);
iniGetString(section,NULL,"DownloadPath",home,entry->dldir); iniGetString(section,NULL,"DownloadPath",home,entry->dldir);
iniGetString(section,NULL,"UploadPath",home,entry->uldir); iniGetString(section,NULL,"UploadPath",home,entry->uldir);
...@@ -717,7 +725,7 @@ void read_list(char *listpath, struct bbslist **list, struct bbslist *defaults, ...@@ -717,7 +725,7 @@ void read_list(char *listpath, struct bbslist **list, struct bbslist *defaults,
int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isdefault) int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isdefault)
{ {
char opt[20][80]; /* <- Beware of magic number! */ char opt[21][80]; /* 21=Holds number of menu items, 80=Number of columns */
char *opts[(sizeof(opt)/sizeof(opt[0]))+1]; char *opts[(sizeof(opt)/sizeof(opt[0]))+1];
int changed=0; int changed=0;
int copt=0,i,j; int copt=0,i,j;
...@@ -792,6 +800,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd ...@@ -792,6 +800,7 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd
sprintf(opt[i++], "ANSI Music %s",music_names[item->music]); sprintf(opt[i++], "ANSI Music %s",music_names[item->music]);
sprintf(opt[i++], "Address Family %s",address_family_names[item->address_family]); sprintf(opt[i++], "Address Family %s",address_family_names[item->address_family]);
sprintf(opt[i++], "Font %s",item->font); sprintf(opt[i++], "Font %s",item->font);
sprintf(opt[i++], "Hide Popups %s",item->hidepopups?"Yes":"No");
opt[i][0]=0; opt[i][0]=0;
uifc.changes=0; uifc.changes=0;
...@@ -836,6 +845,8 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd ...@@ -836,6 +845,8 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd
" IPv4 or IPv6\n\n" " IPv4 or IPv6\n\n"
"~ Font ~\n" "~ Font ~\n"
" Select font to use for the entry\n\n" " Select font to use for the entry\n\n"
"~ Hide Popups ~\n"
" Hide all popup dialogs (i.e., Connecting, Disconnected, etc.)\n\n"
; ;
i=uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&copt,&bar i=uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&copt,&bar
,isdefault ? "Edit Default Connection":"Edit Directory Entry" ,isdefault ? "Edit Default Connection":"Edit Directory Entry"
...@@ -1143,6 +1154,11 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd ...@@ -1143,6 +1154,11 @@ int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isd
} }
} }
break; break;
case 19:
item->hidepopups=!item->hidepopups;
changed=1;
iniSetBool(&inifile,itemname,"HidePopups",item->hidepopups,&ini_style);
break;
} }
if(uifc.changes) if(uifc.changes)
changed=1; changed=1;
...@@ -1190,6 +1206,7 @@ void add_bbs(char *listpath, struct bbslist *bbs) ...@@ -1190,6 +1206,7 @@ void add_bbs(char *listpath, struct bbslist *bbs)
iniSetInteger(&inifile,bbs->name,"ANSIMusic",bbs->music,&ini_style); iniSetInteger(&inifile,bbs->name,"ANSIMusic",bbs->music,&ini_style);
iniSetEnum(&inifile, bbs->name, "AddressFamily", address_families, bbs->address_family, &ini_style); iniSetEnum(&inifile, bbs->name, "AddressFamily", address_families, bbs->address_family, &ini_style);
iniSetString(&inifile,bbs->name,"Font",bbs->font,&ini_style); iniSetString(&inifile,bbs->name,"Font",bbs->font,&ini_style);
iniSetBool(&inifile,bbs->name,"HidePopups",bbs->hidepopups,&ini_style);
if((listfile=fopen(listpath,"w"))!=NULL) { if((listfile=fopen(listpath,"w"))!=NULL) {
iniWriteFile(listfile,inifile); iniWriteFile(listfile,inifile);
fclose(listfile); fclose(listfile);
......
...@@ -91,6 +91,8 @@ struct bbslist { ...@@ -91,6 +91,8 @@ struct bbslist {
int music; int music;
int address_family; int address_family;
char font[80]; char font[80];
int hidepopups;
char ghost_program[9]; /* GHost program can only be 8 chars max. */
}; };
extern char *music_names[]; extern char *music_names[];
......
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
#include "conn_telnet.h" #include "conn_telnet.h"
struct conn_api conn_api; struct conn_api conn_api;
char *conn_types_enum[]={"Unknown","RLogin","RLoginReversed","Telnet","Raw","SSH","Modem","Serial","Shell",NULL}; char *conn_types_enum[]={"Unknown","RLogin","RLoginReversed","Telnet","Raw","SSH","Modem","Serial","Shell","MBBSGhost",NULL};
char *conn_types[]={"Unknown","RLogin","RLogin Reversed","Telnet","Raw","SSH","Modem","Serial","Shell",NULL}; char *conn_types[]={"Unknown","RLogin","RLogin Reversed","Telnet","Raw","SSH","Modem","Serial","Shell","MBBS GHost",NULL};
short unsigned int conn_ports[]={0,513,513,23,0,22,0,0 short unsigned int conn_ports[]={0,513,513,23,0,22,0,0,0
#ifdef __unix__ #ifdef __unix__
,65535 ,65535
#endif #endif
...@@ -334,6 +334,7 @@ int conn_connect(struct bbslist *bbs) ...@@ -334,6 +334,7 @@ int conn_connect(struct bbslist *bbs)
conn_api.binary_mode_off=telnet_binary_mode_off; conn_api.binary_mode_off=telnet_binary_mode_off;
break; break;
case CONN_TYPE_RAW: case CONN_TYPE_RAW:
case CONN_TYPE_MBBS_GHOST:
conn_api.connect=raw_connect; conn_api.connect=raw_connect;
conn_api.close=raw_close; conn_api.close=raw_close;
break; break;
...@@ -421,7 +422,9 @@ int conn_socket_connect(struct bbslist *bbs) ...@@ -421,7 +422,9 @@ int conn_socket_connect(struct bbslist *bbs)
char portnum[6]; char portnum[6];
char str[LIST_ADDR_MAX+40]; char str[LIST_ADDR_MAX+40];
if (!bbs->hidepopups) {
uifc.pop("Looking up host"); uifc.pop("Looking up host");
}
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_flags=PF_UNSPEC; hints.ai_flags=PF_UNSPEC;
switch(bbs->address_family) { switch(bbs->address_family) {
...@@ -447,8 +450,10 @@ int conn_socket_connect(struct bbslist *bbs) ...@@ -447,8 +450,10 @@ int conn_socket_connect(struct bbslist *bbs)
failcode=FAILURE_RESOLVE; failcode=FAILURE_RESOLVE;
res=NULL; res=NULL;
} }
if (!bbs->hidepopups) {
uifc.pop(NULL); uifc.pop(NULL);
uifc.pop("Connecting..."); uifc.pop("Connecting...");
}
/* Drain the input buffer to avoid accidental cancel */ /* Drain the input buffer to avoid accidental cancel */
while(kbhit()) while(kbhit())
...@@ -530,7 +535,9 @@ connected: ...@@ -530,7 +535,9 @@ connected:
int keepalives = TRUE; int keepalives = TRUE;
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalives, sizeof(keepalives)); setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalives, sizeof(keepalives));
if (!bbs->hidepopups) {
uifc.pop(NULL); uifc.pop(NULL);
}
return(sock); return(sock);
} }
failcode=FAILURE_DISCONNECTED; failcode=FAILURE_DISCONNECTED;
...@@ -540,8 +547,11 @@ connected: ...@@ -540,8 +547,11 @@ connected:
if(res) if(res)
freeaddrinfo(res); freeaddrinfo(res);
if (!bbs->hidepopups) {
uifc.pop(NULL); uifc.pop(NULL);
}
conn_api.terminate=-1; conn_api.terminate=-1;
if (!bbs->hidepopups) {
switch(failcode) { switch(failcode) {
case FAILURE_RESOLVE: case FAILURE_RESOLVE:
sprintf(str,"Cannot resolve %s!",bbs->addr); sprintf(str,"Cannot resolve %s!",bbs->addr);
...@@ -574,6 +584,7 @@ connected: ...@@ -574,6 +584,7 @@ connected:
"After connect() succeeded, the socket was in a disconnected state."); "After connect() succeeded, the socket was in a disconnected state.");
break; break;
} }
}
conn_close(); conn_close();
if (sock != INVALID_SOCKET) if (sock != INVALID_SOCKET)
closesocket(sock); closesocket(sock);
......
...@@ -24,6 +24,7 @@ enum { ...@@ -24,6 +24,7 @@ enum {
,CONN_TYPE_MODEM ,CONN_TYPE_MODEM
,CONN_TYPE_SERIAL ,CONN_TYPE_SERIAL
,CONN_TYPE_SHELL ,CONN_TYPE_SHELL
,CONN_TYPE_MBBS_GHOST
,CONN_TYPE_TERMINATOR ,CONN_TYPE_TERMINATOR
}; };
......
...@@ -117,6 +117,7 @@ int rlogin_connect(struct bbslist *bbs) ...@@ -117,6 +117,7 @@ int rlogin_connect(struct bbslist *bbs)
char *ruser; char *ruser;
char *passwd; char *passwd;
if (!bbs->hidepopups)
init_uifc(TRUE, TRUE); init_uifc(TRUE, TRUE);
ruser=bbs->user; ruser=bbs->user;
...@@ -168,10 +169,82 @@ int rlogin_connect(struct bbslist *bbs) ...@@ -168,10 +169,82 @@ int rlogin_connect(struct bbslist *bbs)
} }
} }
/* Negotiate with GHost and bail if there's apparently no GHost listening. */
if(bbs->conn_type == CONN_TYPE_MBBS_GHOST) {
char sbuf[80];
char rbuf[10];
struct timeval tv;
int idx, ret;
fd_set rds;
FD_ZERO(&rds);
FD_SET(sock, &rds);
tv.tv_sec=1;
tv.tv_usec=0;
/* Check to make sure GHost is actually listening */
sendsocket(sock, "\r\nMBBS: PING\r\n", 14);
idx = 0;
while ((ret = select(sock+1, &rds, NULL, NULL, &tv))==1) {
recv(sock, rbuf+idx, 1, 0);
rbuf[++idx] = 0;
/* It says ERROR, but this is a good response to PING. */
// TODO: Should there be a \r\n after "ERROR"?
if (strstr(rbuf,"ERROR")) {
break;
}
/* We didn't receive the desired response in time, so bail. */
if (idx >= sizeof(rbuf)) {
return(-1);
}
}
if (ret < 1) {
return(-1);
}
sprintf(sbuf, "MBBS: %s %d '%s' %d %s\r\n",
bbs->ghost_program, /* Program name */
2, /* GHost protocol version */
bbs->user, /* User's full name */
999, /* Time remaining */
"GR" /* GR = ANSI, NG = ASCII */
);
sendsocket(sock, sbuf, strlen(sbuf));
idx = 0;
while ((ret = select(sock+1, &rds, NULL, NULL, &tv))==1) {
recv(sock, rbuf+idx, 1, 0);
rbuf[++idx] = 0;
/* GHost says it's launching the program, so pass terminal to user. */
// TODO: Should there be a \r\n after "OK"?
if (strstr(rbuf,"OK")) {
break;
}
/* We didn't receive the desired response in time, so bail. */
if (idx >= sizeof(rbuf)) {
return(-1);
}
}
if (ret < 1) {
return(-1);
}
}
_beginthread(rlogin_output_thread, 0, NULL); _beginthread(rlogin_output_thread, 0, NULL);
_beginthread(rlogin_input_thread, 0, NULL); _beginthread(rlogin_input_thread, 0, NULL);
if (!bbs->hidepopups) {
uifc.pop(NULL); uifc.pop(NULL);
}
return(0); return(0);
} }
......
...@@ -85,6 +85,8 @@ char *usage = ...@@ -85,6 +85,8 @@ char *usage =
"-s = enable \"Safe Mode\" which prevents writing/browsing local files\n" "-s = enable \"Safe Mode\" which prevents writing/browsing local files\n"
"-T = when the ONLY argument, dumps the terminfo entry to stdout and exits\n" "-T = when the ONLY argument, dumps the terminfo entry to stdout and exits\n"
"-v = when the ONLY argument, dumps the version info to stdout and exits\n" "-v = when the ONLY argument, dumps the version info to stdout and exits\n"
"-c = Hide the status line\n"
"-q = Quiet mode (Hide various popups such as this during a connect)\n"
"\n" "\n"
"URL format is: [(rlogin|telnet|ssh|raw)://][user[:password]@]domainname[:port]\n" "URL format is: [(rlogin|telnet|ssh|raw)://][user[:password]@]domainname[:port]\n"
"raw:// URLs MUST include a port.\n" "raw:// URLs MUST include a port.\n"
...@@ -835,6 +837,11 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def ...@@ -835,6 +837,11 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def
bbs->port=conn_ports[bbs->conn_type]; bbs->port=conn_ports[bbs->conn_type];
p1=url+6; p1=url+6;
} }
else if(!strnicmp("ghost://",url,8)) {
bbs->conn_type=CONN_TYPE_MBBS_GHOST;
bbs->port=conn_ports[bbs->conn_type];
p1=url+8;
}
/* ToDo: RFC2806 */ /* ToDo: RFC2806 */
p3=strchr(p1,'@'); p3=strchr(p1,'@');
if(p3!=NULL) { if(p3!=NULL) {
...@@ -859,6 +866,11 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def ...@@ -859,6 +866,11 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def
else else
p2 = p1; p2 = p1;
} }
p3=strrchr(p1,'/');
if(p3!=NULL) {
*p3=0;
SAFECOPY(bbs->ghost_program,p3+1);
}
SAFECOPY(bbs->name,p1); SAFECOPY(bbs->name,p1);
p2=strrchr(p2,':'); p2=strrchr(p2,':');
if(p2!=NULL) { if(p2!=NULL) {
...@@ -866,10 +878,6 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def ...@@ -866,10 +878,6 @@ void parse_url(char *url, struct bbslist *bbs, int dflt_conn_type, int force_def
p2++; p2++;
bbs->port=atoi(p2); bbs->port=atoi(p2);
} }
/* Remove trailing / (Win32 adds one 'cause it hates me) */
p2=strrchr(p1,'/');
if(p2!=NULL && *(p2+1)==0)
*p2=0;
SAFECOPY(bbs->addr,p1); SAFECOPY(bbs->addr,p1);
/* Find BBS listing in users phone book */ /* Find BBS listing in users phone book */
...@@ -1286,6 +1294,8 @@ int main(int argc, char **argv) ...@@ -1286,6 +1294,8 @@ int main(int argc, char **argv)
char *p, *lp; char *p, *lp;
int cvmode; int cvmode;
int ww, wh, sf; int ww, wh, sf;
int default_hidepopups=0;
int default_nostatus=0;
const char syncterm_termcap[]="\n# terminfo database entry for SyncTERM\n" const char syncterm_termcap[]="\n# terminfo database entry for SyncTERM\n"
"syncterm|SyncTERM,\n" "syncterm|SyncTERM,\n"
// cwin maybe? Or just left/right and top/bottom margins? // cwin maybe? Or just left/right and top/bottom margins?
...@@ -1565,6 +1575,12 @@ int main(int argc, char **argv) ...@@ -1565,6 +1575,12 @@ int main(int argc, char **argv)
case 'S': case 'S':
safe_mode=1; safe_mode=1;
break; break;
case 'Q':
default_hidepopups=1;
break;
case 'C':
default_nostatus=1;
break;
default: default:
goto USAGE; goto USAGE;
} }
...@@ -1632,12 +1648,16 @@ int main(int argc, char **argv) ...@@ -1632,12 +1648,16 @@ int main(int argc, char **argv)
if(!winsock_startup()) if(!winsock_startup())
return(1); return(1);
bbs->hidepopups = default_hidepopups;
bbs->nostatus = default_nostatus;
load_font_files(); load_font_files();
while((!quitting) && (bbs!=NULL || (bbs=show_bbslist(last_bbs, FALSE))!=NULL)) { while((!quitting) && (bbs!=NULL || (bbs=show_bbslist(last_bbs, FALSE))!=NULL)) {
gettextinfo(&txtinfo); /* Current mode may have changed while in show_bbslist() */ gettextinfo(&txtinfo); /* Current mode may have changed while in show_bbslist() */
FREE_AND_NULL(last_bbs); FREE_AND_NULL(last_bbs);
uifcbail(); uifcbail();
textmode(screen_to_ciolib(bbs->screen_mode)); textmode(screen_to_ciolib(bbs->screen_mode));
if (!bbs->hidepopups)
init_uifc(TRUE, TRUE); init_uifc(TRUE, TRUE);
load_font_files(); load_font_files();
setfont(find_font_id(bbs->font),TRUE,1); setfont(find_font_id(bbs->font),TRUE,1);
...@@ -1710,6 +1730,7 @@ int main(int argc, char **argv) ...@@ -1710,6 +1730,7 @@ int main(int argc, char **argv)
/* Started from the command-line with a URL */ /* Started from the command-line with a URL */
init_uifc(TRUE, TRUE); init_uifc(TRUE, TRUE);
i=1; i=1;
if (!bbs->hidepopups) {
switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,NULL,"Save this directory entry?",YesNo)) { switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,NULL,"Save this directory entry?",YesNo)) {
case 0: /* Yes */ case 0: /* Yes */
edit_list(NULL, bbs,settings.list_path,FALSE); edit_list(NULL, bbs,settings.list_path,FALSE);
...@@ -1722,6 +1743,7 @@ int main(int argc, char **argv) ...@@ -1722,6 +1743,7 @@ int main(int argc, char **argv)
} }
} }
} }
}
if (bbs_alloc) { if (bbs_alloc) {
bbs_alloc=FALSE; bbs_alloc=FALSE;
free(bbs); free(bbs);
......
...@@ -2463,7 +2463,9 @@ BOOL doterm(struct bbslist *bbs) ...@@ -2463,7 +2463,9 @@ BOOL doterm(struct bbslist *bbs)
if(!is_connected(NULL)) { if(!is_connected(NULL)) {
WRITE_OUTBUF(); WRITE_OUTBUF();
hold_update=oldmc; hold_update=oldmc;
if (!bbs->hidepopups) {
uifcmsg("Disconnected","`Disconnected`\n\nRemote host dropped connection"); uifcmsg("Disconnected","`Disconnected`\n\nRemote host dropped connection");
}
check_exit(FALSE); check_exit(FALSE);
cterm_clearscreen(cterm, cterm->attr); /* Clear screen into scrollback */ cterm_clearscreen(cterm, cterm->attr); /* Clear screen into scrollback */
scrollback_lines=cterm->backpos; scrollback_lines=cterm->backpos;
...@@ -2822,6 +2824,9 @@ BOOL doterm(struct bbslist *bbs) ...@@ -2822,6 +2824,9 @@ BOOL doterm(struct bbslist *bbs)
} }
/* FALLTHROUGH for curses/ansi modes */ /* FALLTHROUGH for curses/ansi modes */
case 0x2c00: /* ALT-Z */ case 0x2c00: /* ALT-Z */
if (bbs->hidepopups) {
break;
}
i=wherex(); i=wherex();
j=wherey(); j=wherey();
switch(syncmenu(bbs, &speed)) { switch(syncmenu(bbs, &speed)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment