When populating the address book popup with the contents of
authorArt Cancro <ajc@citadel.org>
Sat, 10 Nov 2007 05:32:30 +0000 (05:32 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 10 Nov 2007 05:32:30 +0000 (05:32 +0000)
an address book room (such as the Global Address Book), save the name of the room
we came from and go back there after fetching the address book.  Fixes bug #227.

webcit/addressbook_popup.c

index 2b3cd7f385ac42fde1f80766b046b9a8e26371a8..91641482c36ef1af9c41e592e1cded1ad603a8e3 100644 (file)
@@ -87,6 +87,7 @@ void display_address_book_inner_div() {
        char target_id[64];
        char target_label[64];
        int i;
+       char saved_roomname[128];
 
        begin_ajax_response();
 
@@ -107,8 +108,8 @@ void display_address_book_inner_div() {
        }
 
        else {
-               serv_printf("GOTO %s", bstr("which_addr_book"));
-               serv_getln(buf, sizeof buf);
+               safestrncpy(saved_roomname, WC->wc_roomname, sizeof saved_roomname);
+               gotoroom(bstr("which_addr_book"));
                serv_puts("DVCA");
                serv_getln(buf, sizeof buf);
                if (buf[0] == '1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
@@ -118,6 +119,7 @@ void display_address_book_inner_div() {
                        escputs(buf);
                        wprintf("</option>\n");
                }
+               gotoroom(bstr(saved_roomname));
        }
 
        wprintf("</select>\n");