13-swipe-p2p chat app/index.js
// Watches SFTP for file sharing between peer

Watches SFTP for file sharing between peer
Watches SFTP for file sharing between peer
function watchFTP(signal) {
	if(signal == 'Request'){
		if(ftp){
			peer.send('{"type" : "FTP", "value" : "Decline"}');
			return false;
		}
		var res = confirm('Peer wants to share some file...');
		if(res){
			peer.send('{"type" : "FTP", "value" : "Accept"}');
			initiateFTP(true);
			startFTP();
		}
		else
			peer.send('{"type" : "FTP", "value" : "Decline"}');
	}
	else if(signal == 'Accept')
		initiateFTP(true);
	else if(signal == 'Decline')
		initiateFTP(false);
}
function watchFTP ( signal ) { if ( signal == 'Request' ) { if ( ftp ) { peer . send ( '{"type" : "FTP", "value" : "Decline"}' ) ; return false ; } var res = confirm ( 'Peer wants to share some file...' ) ; if ( res ) { peer . send ( '{"type" : "FTP", "value" : "Accept"}' ) ; initiateFTP ( true ) ; startFTP ( ) ; } else peer . send ( '{"type" : "FTP", "value" : "Decline"}' ) ; } else if ( signal == 'Accept' ) initiateFTP ( true ) ; else if ( signal == 'Decline' ) initiateFTP ( false ) ; }
Watches SFTP for file sharing between peer
Watches SFTP for file sharing between peer