show messages

def cmd_messages(args):
    '''show messages'''
    if len(args) > 0:
        wildcard = args[0]
        if wildcard.find('*') == -1 and wildcard.find('?') == -1:
            wildcard = "*" + wildcard + "*"
    else:
        wildcard = '*'
    mestate.mlog.rewind()
    types = set(['MSG','STATUSTEXT'])
    while True:
        m = mestate.mlog.recv_match(type=types, condition=mestate.settings.condition)
        if m is None:
            break
        if m.get_type() == 'MSG':
            mstr = m.Message
        else:
            mstr = m.text
        if fnmatch.fnmatch(mstr.upper(), wildcard.upper()):
            tstr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(m._timestamp))
            print("%s %s" % (tstr, mstr))
    mestate.mlog.rewind()