+
+;;; User-defined responses
+;;
+
+(defun murk--lists-equal (l1 l2)
+ (if (and l1 l2)
+ (if (or (not (and (car l1) (car l2)))
+ (string-match (car l1) (car l2)))
+ (murk--lists-equal (cdr l1) (cdr l2))
+ nil)
+ t))
+
+(defun murk-process-autoreply (network msg autoreply)
+ (let ((matcher (car autoreply))
+ (reply (cadr autoreply)))
+ (let ((target-network (car matcher)))
+ (when (and (or (not target-network)
+ (and (equal network target-network)))
+ (murk--lists-equal (cdr matcher)
+ (append (list (murk-msg-src msg)
+ (murk-msg-cmd msg))
+ (murk-msg-params msg))))
+ (murk-send-msg network
+ (murk-msg nil nil (car reply) (cdr reply)))))))
+
+(defun murk-process-autoreplies (network msg)
+ (mapc
+ (lambda (autoreply)
+ (murk-process-autoreply network msg autoreply))
+ murk-autoreply-table))
+
+