This commit is contained in:
chombier 2001-06-18 09:14:15 +00:00
parent 1c2dead7c8
commit 699584aa8f
7 changed files with 97 additions and 54 deletions

View File

@ -192,10 +192,7 @@ typedef struct {
sockshost[256]; sockshost[256];
/* NONO */ /* NONO */
/* added fields below... /* added fields below... */
short
padding[100]; // Disk space is cheap.... (used to be [98])
*/
short short
authentication, authentication,
compression, compression,
@ -209,6 +206,13 @@ typedef struct {
remoteport; remoteport;
char char
remotehost[180]; remotehost[180];
Boolean
launchurlesc,
unused1;
short
padding[100]; // Disk space is cheap.... (used to be [98])
/* NONO */ /* NONO */
} SessionPrefs; } SessionPrefs;

View File

@ -50,7 +50,7 @@
* RSupdate(wind) - Handle updates on WIND, return 0 if not an RS * RSupdate(wind) - Handle updates on WIND, return 0 if not an RS
* RSactivate(w) - Handle activate events * RSactivate(w) - Handle activate events
* RSdeactivate(w) - Handle deactivate events * RSdeactivate(w) - Handle deactivate events
* RSGetTextSel(w,table) - Returns handle to text selection of window w, table->tabs * RSGetTextSel(w,table,clipspaces) - Returns handle to text selection of window w, table->tabs
* RSnewwindow( wDims, sb, wid, lines * RSnewwindow( wDims, sb, wid, lines
* name,wrap,fnum,fsiz, * name,wrap,fnum,fsiz,
* showit, goaway) - Returns VS # of newly created text window - * showit, goaway) - Returns VS # of newly created text window -

View File

@ -125,6 +125,8 @@ struct VSscrn {
short trinx; /* number of characters to draw at left of cursor */ short trinx; /* number of characters to draw at left of cursor */
short trintag; /* true if waiting for a second multi-byte character */ short trintag; /* true if waiting for a second multi-byte character */
unsigned char trinbuf[4]; unsigned char trinbuf[4];
Str255 tempstr; /* buffer to keep partial new window name/url in vsem */
}; };

View File

@ -264,6 +264,8 @@ TECObjectRef
fromconverter, fromconverter,
toconverter; toconverter;
Boolean
launchurlesc; // true if we accept to process 'launchurl' escape sequences
/* NONO */ /* NONO */
}; };

View File

