Commits

Marcin Kasperski  committed 061826d

Also notified-by parsing

  • Participants
  • Parent commits 95cd0c4

Comments (0)

Files changed (2)

File src/mekk/fics/parsing/info_parser.py

      """, re.VERBOSE),
      lambda m: PlayerName(m.group('who'))),
 
-
     ("watched_user_connected",
      re.compile(r"""
      ^
      """, re.VERBOSE),
      lambda m: PlayerName(m.group('who'))),
 
+    ("watching_user_connected",
+     re.compile(r"""
+     ^
+     Notification:
+     \s+
+     (?P<who>\S+)
+     \shas\s
+     arrived
+     \sand\sisn't\son\syour\snotify\slist
+     \.
+     $
+     """, re.VERBOSE),
+     lambda m: PlayerName(m.group('who'))),
+
+    ("watching_user_disconnected",
+     re.compile(r"""
+     ^
+     Notification:
+     \s+
+     (?P<who>\S+)
+     \shas\s
+     departed
+     \sand\sisn't\son\syour\snotify\slist
+     \.
+     $
+     """, re.VERBOSE),
+     lambda m: PlayerName(m.group('who'))),
 
     # **ANNOUNCEMENT** from relay: FICS is relaying the Swedish Championship. (...)
     ("announcement",
     - "user_disconnected", PlayerName
     - "watched_user_connected", PlayerName    (for +notify people)
     - "watched_user_disconnected", PlayerName
+    - "watching_user_connected", PlayerName    (for people having me on +notify)
+    - "watching_user_disconnected", PlayerName
     - "game_started", GameStart
     - "game_joined", GameJoinInfo
     - "game_finished", GameFinish

File tests/test_parser.py

         w, d = info_parser.parse_fics_line(
             'Notification: FiNLiP has arrived and isn\'t on your notify list.')
         self.failUnlessEqual(w, 'watching_user_connected')
-        self.failUnlessEqual(d, PlayerName('Mekk'))
+        self.failUnlessEqual(d, PlayerName('FiNLiP'))
 
     def test_departure_nt(self):
         w, d = info_parser.parse_fics_line(
             'Notification: FiNLiP has departed and isn\'t on your notify list.')
         self.failUnlessEqual(w, 'watching_user_disconnected')
-        self.failUnlessEqual(d, PlayerName('Mekk'))
+        self.failUnlessEqual(d, PlayerName('FiNLiP'))
 
 # Notification: FiNLiP has arrived and isn't on your notify list.