-void display_address_book_middle_div(void) {
- char buf[256];
- char ebuf[256];
-
- begin_ajax_response();
-
- wprintf("<table border=0 width=100%%><tr valign=middle>");
- wprintf("<td align=left><img src=\"static/viewcontacts_32x.gif\"></td>");
- wprintf("<td align=center>");
+HashList* GetAddressbookList()
+{
+ HashList *List = NULL;
+ const StrBuf *WhichAddrBook;
+ StrBuf *saved_roomname;
+ StrBuf *Name;
+ StrBuf *Line;
+ long BufLen;
+ int IsLocalAddrBook;
+
+ WhichAddrBook = sbstr("which_addr_book");
+ IsLocalAddrBook = strcasecmp(ChrPtr(WhichAddrBook), "__LOCAL_USERS__") == 1;
+
+ if (IsLocalAddrBook) {
+ serv_puts("LIST");
+ }
+ else {
+ /* remember the default addressbook for this room */
+ set_room_pref("defaddrbook", NewStrBufDup(WhichAddrBook), 0);
+ saved_roomname = NewStrBufDup(WC->CurRoom.name);
+ gotoroom(WhichAddrBook);
+ serv_puts("DVCA");
+ }
+
+ Line = NewStrBuf();
+ StrBuf_ServGetln(Line);
+ if (GetServerStatus(Line, NULL) == 1) {
+ List = NewHash(1, NULL);
+ while (BufLen = StrBuf_ServGetln(Line),
+ ((BufLen >= 0) &&
+ ((BufLen != 3) || strcmp(ChrPtr(Line), "000"))))
+ {
+ if (IsLocalAddrBook &&
+ (BufLen > 5) &&
+ (strncmp(ChrPtr(Line), "SYS_", 4) == 0))
+ {
+ continue;
+ }
+ Name = NewStrBufPlain(NULL, StrLength(Line));
+ StrBufExtract_token(Name, Line, 0, '|');
+ Put(List, SKEY(Name), Name, HFreeStrBuf);