+FRAG_LEN = 1024
+
+def send_line(line):
+ for i in range(0, 10):
+ fifo = -1
+ try:
+ fifo = posix.open(fifo_path, posix.O_WRONLY | posix.O_NONBLOCK)
+ posix.write(fifo, line)
+ return
+ except OSError as e:
+ if e.errno == errno.ENXIO:
+ time.sleep(1.0)
+ finally:
+ if fifo != -1:
+ posix.close(fifo)
+ raise Exception("Error sending line!")
+
+parser = argparse.ArgumentParser(description='Post message using Matrix Bot.')
+parser.add_argument('channel', type=str, help='channel to be used for posting')
+parser.add_argument('--html', action='store_true', dest='is_html',
+ default=False, help='post html message')
+parser.add_argument('--markdown', action='store_true', dest='is_markdown',
+ default=False, help='post markdown message')
+
+args = parser.parse_args()