pike.git / lib / modules / Protocols.pmod / Line.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/Line.pmod:1:   /* -  * $Id: Line.pmod,v 1.7 1998/10/16 15:34:58 grubba Exp $ +  * $Id: Line.pmod,v 1.8 1998/10/16 17:14:19 nisse Exp $    *    * Line-buffered protocol handling.    *    * Henrik Grubbström 1998-05-27    */      class simple   {    static object con;   
pike.git/lib/modules/Protocols.pmod/Line.pmod:75:    multi_line_buffer = "";    handle(data);    }    } else {    handle_command(line);    }    }       static string read_buffer = "";    -  static string get_line() +  static string read_line()    {    int i = search(read_buffer, "\r\n");    if (i == -1) {    return 0;    }    string data = read_buffer[..i-1]; // Not the "\r\n".    read_buffer = read_buffer[i+2..];       return data;    }       static void read_callback(mixed ignored, string data)    {    touch_time();       read_buffer += data;       string line;    -  while( (line = get_line()) ) +  while( (line = read_line()) )    _handle_command(line);    }       object(ADT.queue) send_q = ADT.queue();       static string write_buffer = "";    static void write_callback(mixed ignored)    {    touch_time();   
pike.git/lib/modules/Protocols.pmod/Line.pmod:213:    send_q->put(res);    con->set_write_callback(write_callback);    }   };      class imap_style   {    inherit simple;       function handle_literal = 0; +  function handle_line = 0; +     int literal_length;      #if 0    function timeout_handler = 0;   #endif       static void read_callback(mixed ignored, string data)    {    touch_time();   
pike.git/lib/modules/Protocols.pmod/Line.pmod:238:    if (strlen(read_buffer) < literal_length)    return;    string literal = read_buffer[..literal_length - 1];    read_buffer = read_buffer[literal_length..];       function handler = handle_literal;    handle_literal = 0;       handler(literal);    } else { -  string line = get_line(); +  string line = read_line();    if (line) -  handle_command(line); +  handle_line(line);    else    break;    }    }    }       void expect_literal(int length, function callback)    {    literal_length = length;    handle_literal = callback;