'Handles streams state change. Used internally.'

def IqHandler(self, conn, stanza):

    typ = stanza.getType()
    self.DEBUG(('IqHandler    called    typ->%s' % typ), 'info')
    if ((typ == 'set') and stanza.getTag('open', namespace=NS_IBB)):
        self.StreamOpenHandler(conn, stanza)
    elif ((typ == 'set') and stanza.getTag('close', namespace=NS_IBB)):
        self.StreamCloseHandler(conn, stanza)
    elif (typ == 'result'):
        self.StreamCommitHandler(conn, stanza)
    elif (typ == 'error'):
        self.StreamOpenReplyHandler(conn, stanza)
    else:
        conn.send(Error(stanza, ERR_BAD_REQUEST))
    raise NodeProcessed