@ -662,11 +662,11 @@ void telnet_send_initial_options(WindRec *tw)
return; return;
} }
if (tw->authenticate) { if (tw->authenticate && authOK) {
send_will(tw->port, OPT_AUTHENTICATION); send_will(tw->port, OPT_AUTHENTICATION);
(tw->myopts)[OPT_AUTHENTICATION-MHOPTS_BASE] = 1; (tw->myopts)[OPT_AUTHENTICATION-MHOPTS_BASE] = 1;
if (tw->encrypt) { if (tw->encrypt && encryptOK) {
send_will(tw->port, OPT_ENCRYPT); /* will encrypt */ send_will(tw->port, OPT_ENCRYPT); /* will encrypt */
(tw->myopts)[OPT_ENCRYPT-MHOPTS_BASE] = 1; (tw->myopts)[OPT_ENCRYPT-MHOPTS_BASE] = 1;
} }
@ -976,11 +976,10 @@ static void telnet_will(struct WindRec *tw, short option)
case N_AUTHENTICATION: /* will auth */ case N_AUTHENTICATION: /* will auth */
if (!tw->hisopts[OPT_AUTHENTICATION-MHOPTS_BASE]) { if (!tw->hisopts[OPT_AUTHENTICATION-MHOPTS_BASE]) {
if (tw->authenticate) { if (tw->authenticate && authOK) {
(tw->hisopts)[OPT_AUTHENTICATION-MHOPTS_BASE] = 1; (tw->hisopts)[OPT_AUTHENTICATION-MHOPTS_BASE] = 1;
send_do(tw->port, N_AUTHENTICATION); send_do(tw->port, N_AUTHENTICATION);
} } else {
else {
send_dont(tw->port, N_AUTHENTICATION); send_dont(tw->port, N_AUTHENTICATION);
} }
} }

View File

@ -49,6 +49,7 @@
#include "printing.proto.h" #include "printing.proto.h"
#include "event.proto.h" #include "event.proto.h"
#include "menuseg.proto.h" #include "menuseg.proto.h"
#include "url.proto.h"
#include "vsem.proto.h" #include "vsem.proto.h"
@ -379,7 +380,8 @@ enum {
esc_G3, esc_G3,
esc_G0j, esc_G0j,
esc_G2j, esc_G2j,
esc_XTerm esc_XTerm,
esc_url
}; };
@ -515,8 +517,8 @@ void VSem
} }
break; break;
} }
c++; ++c;
ctr--; --ctr;
} }
if ( escflg == esc_root && ctr > 0 if ( escflg == esc_root && ctr > 0
&& (*c & 0x80) && *c < 0xA0 && VSIw->vtemulation != 0 && VSIw->vteightbits ) { && (*c & 0x80) && *c < 0xA0 && VSIw->vtemulation != 0 && VSIw->vteightbits ) {
@ -541,8 +543,8 @@ void VSem
VSIapclear(); VSIapclear();
escflg = esc_csi; escflg = esc_csi;
escflags = 0; escflags = 0;
c++; //CCP ++c; //CCP
ctr--; --ctr;
break; break;
case 0x86: /* ssa */ // - same as ESC 'F' case 0x86: /* ssa */ // - same as ESC 'F'
case 0x87: /* esa */ // - same as ESC 'G' case 0x87: /* esa */ // - same as ESC 'G'
@ -870,11 +872,17 @@ void VSem
// switch to charset // switch to charset
// FIXME // FIXME
goto ShortCut; goto ShortCut;
case '&': // URL processing
escflg = esc_url;
escflags = 0;
break;
default: default:
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_csi && ctr > 0 ) { while ( escflg == esc_csi && ctr > 0 ) {
@ -1115,7 +1123,7 @@ void VSem
case 'i': /* PR: media copy */ case 'i': /* PR: media copy */
if (VSIw->parms[VSIw->parmptr]==5) { /* PR */ if (VSIw->parms[VSIw->parmptr]==5) { /* PR */
/*c++; ctr--; */ /* PR */ /*++c; --ctr; */ /* PR */
VSprON(); /* PR - set status and open temp file etc */ VSprON(); /* PR - set status and open temp file etc */
/* PR - chars will be redirected at top of loop É */ /* PR - chars will be redirected at top of loop É */
/* PR - É in this procedure */ /* PR - É in this procedure */
@ -1303,8 +1311,8 @@ void VSem
// VSprintf( "unknown csi : 0x%x\n", *c ); // VSprintf( "unknown csi : 0x%x\n", *c );
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_decl && ctr > 0 ) { while ( escflg == esc_decl && ctr > 0 ) {
@ -1342,8 +1350,8 @@ void VSem
VSredrawLine(VSIwn); VSredrawLine(VSIwn);
goto ShortCut; goto ShortCut;
} }
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_descl && ctr > 0 ) { while ( escflg == esc_descl && ctr > 0 ) {
@ -1374,8 +1382,8 @@ void VSem
default: default:
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G0 && ctr > 0 ) { while ( escflg == esc_G0 && ctr > 0 ) {
@ -1422,8 +1430,8 @@ void VSem
default: default:
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G1 && ctr > 0 ) { while ( escflg == esc_G1 && ctr > 0 ) {
@ -1451,8 +1459,8 @@ void VSem
default: default:
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G2 && ctr > 0 ) { while ( escflg == esc_G2 && ctr > 0 ) {
@ -1466,8 +1474,8 @@ void VSem
// FIXME... // FIXME...
goto ShortCut; goto ShortCut;
} }
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G3 && ctr > 0 ) { while ( escflg == esc_G3 && ctr > 0 ) {
@ -1481,8 +1489,8 @@ void VSem
// FIXME... // FIXME...
goto ShortCut; goto ShortCut;
} }
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G0j && ctr > 0 ) { while ( escflg == esc_G0j && ctr > 0 ) {
@ -1559,8 +1567,8 @@ void VSem
default: default:
goto ShortCut; goto ShortCut;
} /* switch */ } /* switch */
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
while ( escflg == esc_G2j && ctr > 0 ) { while ( escflg == esc_G2j && ctr > 0 ) {
@ -1581,23 +1589,22 @@ void VSem
default: default:
goto ShortCut; goto ShortCut;
} }
c++; ++c;
ctr--; --ctr;
} /* while */ } /* while */
// Handle XTerm rename functions, code contributed by Bill Rausch // Handle XTerm rename functions, code contributed by Bill Rausch
// Modified by JMB to handle ESC]2; case as well. // Modified by JMB to handle ESC]2; case as well.
if ( escflg == esc_XTerm && ctr > 0 ) { if ( escflg == esc_XTerm && ctr > 0 ) {
static Str255 newname;
if ( escflags == 0 ) { if ( escflags == 0 ) {
if ( *c == '0' || *c == '2') { if ( *c == '0' || *c == '2') {
escflags = 1; escflags = 1;
c++; ++c;
ctr--; --ctr;
} else if ( *c == 'P') { /* palette escape sequence */ } else if ( *c == 'P') { /* palette escape sequence */
escflags = 3; escflags = 3;
c++; ++c;
ctr--; --ctr;
} else if ( *c == 'R') { /* reset palette */ } else if ( *c == 'R') { /* reset palette */
RSresetcolors( VSIwn ); RSresetcolors( VSIwn );
goto ShortCut; goto ShortCut;
@ -1606,20 +1613,20 @@ void VSem
} }
} }
if ( escflags == 1 && ctr > 0 && *c == ';' ) { if ( escflags == 1 && ctr > 0 && *c == ';' ) {
c++; ++c;
ctr--; --ctr;
escflags = 2; escflags = 2;
newname[0] = 0; *VSIw->tempstr = 0;
} }
while ( escflags == 2 && ctr > 0 && *c != 7 && *c != 033) { while ( escflags == 2 && ctr > 0 && *c != 7 && *c != 033) {
if (*newname < 255) { if (*VSIw->tempstr < sizeof(VSIw->tempstr) - 1) {
newname[++(*newname)] = *c; VSIw->tempstr[++(*VSIw->tempstr)] = *c;
} }
c++; ++c;
ctr--; --ctr;
} }
if ( escflags == 2 && ctr > 0 && (*c == 7 || *c == 033) ) { if ( escflags == 2 && ctr > 0 && (*c == 7 || *c == 033) ) {
set_new_window_name( newname, RSgetwindow(VSIwn) ); set_new_window_name( VSIw->tempstr, RSgetwindow(VSIwn) );
if (*c != 07) { if (*c != 07) {
/* This will be undone in the ShortCut below. */ /* This will be undone in the ShortCut below. */
c--; c--;
@ -1644,14 +1651,43 @@ void VSem
} }
} }
while ( escflg == esc_url && ctr > 0 ) {
if ( (escflags == 0 && *c == '&')
|| (escflags == 1 && *c == 'B')
|| (escflags == 2 && *c == 'u')
|| (escflags == 3 && *c == 'r')
|| (escflags == 4 && *c == 'l') ) {
++escflags;
if ( escflags == 5 ) {
*VSIw->tempstr = 0;
}
} else if ( escflags == 5 ) {
if ( *c == 0x0d || *c == 0x0a ) {
// completed. process url.
Boolean result = (tw && tw->launchurlesc) ? HandleURLString(VSIw->tempstr) : false;
RSsendstring( VSIwn, result ? "S" : "F", 1 );
escflg = 0;
} else if (*VSIw->tempstr < sizeof(VSIw->tempstr) - 1) {
VSIw->tempstr[++(*VSIw->tempstr)] = *c;
} else {
// too big...
goto ShortCut;
}
} else {
goto ShortCut;
}
++c;
--ctr;
}
if ( escflg > esc_csi && ctr > 0 ) { if ( escflg > esc_csi && ctr > 0 ) {
ShortCut: /* BYU 2.4.12 - well, sacrificing style for speed */ ShortCut: /* BYU 2.4.12 - well, sacrificing style for speed */
if ( VSIw->possibleForce && *c != 'H' ) //CCP better forcesave if ( VSIw->possibleForce && *c != 'H' ) //CCP better forcesave
VSIw->possibleForce = FALSE; VSIw->possibleForce = FALSE;
escflg = 0; escflg = 0;
escflags = 0; escflags = 0;
c++; ++c;
ctr--; --ctr;
} }
} /* while (ctr > 0) */ } /* while (ctr > 0) */

View File

@ -842,13 +842,13 @@ char *getpass( const char *prompt )
strncat(cprompt, (char *)wind->sshdata.host + 1, wind->sshdata.host[0]); strncat(cprompt, (char *)wind->sshdata.host + 1, wind->sshdata.host[0]);
index = context->_pindex; index = context->_pindex;
if ( gApplicationPrefs->cachePassphrase if ( gApplicationPrefs->cachePassphrase && !wind->sshdata.password[0]
&& getnextcachedpassphrase(cprompt, password, &context->_pindex) ) { && getnextcachedpassphrase(cprompt, password, &context->_pindex) ) {
return password; return password;
} }
LockDialog(); LockDialog();
context->_pindex = index; context->_pindex = index;
if ( gApplicationPrefs->cachePassphrase if ( gApplicationPrefs->cachePassphrase && !wind->sshdata.password[0]
&& getnextcachedpassphrase(cprompt, password, &context->_pindex) ) { && getnextcachedpassphrase(cprompt, password, &context->_pindex) ) {
UnlockDialog(); UnlockDialog();
return password; return password;