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 http://xmpp.org/internet-drafts/draft-ietf-xmpp-3921bis-04.html#presence-unavailable-gen 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 http://issues.apache.org/jira/browse/VYSPER 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, Bernd On Thu, Mar 4, 2010 at 14:12, Thomas Kratz <[email protected]> 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 >
