Now when a room is created or deleted this users icon bar is updated
authorDave West <davew@uncensored.citadel.org>
Sun, 20 Jan 2008 13:52:06 +0000 (13:52 +0000)
committerDave West <davew@uncensored.citadel.org>
Sun, 20 Jan 2008 13:52:06 +0000 (13:52 +0000)
immediately.
Other users will have to wait until their iconbar is refreshed (up to
300 seconds) but since they have no knowledge of when the room was
created/deleted they'll never notice.

webcit/roomops.c
webcit/webcit.h

index 4d1772f620068b208518e9a4ac3a65a86b6d63c9..ee44b7622ba98bdc6e429df507e6cd3f94150e3b 100644 (file)
@@ -2573,6 +2573,10 @@ void entroom(void)
                display_main_menu();
                return;
        }
+       /** TODO: Room created, now udate the left hand icon bar for this user */
+       burn_folder_cache(0);   /* burn the old folder cache */
+       
+       
        gotoroom(er_name);
        do_change_view(er_view);                /* Now go there */
 }
@@ -2729,8 +2733,10 @@ void delete_room(void)
 {
        char buf[SIZ];
 
+       
        serv_puts("KILL 1");
        serv_getln(buf, sizeof buf);
+       burn_folder_cache(0);   /* Burn the cahce of known rooms to update the icon bar */
        if (buf[0] != '2') {
                strcpy(WC->ImportantMessage, &buf[4]);
                display_main_menu();
@@ -3284,6 +3290,25 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
 
 
 
+/**
+ * \brief Burn the cached folder list.  
+ * \param age How old the cahce needs to be before we burn it.
+ */
+
+void burn_folder_cache(time_t age)
+{
+       /** If our cached folder list is very old, burn it. */
+       if (WC->cache_fold != NULL) {
+               if ((time(NULL) - WC->cache_timestamp) > age) {
+                       free(WC->cache_fold);
+                       WC->cache_fold = NULL;
+               }
+       }
+}
+
+
+
+
 /**
  * \brief Show the room list.  
  * (only should get called by
@@ -3308,13 +3333,8 @@ void list_all_rooms_by_floor(char *viewpref) {
        char buf3[SIZ];
        
        /** If our cached folder list is very old, burn it. */
-       if (WC->cache_fold != NULL) {
-               if ((time(NULL) - WC->cache_timestamp) > 300) {
-                       free(WC->cache_fold);
-                       WC->cache_fold = NULL;
-               }
-       }
-
+       burn_folder_cache(300);
+       
        /** Can we do the iconbar roomlist from cache? */
        if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
                do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
index 418c541fd3111e85813a55cbdc34e392e4555234..d99b17e27511f94a22475d4dce44ff41f050e9a9 100644 (file)
@@ -676,6 +676,7 @@ void begin_ajax_response(void);
 void end_ajax_response(void);
 void initialize_viewdefs(void);
 void initialize_axdefs(void);
+void burn_folder_cache(time_t age);
 void list_all_rooms_by_floor(char *viewpref);
 void display_room_directory(void);
 void download_file(char *);