Branch: Tag:

1998-09-02

1998-09-02 16:05:43 by Niels Möller <nisse@lysator.liu.se>

Basic protocol parsing.

Rev: lib/modules/Protocols.pmod/IMAP.pmod/dummy_server.pike:1.1
Rev: lib/modules/Protocols.pmod/IMAP.pmod/imap_server.pike:1.1
Rev: lib/modules/Protocols.pmod/IMAP.pmod/requests.pmod:1.1
Rev: lib/modules/Protocols.pmod/IMAP.pmod/server.pike:1.1
Rev: lib/modules/Protocols.pmod/IMAP.pmod/types.pmod:1.1

1: + /* IMAP.types +  * +  */    -  + /* Output types */ + class imap_atom + { +  string name; +  +  void create(string s) { name = s; } +  +  string format() { return name; } + } +  + class imap_string + { +  string data; +  +  void create(string s) { data = s; } +  +  string format() +  { +  if (sizeof(array_sscanf(data, "%*[^\0-\037\177-\377]%s")[0])) +  return "\"" + replace(data, ({ "\"", "\\" }), ({ "\\\"", "\\\\" }) ) + "\""; +  else +  return sprintf("{%d}\r\n%s", strlen(data), data); +  } + } +  + class imap_list + { +  array data; +  +  void create(array a) { data = a; } +  +  string format() { return "(" + data->format * " " + ")"; } + } +  + class imap_prefix + { +  array data; +  +  void create(array a) { data = a; } +  +  string format() { return "[" + data->format * " " + "]"; } + } +  + class imap_number + { +  int value; +  +  void create(int n) { value = n; } +  +  string format() { return sprintf("%d", value); } + }   Newline at end of file added.