   [opts events]
   (let [formatter (or (:formatter opts) event->status)]
     (doseq [combo-message (events->combo formatter events)]
-      (send-line opts combo-message))))
+      (send-message opts combo-message))))
 
 (defn xymon-batch
   "

    (fn [{:keys [state service] :as event}]
      (when (and state service)
        (let [statusmessage (formatter event)]
          (send-line opts statusmessage))))))

(def xymon-max-line 4096)

(def- combo-header "combo\n")
(def- combo-header-len (count combo-header))

        (.setSoTimeout sock (:timeout opts))
        (.connect sock addr (:timeout opts))
        (with-open [writer (io/writer sock)]
          (.write writer message)
          (.flush writer)))
      (catch Exception e
        ((:error-handler opts) opts e)))))

(defn send-message
  "
  Sends given message to Xymon host(s).

  If (:hosts opts) is a sequence _and_ (:host opts) is false, sends
  the message to all hosts described in (:hosts opts). When
  provided (:host opts) should be a list of map and
  send-single-message will invoked with (merge opts <item in :hosts>).

  If (:host opts) is not false, sends the message to opts.
  "
  [opts message]
  (if (and (seq (:hosts opts))
           (not (:host opts)))
    (let [hosts (:hosts opts)
          opts (discard opts :hosts)]
      (map (fn [host] (send-message (merge opts host) message)) hosts))
    (send-single-message opts message)))

(defn xymon
  "
