msg = msg_open(mbase["path"] + mbase["filename"])
if msg is None:
writeln('|CRno msgs.|PA')
return
msg_seek(msg, 0)
while msg_found(msg) and not shutdown():
msgbodies.append(msg_gettxt(msg))
items.append(msg_gethdr(msg))
msg_next(msg)
msg_close(msg)
msg_seek(msg, 0)
while msg_found(msg) and not shutdown():
msgbodies.append(msg_gettxt(msg))
items.append(msg_gethdr(msg))
msg_next(msg)
msg_close(msg)
msg_gethdr returns a dictionary and msg_gettxt returns a list. The contents of msgbodies and items are being created and populated byb data you are giving it. Mystic isn't populating them.
Are you initializing the msgbodies and items lists anywhere? IE: msgbodies = []
items = []
while msg_found(msg) and not shutdown():
msgbodies.append(msg_gettxt(msg))
items.append(msg_gethdr(msg))
msg_next(msg)
msg_close(msg)
I found the "bug" :) In my code i read first the msg text and after the header. It should be the other way around... that's why i was missing
the text body of the first message. I realized it when i looked into the msgread.mpy example and noticed that first you read the header and after the body text.
Awesome find!
I was really struggling to figure out why it was messing up for you but that absolutely explains it. The way it is set up you do have to get
the header before the text!
I thought that because you call the function like msg_gettxt(msg) it
gets the data using the msg object and didn't require to read the header first.
I feel like an idiot :) I was frustrated for many hours, many times
trying to find what the hell i was doing wrong and it was in front of me all the time :)
Sysop: | Eric Oulashin |
---|---|
Location: | Beaverton, Oregon, USA |
Users: | 97 |
Nodes: | 16 (0 / 16) |
Uptime: | 01:53:44 |
Calls: | 4,614 |
Calls today: | 8 |
Files: | 8,491 |
Messages: | 349,822 |
Posted today: | 4 |