From ebc48d7aa181b0357037449ebe3ec8a097d90f87 Mon Sep 17 00:00:00 2001
From: Johannes Schilling <dario@deaktualisierung.org>
Date: Wed, 3 May 2017 15:37:00 +0200
Subject: [PATCH] notify.py: attempt to wait through server welcome message

---
 notify.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/notify.py b/notify.py
index 6a0d9bb..381949f 100644
--- a/notify.py
+++ b/notify.py
@@ -62,6 +62,13 @@ class IINotification(BaseNotification):
         while not os.path.exists(cmd_in):
             time.sleep(0.01)
 
+        ## the server wants to send us stuff, and usually says "end of MOTD" at the end
+        cmd_out = os.path.join(self.dir, self.ircsrv, "out")
+        with open(cmd_out, "r") as f:
+            for line in f.readlines():
+                if line.find("MOTD") != -1:
+                    break
+
         with open(cmd_in, "a") as c:
             c.write("/j " + self.chan + "\n")
 
-- 
GitLab