--- erc.el.~1.584.~	Mon Nov 10 08:00:21 2003
+++ erc.el	Tue Dec  2 11:33:26 2003
@@ -6614,11 +6615,28 @@
   (with-current-buffer buffer
     (setq mode-line-format
 	  (erc-prepare-mode-line-format erc-mode-line-format))
-    (when (boundp 'header-line-format)
-      (if erc-header-line-format
-	  (setq header-line-format
-		(erc-prepare-mode-line-format erc-header-line-format))
-	(setq header-line-format nil)))))
+    (run-hooks 'erc-update-mode-line-hooks)))
+
+(defun erc-update-header-line ()
+  "Update the header line of the current buffer."
+  (if erc-header-line-format
+      (let* ((topic-text
+	      (mapconcat 'identity
+			 (erc-prepare-mode-line-format
+			  erc-tab-topic-format) ""))
+	     (help-text
+	      (with-temp-buffer
+		(insert topic-text)
+		(fill-region (point-min) (point-max))
+		(buffer-string))))
+	(setq header-line-format
+	      (propertize topic-text
+			  'help-echo help-text
+			  'face 'erc-tab-topic-face)))
+    (setq header-line-format nil)))
+
+(when (boundp 'header-line-format)
+  (add-hook 'erc-update-mode-line-hooks 'erc-update-header-line))
 
 (defun erc-update-mode-line (&optional buffer)
   "Update the mode line in one buffer BUFFER, if it is supplied, or
