- m = Query(db,querystr).search_messages()
- for msg in m:
- print(msg.format_as_text())
+ t = Query(db,querystr).search_threads()
+
+ first_toplevel=True
+ if out_format.lower()=="json":
+ sys.stdout.write("[")
+
+ for thrd in t:
+ msgs = thrd.get_toplevel_messages()
+
+ if not first_toplevel:
+ if format.lower()=="json":
+ sys.stdout.write(", ")
+
+ first_toplevel = False
+
+ msgs.show_messages(out_format, 0, True)
+
+ if out_format.lower() == "json":
+ sys.stdout.write("]")
+ sys.stdout.write("\n")