X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Faddressbook_popup.c;h=5758ec3b0641d7e91c6e2f106b73dd7ae8828705;hb=c3f8711d0064b6f414e3b90c7c9640ae6894cbda;hp=91641482c36ef1af9c41e592e1cded1ad603a8e3;hpb=9b5e06a2943d2069927c239907c5871ece2f85ac;p=citadel.git diff --git a/webcit/addressbook_popup.c b/webcit/addressbook_popup.c index 91641482c..5758ec3b0 100644 --- a/webcit/addressbook_popup.c +++ b/webcit/addressbook_popup.c @@ -28,7 +28,10 @@ void address_book_popup(void) { */ void display_address_book_middle_div(void) { char buf[256]; - char ebuf[256]; + long len; + char *Name, *Namee; + HashList *List; + HashPos *it; begin_ajax_response(); @@ -46,18 +49,29 @@ void display_address_book_middle_div(void) { escputs(serv_info.serv_humannode); wprintf("\n"); + + List = NewHash(); serv_puts("LKRA"); serv_getln(buf, sizeof buf); - if (buf[0] == '1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + if (buf[0] == '1') while(len = serv_getln(buf, sizeof buf), strcmp(buf, "000")) { if (extract_int(buf, 6) == VIEW_ADDRESSBOOK) { - extract_token(ebuf, buf, 0, '|', sizeof ebuf); - wprintf("\n"); + Name = (char*) malloc(len + 1); + len = extract_token(Name, buf, 0, '|', len); + Put(List, Name, len, Name, NULL); } } + + SortByHashKey(List); + it = GetNewHashPos(); + while (GetNextHashPos(List, it, &len, &Name, (void**)&Namee)) { + wprintf("\n"); + } + DeleteHashPos(&it); + DeleteHash(&List); wprintf(""); wprintf(""); @@ -82,29 +96,42 @@ void display_address_book_middle_div(void) { */ void display_address_book_inner_div() { char buf[256]; - char username[256]; int num_targets = 0; char target_id[64]; char target_label[64]; + long len; + char *Name, *Namee; + HashList *List; + HashPos *it; int i; char saved_roomname[128]; begin_ajax_response(); + List = NewHash(); wprintf("
" "