Commit fdb9d46f authored by deuce's avatar deuce
Browse files

CTRL-S spys on the current node.

parent 49b4d442
......@@ -425,6 +425,54 @@ void node_toggles(int nodenum) {
}
}
int chat(int nodenum) {
return(-1);
}
int dospy(int nodenum, bbs_startup_t *bbs_startup) {
char str[80],str2[80];
int i;
if(bbs_startup->temp_dir[0])
snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup->temp_dir, nodenum);
else
snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup->ctrl_dir, nodenum);
endwin();
i=spyon(str);
refresh();
switch(i) {
case SPY_NOSOCKET:
uifc.msg("Could not create socket");
return(-1);
case SPY_NOCONNECT:
sprintf(str2,"Failed to connect to %s",str);
uifc.msg(str2);
return(-1);
case SPY_SELECTFAILED:
uifc.msg("select() failed, connection terminated.");
return(-1);
case SPY_SOCKETLOST:
uifc.msg("Spy socket lost");
return(-1);
case SPY_STDINLOST:
uifc.msg("STDIN has gone away... you probably can't close this window. :-)");
return(-1);
case SPY_CLOSED:
break;
default:
sprintf(str,"Unknown return code %d",i);
uifc.msg(str);
return(-1);
}
return(0);
}
int main(int argc, char** argv) {
char** opt;
char** mopt;
......@@ -629,6 +677,7 @@ int main(int argc, char** argv) {
uifc.helpbuf= "`Synchronet Monitor:`\n"
"\nCTRL-E displays the error log"
"\nCTRL-S spys on the currently selected node"
"\nToDo: Add more help.";
j=uifc.list(WIN_ORG|WIN_MID|WIN_ESC|WIN_ACT|WIN_DYN,0,0,70,&main_dflt,&main_bar
......@@ -658,6 +707,11 @@ int main(int argc, char** argv) {
}
continue;
}
if(j==-21) { /* CTRL-S */
dospy(main_dflt+1,&bbs_startup);
}
if(j <= -2)
continue;
......@@ -692,41 +746,7 @@ int main(int argc, char** argv) {
"\nToDo: Add help";
switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Node Options",opt)) {
case 0: /* Spy */
if(bbs_startup.temp_dir[0])
snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup.temp_dir, j+1);
else
snprintf(str,sizeof(str),"%slocalspy%d.sock", bbs_startup.temp_dir, j+1);
endwin();
i=spyon(str);
refresh();
switch(i) {
case SPY_NOSOCKET:
uifc.msg("Could not create socket");
break;
case SPY_NOCONNECT:
sprintf(str2,"Failed to connect to %s",str);
uifc.msg(str2);
break;
case SPY_SELECTFAILED:
uifc.msg("select() failed, connection terminated.");
case SPY_SOCKETLOST:
uifc.msg("Spy socket lost");
break;
case SPY_STDINLOST:
uifc.msg("STDIN has gone away... you probably can't close this window. :-)");
break;
case SPY_CLOSED:
break;
default:
sprintf(str,"Unknown return code %d",i);
uifc.msg(str);
}
dospy(j+1,&bbs_startup);
break;
case 1: /* Node Toggles */
......
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