+// update search set (possible change of threading mode)
+if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
+ && $_SESSION['search_request'] == $_REQUEST['_search']
+) {
+ $_SESSION['search'] = $IMAP->get_search_set();
+}
+// remove old search data
+else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) {
+ $RCMAIL->session->remove('search');
+}
+
+
+// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count()
+if (empty($search_request) && empty($a_headers)) {
+ $unseen = 0;
+}
+
+// update mailboxlist
+rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen);