Debug
[svn42.git] / update-xmpp-status.py
index 04bd22c..7671300 100755 (executable)
@@ -31,9 +31,9 @@ class UWSConfig:
     self.config_parser.add_section('xmpp')
     self.config_parser.set('xmpp','recipients_debug','xro@jabber.tittelbach.at')
     self.config_parser.set('xmpp','recipients_normal','xro@jabber.tittelbach.at otti@wirdorange.org')
-    self.config_parser.set('xmpp','recipients_nooffline','the-equinox@jabber.org')
+    self.config_parser.set('xmpp','recipients_nooffline','the-equinox@jabber.org davrieb@jabber.ccc.de')
     self.config_parser.add_section('msg')
-    self.config_parser.set('msg','bored',"Somebody is bored and in need of company. Go Visit !")
+    self.config_parser.set('msg','bored',"The Button has been pressed ! Maybe somebody want's company. Go Visit !")
     self.config_parser.set('msg','format',"${status_msg}${request_msg}${comment_msg}")
     self.config_parser.set('msg','status_opened_msg',"RealRaum door now open")
     self.config_parser.set('msg','status_closed_msg',"RealRaum door now closed")
@@ -269,7 +269,7 @@ distributeXmppMsg("update-xmpp-status.py started", debug=True)
 RE_STATUS = re.compile(r'Status: (\w+), idle')
 RE_REQUEST = re.compile(r'Request: (\w+) (?:Card )?(.+)')
 RE_PRESENCE = re.compile(r'Presence: (yes|no)')
-RE_BUTTON = re.compile(r'button\d?')
+RE_BUTTON = re.compile(r'PanicButton|button\d?')
 RE_ERROR = re.compile(r'Error: (.+)')
 while True:
   try:
@@ -283,6 +283,7 @@ while True:
     #sockhandle.send("listen\n")
     #sockhandle.send("status\n")
     last_request = (None, None)
+    not_initial_presence = False
     while True:
       line = conn.readline()
       logging.debug("Got Line: " + line)
@@ -298,7 +299,11 @@ while True:
         continue      
       m = RE_PRESENCE.match(line)
       if not m is None:
-        formatAndDistributePresence(m.group(1))
+        if not_initial_presence:
+          formatAndDistributePresence(m.group(1))
+        else:
+          not_initial_presence=True
+          distributeXmppMsg("Initial Presence received: %s" % m.group(1) ,debug=True)
         continue
       m = RE_STATUS.match(line)
       if not m is None: