'(("debug" "localhost" 6697)
("libera" "irc.libera.chat" 6697)
("tilde" "tilde.chat" 6697)
- ("freenode" "chat.freenode.net" 6697))
+ ("freenode" "chat.freenode.net" 6697)
+ ("mbr" "mbrserver.com" 6667 :notls))
"IRC networks."
:type '(alist :key-type string))
(equal (seq-take c1 2)
(seq-take c2 2)))))
-(defun murk-context-server (ctx) (elt ctx 0))
-(defun murk-context-channel (ctx) (elt ctx 1))
-(defun murk-context-users (ctx) (elt ctx 2))
+(defun murk-context-server (ctx)
+ (elt ctx 0))
+
+(defun murk-context-channel (ctx)
+ (elt ctx 1))
+
+(defun murk-context-users (ctx)
+ (elt ctx 2))
+
(defun murk-set-context-users (ctx users)
(setcar (cddr ctx) users))
-(defun murk-server-context-p (ctx) (not (cdr ctx)))
+
+(defun murk-server-context-p (ctx)
+ (not (cdr ctx)))
(defun murk-add-context (ctx)
(add-to-list 'murk-contexts ctx))
(concat (murk-context-channel ctx) "@"
(murk-context-server ctx))))
-(defun murk-get-context (server &optional name)
- (if name
- (let ((test-ctx (list server name)))
+(defun murk-string->context (string)
+ (if (not (string-prefix-p "#" string))
+ (murk-get-context string)
+ (let* ((parts (string-split string "@"))
+ (channel (elt parts 0))
+ (server (elt parts 1)))
+ (murk-get-context server channel))))
+
+(defun murk-get-context (server &optional channel)
+ (if channel
+ (let ((test-ctx (list server channel)))
(seq-find (lambda (ctx)
(equal (seq-take ctx 2) test-ctx))
murk-contexts))
(seq-take murk-contexts nminus1)))
(append (cdr murk-contexts) (list (car murk-contexts))))))
+(defun murk-switch-to-context (ctx)
+ (setq murk-contexts
+ (let* ((new-head (memq ctx murk-contexts))
+ (new-tail (take (- (length murk-contexts)
+ (length new-head)))))
+ (append new-head new-tail))))
+
(defun murk-add-context-users (ctx users)
(murk-set-context-users
ctx