'Process incoming presence stanzas.
Update the roster with presence information.'

def _handle_presence(self, presence):

    if ((not self.is_component) and (not presence[u'to'].bare)):
        presence[u'to'] = self.boundjid
    self.event(u'presence', presence)
    self.event((u'presence_%s' % presence[u'type']), presence)
    if (presence[u'type'] in (u'subscribe', u'subscribed', u'unsubscribe', u'unsubscribed')):
        self.event(u'changed_subscription', presence)
        return
    elif ((not (presence[u'type'] in (u'available', u'unavailable'))) and (not (presence[u'type'] in presence.showtypes))):
        return
