From 2402ca25a34852367cd92b329c8fc2935e5d58b5 Mon Sep 17 00:00:00 2001 From: plugd Date: Sun, 26 May 2024 12:25:28 +0200 Subject: [PATCH] Added channel autojoin. --- murk.el | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/murk.el b/murk.el index 708ed2c..4e35c1a 100644 --- a/murk.el +++ b/murk.el @@ -621,12 +621,13 @@ The head of this list is always the current context.") (apply #'concat messages))) (defun murk-highlight-current-context () - (maphash - (lambda (this-context facelist) - (if (equal (take 2 this-context) (take 2 (murk-current-context))) - (setcar facelist 'murk-text) - (setcar facelist 'murk-faded))) - murk-context-facelists) + (with-current-buffer "*murk*" + (maphash + (lambda (this-context facelist) + (if (equal (take 2 this-context) (take 2 (murk-current-context))) + (setcar facelist 'murk-text) + (setcar facelist 'murk-faded))) + murk-context-facelists)) (force-window-update "*murk*")) (defun murk-zoom-in (context) @@ -758,7 +759,13 @@ The head of this list is always the current context.") (nick (elt params 0)) (text (string-join (seq-drop params 1) " "))) (murk-set-connection-nick network nick) - (murk-display-notice (murk-get-context network) text))) + (murk-display-notice (murk-get-context network) text)) + (let* ((row (assoc network murk-networks)) + (channels (if (memq :channels row) + (cdr (memq :channels row)) + nil))) + (dolist (channel channels) + (murk-command-join (list channel))))) ("353" ; NAMEREPLY (let* ((params (murk-msg-params msg)) @@ -767,7 +774,7 @@ The head of this list is always the current context.") (ctx (murk-get-context network channel))) (if ctx (murk-add-context-users ctx names) - (murk-display-notice nil "Users in " channel + (murk-display-notice ctx "Users in " channel ": " (string-join names " "))))) ("366" ; ENDOFNAMES @@ -779,7 +786,8 @@ The head of this list is always the current context.") ctx (murk--as-string (length (murk-context-users ctx))) " users in " channel) - (murk-display-notice nil "End of " channel " names list.")))) + (murk-display-notice (murk-get-context network) + "End of " channel " names list.")))) ("331" ; RPL_NOTOPIC (let* ((params (murk-msg-params msg)) @@ -848,7 +856,8 @@ The head of this list is always the current context.") ("NICK" (let ((old-nick (murk-msg-src msg)) (new-nick (car (murk-msg-params msg)))) - (murk-display-notice nil old-nick " is now known as " new-nick + (murk-display-notice (murk-get-context network) + old-nick " is now known as " new-nick " on " network) (murk-rename-network-user network old-nick new-nick))) @@ -1108,7 +1117,9 @@ The head of this list is always the current context.") (let ((ctx (murk-current-context))) (if ctx (if (not params) - (murk-display-notice nil "This command can generate lots of output. Use `/LIST -yes' if you really want this, or `/LIST ' to reduce the output.") + (murk-display-notice nil "This command can generate lots of output." + " Use `/LIST -yes' if you really want this," + " or `/LIST ' to reduce the output.") (let ((network (murk-context-network ctx))) (if (equal (upcase (car params)) "-YES") (murk-send-msg network (murk-msg nil nil "LIST")) -- 2.20.1