mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bernd.fonderm...@googlemail.com>
Subject Re: [vysper] sending unavailable on lost connection
Date Thu, 04 Mar 2010 13:40:51 GMT
Hi Thomas,

I think you are on the right track with creating a presence
unavailable and injecting this into stanza processing the way you do.
(But I did not look into details.)
Thanks very much, looks very promising. :-)

I'd expect that building the stanza can be drastically simplified
using the given builder infrastructure.
Basically, you only need to create the stanza
   <presence type='unavailable'/>
according to
You could use something along the lines of
StanzaBuilder.createPresenceStanza(null, null... UNAVAILABLE);

For incorporating your contribution, I have to ask you to create a
JIRA issue for this here
Please attach a patch file (pls ask if you run into problems with
that) to the JIRA after creating it
*and don't forget to tick the ASL license box so we can legally use the patch*.

Thanks again,


On Thu, Mar 4, 2010 at 14:12, Thomas Kratz <eiswind@googlemail.com> wrote:
> As promised I started to do some investigations on this.
> I don't know if I get things right by today, and I don't have a
> running envoriment at hand ( will have to wait for the weekend= but I
> kindly ask if I'm going in the right direction.
> I guess I try the following in AbstactSessionContext
> public void endSession() {
>        StanzaWriter stanzaWriter = getResponseWriter();
>        stanzaWriter.close();
>        sessionStateHolder.setState(SessionState.CLOSED); // no more
> traffic going through
>        getServerRuntimeContext().getResourceRegistry().unbindSession(this);
>        // send unavailable to all contacts and other resources
>       PresenceStanza lastPresence =
> serverRuntimeContext.getPresenceCache().get(initiatingEntity);
>        List<Attribute> presenceReplacements = new ArrayList<Attribute>(1);
>        presenceReplacements.add(new Attribute("type",
> PresenceStanzaType.UNAVAILABLE.name()));
>        Stanza unavailableStanza =
> StanzaBuilder.createClone(lastPresence, true,
> presenceReplacements).build();
>        serverRuntimeContext.getStanzaProcessor().processStanza(serverRuntimeContext,
> this, unavailableStanza, sessionStateHolder);
>        // remove latest availability from LatestPresenceCache
>        serverRuntimeContext.getPresenceCache().remove(initiatingEntity);
>        // TODO close underlying transport (TCP socket)
>        // ?? how to get hold of the socket ?
> }
> Are these the right ideas to do that ?
> Regards Thomas
> --
> http://www.buchmanager.com
> http://thomaskratz.blogspot.com

View raw message