ftp_conn.c

gurba-0.40/lib/kernel/net/ftp_conn.c · 999 B

From the archive gurba.tgz

Download the archive   « Back to the archive contents

object prev;
string callback;
string read_callback;
int connected;


void FTPLOG( string str ) {
  write_file( "/logs/ftpd", ctime( time() ) + " : " + str );
}

void message_done( void ) {
  if( prev != 0 )
    call_other( prev, callback );
}

void create( void ) {
  callback = "FTP_write";
  connected = 0;
}

void set_callback( string str ) {
  callback = str;
}

void open( void ) {
  connected = 1;
}

int is_connected( void ) {
  return( connected );
}

void close( void ) {
  if( read_callback == "FTP_stor" )
    call_other( prev, "FTP_write" );
}

void start_connection( string ip, int port, int type ) {
  connect( ip, port, "tcp" );
}

void send_data( mixed data ) {
  prev = previous_object();
  send_message( data );
  if( send_message( -1 ) == 0 )
    call_out( "message_done", 1 );
  /* message_done(); */
}

void set_read_callback( string func ) {
  prev = previous_object();
  read_callback = func;
}

void receive_message( string str ) {
  call_other( prev, read_callback, str );
}

Site Stats

Snippets: 1791
Codebases: 571