So I get an instance of AbstractComponent (
http://www.igniterealtime.org/builds/tinder/docs/latest/javadoc/org/xmpp/component/AbstractComponent.html)
with the function below, overriding the necessary methods:

(defn get-component
  "returns a new component instance with the specified values
    name:  the name of the component, e.g. the subdomain name
    domain:  the domain of the xmpp server
    description:  a description of the component
    message-handler:  a handler function for incoming messages
                       (takes one param - the message instance)"
  [name domain description message-handler]
  (proxy [AbstractComponent] []
    (handleMessage [message] (message-handler message))
    (getName [] (str name))
    (getDomain [] (str domain))
    (getDescription [] (str description))))

Now, say I later want to override additional methods on that instance, as
in:

(let [comp (get-component "foo" "domain.com" "foo comp" message-handler)]
  (-> comp (add-presence-handler presence-handler) (add-iq-handler
iq-handler)))

First, is this possible?  And if so, what does add-presence-handler look
like?

(defn add-presence-handler
  "add the specified function as the presence packet handler for the
specified component"
  [component presence-handler]
  (doto component something))

Or would gen-class work here?

Thanks.

 - Mark

-- 
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

Reply via email to