   [v]
   (= (:qualifier v) "snapshot"))
 
+(defn- filter-versions
+  "Remove all versions that do not fit the given settings map."
+  [{:keys [allow-snapshots allow-qualified]} version-maps]
+  (let [v version-maps
+        v (if-not allow-snapshots (filter (complement snapshot?) v) v)
+        v (if-not allow-qualified (filter (comp nil? :qualifier) v) v)]
+    v))
+
 (defn latest-version
   "Get map of the latest available version in the given metadata XML
    string."
-  [mta]
-  (->> (version-seq mta)
-    (map version-map)
-    (filter (complement snapshot?))
-    (sort version-map-compare)
-    (last)))
+  ([mta] (latest-version mta nil))
+  ([mta settings]
+   (->> (version-seq mta)
+     (map version-map)
+     (filter-versions settings)
+     (sort version-map-compare)
+     (last))))
 
 ;; ## Project Map Inspection
 

(defn- check-packages
  "Check the packages found at the given key in the project map.
   Will check the given repository urls for metadata."
  [repos packages]
  (let [retrieve! (partial retrieve-metadata! repos)]
    (doseq [{:keys [group-id artifact-id version] :as dep} 
            (map dependency-map packages)]
      (when-let [mta (retrieve! group-id artifact-id)]
        (when-let [latest (latest-version mta)]
          (when (version-outdated? version latest)
            (println
              (str "[" (:dependency-str dep) " \"" (:version-str latest) "\"]")

      :author "Yannick Scherer"}
  leiningen.ancient
  (:require [leiningen.core.project :as project :only [defaults]]
            [clojure.data.xml :as xml :only [parse-str]]
            [clojure.tools.cli :as cli :only [cli]]))

;; ## Utility Functions

