From 2f7b660dd95086ebf68de8a795fa4abd643f33e2 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 16 Feb 2012 22:34:35 -0600 Subject: start refactoring to be able to handle timeline stuff --- lib/Bot/Flowdock/IRC.pm | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/Bot/Flowdock/IRC.pm b/lib/Bot/Flowdock/IRC.pm index 0f725c7..878e235 100644 --- a/lib/Bot/Flowdock/IRC.pm +++ b/lib/Bot/Flowdock/IRC.pm @@ -116,22 +116,31 @@ sub tick { next if $event->{user} == $self->_my_id; + my $app = $event->{app} || ''; my $type = $event->{event}; - if ($type eq 'message' || $type eq 'line') { - $self->flowdock_message($event); + if ($app eq 'chat') { + if ($type eq 'message' || $type eq 'line') { + $self->flowdock_message($event); + } + elsif ($type eq 'status') { + $self->flowdock_status($event); + } + elsif ($type eq 'user-edit') { + $self->flowdock_user_edit($event); + } + else { + warn "Unknown chat event type $type: " . encode_json($event); + } } - elsif ($type eq 'status') { - $self->flowdock_status($event); - } - elsif ($type eq 'user-edit') { - $self->flowdock_user_edit($event); - } - elsif ($type eq 'activity.user') { - # ignore it + elsif ($app eq 'influx') { # i think this is timeline stuff + # ... } else { - warn "Unknown event type $type: " . encode_json($event); + # we don't care activity events + if ($type ne 'activity.user') { + warn "Unknown event type $type for unknown app $app: " . encode_json($event); + } } } -- cgit v1.2.3-54-g00ecf