Bugfixes, and allowed suppression of join messages.
[lurk.git] / lurk.el
diff --git a/lurk.el b/lurk.el
index c5ba515..28fe5c6 100644 (file)
--- a/lurk.el
+++ b/lurk.el
@@ -55,6 +55,9 @@
 (defcustom lurk-allow-ipv6 nil
   "Set to non-nil to allow use of IPv6.")
 
+(defcustom lurk-show-joins nil
+  "Set to non-nil to be notified of joins, parts and quits.")
+
 ;;; Faces
 ;;
 
 (defvar lurk-error-prefix
   (propertize "!!!" 'face 'lurk-error))
 
-
 (defvar lurk-prompt-string
   (propertize "> " 'face 'lurk-prompt))
 
@@ -284,6 +286,11 @@ portion of the source component of the message, as LURK doesn't use this.")
   (dolist (context (lurk-get-context-list))
     (lurk-del-context-user context user)))
 
+(defun lurk-rename-user (old-nick new-nick)
+  (dolist (context (lurk-get-context-list))
+    (lurk-del-context-user context old-nick)
+    (lurk-add-context-users context (list new-nick))))
+
 (defun lurk-get-context-type (name)
   (cond
    ((string-prefix-p "#" name) 'channel)
@@ -333,14 +340,15 @@ portion of the source component of the message, as LURK doesn't use this.")
       (goto-char lurk-prompt-marker)
       (let ((inhibit-read-only t)
             (old-pos (marker-position lurk-prompt-marker))
-            (adaptive-fill-regexp (rx (= 6 anychar))))
+            (adaptive-fill-regexp (rx (= 6 anychar)))
+            (fill-column 80))
         (insert-before-markers
          (propertize (concat (format-time-string "%H:%M") " ")
                      'face 'lurk-text
                      'read-only t)
          (propertize (concat (apply #'concat strings) "\n")
                      'read-only t))
-        (fill-region old-pos lurk-prompt-marker)))))
+        (fill-region old-pos lurk-prompt-marker nil t)))))
 
 (defun lurk-render-prompt ()
   (with-current-buffer "*lurk*"
@@ -447,6 +455,7 @@ portion of the source component of the message, as LURK doesn't use this.")
 (defun lurk-eval-msg-string (string)
   ;; (lurk-display-string string)
   (let* ((msg (lurk-string->msg string)))
+    ;; (message (pp msg))
     (pcase (lurk-msg-cmd msg)
       ("PING"
        (lurk-send-msg
@@ -523,8 +532,8 @@ portion of the source component of the message, as LURK doesn't use this.")
       ("NICK"
        (let ((old-nick (lurk-msg-src msg))
              (new-nick (car (lurk-msg-params msg))))
-         (lurk-display-notice nil nick " is now known as " new-nick)
-         (lurk-rename-user nick new-nick)))
+         (lurk-display-notice nil old-nick " is now known as " new-nick)
+         (lurk-rename-user old-nick new-nick)))
 
       ("NOTICE"
        (let ((nick (lurk-msg-src msg))