Skip to content
Permalink
Browse files

Fix standby logic

  • Loading branch information...
quartata committed Dec 7, 2017
1 parent d89fc9b commit 089d5c8a56a7d2eac80fd62306066d0e95ea77b2
Showing with 13 additions and 9 deletions.
  1. +10 −7 chatcommunicate.py
  2. +3 −2 ws.py
@@ -81,15 +81,16 @@ def init(username, password):
else:
parse_room_config("rooms.yml")

if not GlobalVars.standby_mode:
for site, roomid in _command_rooms:
room = _clients[site].get_room(roomid)
deletion_watcher = (site, roomid) in _watcher_rooms
for site, roomid in _command_rooms:
room = _clients[site].get_room(roomid)
deletion_watcher = (site, roomid) in _watcher_rooms

if not GlobalVars.standby_mode:
room.join()
room.watch_socket(on_msg)
_rooms[(site, roomid)] = RoomData(room, threading.Event(), -1, (), deletion_watcher)
_rooms[(site, roomid)].lock.set()

_rooms[(site, roomid)] = RoomData(room, threading.Event(), -1, (), deletion_watcher)
_rooms[(site, roomid)].lock.set()

if os.path.isfile("messageData.p"):
_last_messages = pickle.load(open("messageData.p", "rb"))
@@ -229,7 +230,9 @@ def tell_rooms(msg, has, hasnt, notify_site="", report_data=()):
deletion_watcher = room in _watcher_rooms

new_room = _clients[site].get_room(roomid)
new_room.join()

if not GlobalVars.standby_mode:
new_room.join()

_rooms[room] = RoomData(new_room, threading.Event(), -1, (), deletion_watcher)
_rooms[room].lock.set()
5 ws.py
@@ -107,11 +107,12 @@
GlobalVars.location +\
")"

GlobalVars.standby_mode = "standby" in sys.argv

chatcommunicate.init(username, password)

if "standby" in sys.argv:
if GlobalVars.standby_mode:
chatcommunicate.tell_rooms_with("debug", GlobalVars.standby_message)
GlobalVars.standby_mode = True
Metasmoke.send_status_ping()

while GlobalVars.standby_mode:

0 comments on commit 089d5c8

Please sign in to comment.
You can’t perform that action at this time.