Here's my attempt. I don't think you can do much about the imperative style when you are calling Java APIs unless someone was nice and wrote a clojure wrapper. But I'm just a n00b.
--- (ns example.servlet.xmpp (:use [clojure.contrib.logging]) (:import [xmpp.package.here XMPPServiceFactory MessageBuilder] [xmpp.package.here SendResponse SendResponse$Status]) (:gen-class :extends javax.servlet.http.HttpServlet)) (defn create-message [recipient body] (let [builder (doto (MessageBuilder.) (.withRecipientJids recipient) (.witBody body))] (.build builder))) (defn send-message! [xmpp recipient body] (let [status (.sendMessage xmpp (create-message recipient body)) result (.. status getStatusMap (get from))] (= SendResponse$Status/SUCCESS result))) (defn -doPost [req res] (try (let [xmpp (XMPPServiceFactory/getXMPPService) msg (.parseMessage xmpp req) from (.getFromJid msg) body (.getBody msg)] (info (str "Received a message from " from " and body " body)) (if (send-message! xmpp from (str "You sent me: " body)) (info "Message has been sent successfully.") (info "Message could not be sent."))) (catch Exception e (fatal "Error sending message:" e)))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en