X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsieve.c;h=20c032d9d26e59cd6701d0dd6b6f5569be3cacb1;hb=e0cc5508c771d9d4b4ea4cb6a9ffb8de0ceb0dba;hp=be609ced806cb0c7de3b7b7bb8ef2ba79e48c027;hpb=eeb9ac359d4586daabb451a88429348d26464d1b;p=citadel.git diff --git a/webcit/sieve.c b/webcit/sieve.c index be609ced8..20c032d9d 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -372,8 +372,30 @@ void create_script(void) { void display_rules_editor_inner_div(void) { - int i; - char buf[256], targ[256]; + int i, j; + char buf[256]; + + struct { + char name[128]; + } *rooms = NULL; + int num_roomnames = 0; + int num_roomnames_alloc = 0; + + + /* load the roomnames */ + serv_puts("LKRA"); + serv_getln(buf, sizeof buf); + if (buf[0] == '1') { + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + ++num_roomnames; + if (num_roomnames > num_roomnames_alloc) { + num_roomnames_alloc += 250; + rooms = realloc(rooms, (num_roomnames_alloc * 128)); + } + extract_token(rooms[num_roomnames-1].name, buf, 0, '|', 128); + } + } + /* * This script should get called by every onChange event... @@ -467,21 +489,17 @@ void display_rules_editor_inner_div(void) { wprintf(""); wprintf("
", i); - wprintf("", i); + for (j=0; j"); + escputs(rooms[j].name); + wprintf("\n"); } wprintf("\n"); wprintf("
"); @@ -515,6 +533,7 @@ void display_rules_editor_inner_div(void) { " \n" ); + free(rooms); }