X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=lurk.el;h=bae68ceff07254c34003990fae00adff7cc8db08;hb=1ad31877ce86f4e5f9336360e875e33d208a801f;hp=e9c089f2e75a653af33e1bb7788bb0f84a1e4771;hpb=86d384f8728592aaacdccc7688fc1ae7314ccaa6;p=lurk.git diff --git a/lurk.el b/lurk.el index e9c089f..bae68ce 100644 --- a/lurk.el +++ b/lurk.el @@ -826,6 +826,7 @@ in which case they match anything.") '(("DEBUG" "Toggle debug mode on/off." lurk-command-debug lurk-boolean-completions) ("HEADER" "Toggle display of header." lurk-command-header lurk-boolean-completions) ("CONNECT" "Connect to an IRC network." lurk-command-connect lurk-network-completions) + ("NETWORKS" "List known IRC networks." lurk-command-networks) ("TOPIC" "Set topic for current channel." lurk-command-topic) ("ME" "Display action." lurk-command-me) ("VERSION" "Request version of another user's client via CTCP." lurk-command-version) @@ -893,6 +894,15 @@ in which case they match anything.") (lurk-connect network)) (lurk-display-notice nil "Usage: /connect "))) +(defun lurk-command-networks (params) + (lurk-display-notice nil "Currently-known networks:") + (dolist (row lurk-networks) + (seq-let (network server port &rest others) row + (lurk-display-notice nil "\t" network + " [" server + " " (number-to-string port) "]"))) + (lurk-display-notice nil "(Modify the `lurk-networks' variable to add more.)")) + (defun lurk-command-quit (params) (let ((quit-msg (if params (string-join params " ") nil))) (lurk-send-msg (lurk-msg nil nil "QUIT" quit-msg)))) @@ -1075,7 +1085,6 @@ in which case they match anything.") (lurk-enter-string line)))) - ;;; Mode ;; @@ -1102,14 +1111,17 @@ in which case they match anything.") ;;; Main start procedure ;; -(defun lurk () - "Switch to *lurk* buffer." +(defun lurk (&optional network) + "Start lurk or just switch to the lurk buffer if one already exists. +Also connect to NETWORK if non-nil." (interactive) (if (get-buffer "*lurk*") (switch-to-buffer "*lurk*") (switch-to-buffer "*lurk*") (lurk-mode) - (lurk-setup-buffer)) + (lurk-setup-buffer) + (if network + (lurk-command-connect (list network)))) "Started LURK.")