- config (cons (cons type
- (if (memq type
- '(pubkey cipher digest compress))
- (mapcar #'string-to-number
- (delete "" (split-string
- (match-string 2)
- ";")))
- (match-string 2)))
- config))))
- config))
+ args (match-string 2))
+ (cond
+ ((eq type 'group)
+ (if (string-match "\\`\\([^:]+\\):" args)
+ (setq groups
+ (cons (cons (downcase (match-string 1 args))
+ (delete "" (split-string
+ (substring args
+ (match-end 0))
+ ";")))
+ groups))
+ (if epg-debug
+ (message "Invalid group configuration: %S" args))))
+ ((memq type '(pubkey cipher digest compress))
+ (if (string-match "\\`\\([0-9]+\\)\\(;[0-9]+\\)*" args)
+ (setq config
+ (cons (cons type
+ (mapcar #'string-to-number
+ (delete "" (split-string args ";"))))
+ config))
+ (if epg-debug
+ (message "Invalid %S algorithm configuration: %S"
+ type args))))
+ (t
+ (setq config (cons (cons type args) config))))))
+ (if groups
+ (cons (cons 'groups groups) config)
+ config)))
+
+(defun epg-config--parse-version (string)
+ (let ((index 0)
+ version)
+ (while (eq index (string-match "\\([0-9]+\\)\\.?" string index))
+ (setq version (cons (string-to-number (match-string 1 string))
+ version)
+ index (match-end 0)))
+ (nreverse version)))
+
+(defun epg-config--compare-version (v1 v2)
+ (while (and v1 v2 (= (car v1) (car v2)))
+ (setq v1 (cdr v1) v2 (cdr v2)))
+ (- (or (car v1) 0) (or (car v2) 0)))