sprsquish/blather — Issue #83: Unable to create a guard that tracks all presence changes
Author: bklang
Created: 2012-02-29 20:26:01+00:00
State: open

I am trying to write something to keep track of the state of contacts on my roster. I wanted to create a guard that would get me all status transitions so I could track who is online and who is offline. However I cannot find a guard that works for showing "available" status. The XMPP spec allows an essentially empty `` tag to imply a status of "available". But writing a guard for `` results in catching much more information.

Here's the code I am trying to use:

```
status { |s| logger.warn "JID #{s.from} is going #{s.state}" }
```

This works for all state changes *except* "available"

So then I tried looking adding a second guard to track `` packets and use those to assume "available" state. However, that led to packets like this:

```

away

064ab5aeb91c609c8a0bd5609a077f5bfa88e816

```

These are converted to `Blather::Stanza::C` objects which have no accessor for the show. This results in my code detecting this obviously "away" message as being an "available" message.