       (prn "Add user as collaborator"))))
 
 (defn on
+  "Enables the webhook for the specified repository."
   [cookies user reponame]
   (let [token   (token cookies)
         repo    (repos/specific-repo user reponame {:oauth-token token})]

      (map (partial add-status token)))))

(defn repos
  [cookies]
  (if-let [token (token cookies)]
    {:status 200

   :headers {"location" url}}))

(defn callback
  "Handles the callback from GitHub OAuth flow."
  [code]
  (let [params {:form-params {:client_id client-id
                              :client_secret client-secret
                              :code code}}
        {:keys [body]} (client/post access-token-url params)
        token  ((qs-map body) "access_token")]
    {:status 302
     :headers {"location" "/repos"
               "set-cookie" (str "token=" token ";Path=/")}}))

(defn- owner?
  "Returns true if the user has admin permissions over the 
repo and false otherwise."
  [repo]
  (get-in repo [:permissions :admin]))

(defn- get-webhook
  "Given a repository checks if it has a specific webhook
enables. Returns the webhook if present or nil otherwise."
  [token user reponame]
  (let [hooks        (repos/hooks user reponame {:oauth-token token})
        gbu-webhook? #(= (:url webhook-config)
