+(defun lurk-command-clear (params)
+ (if (not params)
+ (lurk-clear-buffer)
+ (dolist (context params)
+ (lurk-clear-context context))))
+
+;;; Command entering
+;;
+
+(defun lurk-enter-string (string)
+ (if (string-prefix-p "/" string)
+ (pcase string
+ ((rx (: "/" (let cmd-str (+ (not whitespace)))
+ (opt (+ whitespace)
+ (let params-str (+ anychar))
+ string-end)))
+ (let ((command-row (assoc (upcase cmd-str) lurk-command-table #'equal))
+ (params (if params-str
+ (split-string params-str nil t)
+ nil)))
+ (if (and command-row (elt command-row 2))
+ (funcall (elt command-row 2) params)
+ (lurk-send-msg (lurk-msg nil nil (upcase cmd-str) params)))))
+ (_
+ (lurk-display-error "Badly formed command.")))
+ (unless (string-empty-p string)
+ (if lurk-current-context
+ (progn
+ (lurk-send-msg (lurk-msg nil nil "PRIVMSG"
+ lurk-current-context
+ string))
+ (lurk-display-message lurk-nick lurk-current-context string))
+ (lurk-display-error "No current context.")))))
+