'Process a server ack by freeing acked stanzas from the queue.
Raises a :term:`stanza_acked` event for each acked stanza.'

def _handle_ack(self, ack):

    if (ack['h'] == self.last_ack):
        return
    with self.ack_lock:
        num_acked = ((ack['h'] - self.last_ack) % MAX_SEQ)
        num_unacked = len(self.unacked_queue)
        log.debug((('Ack:    %s,    Last    Ack:    %s,    ' + 'Unacked:    %s,    Num    Acked:    %s,    ') + 'Remaining:    %s'), ack['h'], self.last_ack, num_unacked, num_acked, (num_unacked - num_acked))
        for x in range(num_acked):
            (seq, stanza) = self.unacked_queue.popleft()
            self.xmpp.event('stanza_acked', stanza)
        self.last_ack = ack['h']
