X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Faddressbook_popup.c;h=c119cc18ee0b206df714070fa64cfe5367e48dcf;hp=074801f15c0124a9e04db1d65e7b65889f37a9c9;hb=b98d9f087b3a24a9549470ab066c2aea187ecfba;hpb=f5c1330914acc193f96892efc191a32ee537dfb5 diff --git a/webcit/addressbook_popup.c b/webcit/addressbook_popup.c index 074801f15..c119cc18e 100644 --- a/webcit/addressbook_popup.c +++ b/webcit/addressbook_popup.c @@ -1,214 +1,75 @@ /* * AJAX-powered auto-completion * - * Copyright (c) 2005-2010 by the citadel.org team + * Copyright (c) 1996-2012 by the citadel.org team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. + * This program is open source software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "webcit.h" -/* - * Call this right before wDumpContent() on any page which requires the address book popup - */ -void address_book_popup(void) { - /* Open a new div, hidden initially, for address book popups. */ - wc_printf("\n"); /* End of 'content' div */ - wc_printf("
"); - wc_printf("
"); - wc_printf("
"); - wc_printf("
"); - wc_printf("
"); - /* The 'address_book_popup' div will be closed by wDumpContent() */ -} - -/* - * Address book popup window - */ -void display_address_book_middle_div(void) { - char buf[256]; - long len; - char *Name; - const char *VCName; - void *Namee; - StrBuf *DefAddrBook; - HashList *List; - HashPos *it; - - begin_ajax_response(); - - DefAddrBook = get_room_pref("defaddrbook"); - - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf("
"); - - wc_printf("
" - "
"); - - wc_printf("
"); - wc_printf("
"); - - wc_printf("", - bstr("target_input") - ); - - end_ajax_response(); -} - - - /* * Address book popup results */ -void display_address_book_inner_div() { - char buf[256]; - int num_targets = 0; - char target_id[64]; - char target_label[64]; - long len; - char *Name; - const char *VCName; - void *Namee; - HashList *List; - HashPos *it; - int i; +HashList* GetAddressbookList() +{ + HashList *List = NULL; + const StrBuf *WhichAddrBook; StrBuf *saved_roomname; + StrBuf *Name; + StrBuf *Line; + long BufLen; + int IsLocalAddrBook; - begin_ajax_response(); - - List = NewHash(1, NULL); - wc_printf("
" - "\n"); - - wc_printf("%s: ", _("Add")); - - num_targets = num_tokens(bstr("target_input"), '|'); - for (i=0; i", target_id); + if (!IsLocalAddrBook) { + gotoroom(saved_roomname); + FreeStrBuf(&saved_roomname); } - /* This 'close window' button works. Omitting it because we already have a close button - * in the upper right corner, and this one takes up space. - * - wc_printf(""); - */ - - wc_printf("
\n"); - - end_ajax_response(); + return List; } @@ -218,6 +79,6 @@ void InitModule_ADDRBOOK_POPUP (void) { - WebcitAddUrlHandler(HKEY("display_address_book_middle_div"), "", 0, display_address_book_middle_div, 0); - WebcitAddUrlHandler(HKEY("display_address_book_inner_div"), "", 0, display_address_book_inner_div, 0); + + RegisterIterator("ITERATE:ABNAMES", 0, NULL, GetAddressbookList, NULL, NULL, CTX_STRBUF, CTX_NONE, IT_NOFLAG); }