'Clear the messages buffer'

def clear(self):

    if (self.handler is not None):
        on = True
        self.stop()
    else:
        on = False
    strbuf = self.strbuf
    if (strbuf is not None):
        strbuf.close()
        self.strbuf = None
    if on:
        self.listen()
