+ (let ((ctx (cond
+ ((not params) (murk-current-context))
+ ((seq-contains (car params) "@") (murk-string->context (car params)))
+ (t (list (murk-context-network (murk-current-context)) (car params))))))
+ (let ((network (murk-context-network ctx))
+ (channel (murk-context-channel ctx)))
+ (if channel
+ (murk-send-msg network (murk-msg nil nil "PART" channel))
+ (murk-display-error "Specify which channel to leave")))))
+
+(defun murk-command-switch-context (params)
+ (if (not params)
+ (murk-display-notice nil "Usage: /switchcontext #channel@network")
+ (let ((ctx (murk-string->context (car params))))
+ (murk-switch-to-context ctx)
+ (murk-highlight-current-context)
+ (murk-render-prompt)
+ (if murk-zoomed
+ (murk-zoom-in (murk-current-context))))))
+
+(defun murk-command-nick (params)
+ (if params
+ (let ((new-nick (string-join params " "))
+ (ctx (murk-current-context)))
+ (if ctx
+ (murk-send-msg (murk-context-network ctx)
+ (murk-msg nil nil "NICK" new-nick))
+ (murk-display-error "No current connection")))
+ (murk-display-notice nil "Usage: /nick <new-nick>")))
+
+(defun murk-command-list (params)
+ (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 <channel_regexp>' 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"))
+ (murk-send-msg network (murk-msg nil nil "LIST"
+ (car params))))))
+ (murk-display-error "No current connection"))))
+
+(defun murk-command-topic (params)
+ (let ((ctx (murk-current-context)))
+ (if (and ctx (not (murk-network-context-p ctx)))
+ (let ((network (murk-context-network ctx))
+ (channel (murk-context-channel ctx)))
+ (if params
+ (murk-send-msg network
+ (murk-msg nil nil "TOPIC" channel
+ (string-join params " ")))
+ (murk-send-msg network
+ (murk-msg nil nil "TOPIC" channel))))
+ (murk-display-notice nil "No current channel."))))