Commit f6257163 authored by Aaron Hill's avatar Aaron Hill
Browse files

Merge pull request #366 from semnil/master

Add some callback methods.
parents e89384ba 305cff38
...@@ -49,6 +49,14 @@ class StreamListener(object): ...@@ -49,6 +49,14 @@ class StreamListener(object):
delete = data['delete']['status'] delete = data['delete']['status']
if self.on_delete(delete['id'], delete['user_id']) is False: if self.on_delete(delete['id'], delete['user_id']) is False:
return False return False
elif 'event' in data:
status = Status.parse(self.api, data)
if self.on_event(status) is False:
return False
elif 'direct_message' in data:
status = Status.parse(self.api, data)
if self.on_direct_message(status) is False:
return False
elif 'limit' in data: elif 'limit' in data:
if self.on_limit(data['limit']['track']) is False: if self.on_limit(data['limit']['track']) is False:
return False return False
...@@ -70,6 +78,14 @@ class StreamListener(object): ...@@ -70,6 +78,14 @@ class StreamListener(object):
"""Called when a delete notice arrives for a status""" """Called when a delete notice arrives for a status"""
return return
def on_event(self, status):
"""Called when a new event arrives"""
return
def on_direct_message(self, status):
"""Called when a new direct message arrives"""
return
def on_limit(self, track): def on_limit(self, track):
"""Called when a limitation notice arrvies""" """Called when a limitation notice arrvies"""
return return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment