'Send the new presence states to the appropriate destinations.
This actually queues up the presence states ready for sending and
triggers a background task to process them and send out the transactions.
Args:
states (list(UserPresenceState))'

@preserve_fn
@defer.inlineCallbacks
def send_presence(self, states):

    self.pending_presence.update({state.user_id: state for state in states if self.is_mine_id(state.user_id)})
    if self._processing_pending_presence:
        return
    self._processing_pending_presence = True
    try:
        while True:
            states_map = self.pending_presence
            self.pending_presence = {}
            if (not states_map):
                break
            (yield self._process_presence_inner(states_map.values()))
    finally:
        self._processing_pending_presence = False
