check semaphore fist on tweet and message
[rainbowstream.git] / rainbowstream / rainbow.py
index 4a1e3d78c02c6624126aecec5a66724fd48a1dba..fbac32cb818bebd18cde231d440d74becb029f7c 100644 (file)
@@ -1619,7 +1619,7 @@ def listen():
         g['cmd'] = cmd
         try:
             # Lock the semaphore
-            db.semaphore_update_flag(True)
+            db.semaphore_update_lock(True)
             # Save cmd to global variable and call process
             g['stuff'] = ' '.join(line.split()[1:])
             # Process the command
@@ -1630,7 +1630,7 @@ def listen():
             else:
                 g['prefix'] = True
             # Release the semaphore lock
-            db.semaphore_update_flag(False)
+            db.semaphore_update_lock(False)
         except Exception:
             printNicely(red('OMG something is wrong with Twitter right now.'))
 
@@ -1689,7 +1689,7 @@ def stream(domain, args, name='Rainbow Stream'):
                     ig=args.ignore,
                 )
             elif tweet.get('direct_message'):
-                print_message(tweet['direct_message'])
+                print_message(tweet['direct_message'],check_semaphore=True)
     except TwitterHTTPError:
         printNicely('')
         printNicely(