Skip to content

Commit

Permalink
Issue Itiviti#251 - Fix Warning "event of type UNKNOWN not handled"
Browse files Browse the repository at this point in the history
  • Loading branch information
BastianVoigt committed Apr 24, 2018
1 parent d3fe7de commit f5ff4cc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 387 deletions.
385 changes: 0 additions & 385 deletions simpleslackapi.ipr

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum EventType
PIN_ADDED("pin_added"),
PIN_REMOVED("pin_removed"),
USER_TYPING("user_typing"),
HELLO("hello"),
OTHER("-");

private static final Map<String, EventType> CODE_MAP = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.ullink.slack.simpleslackapi.events;

public class Hello implements SlackEvent {
@Override
public SlackEventType getEventType() {
return SlackEventType.HELLO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public enum SlackEventType {
PIN_REMOVED,
USER_TYPING,
UNKNOWN,
SLACK_DISCONNECTED;
SLACK_DISCONNECTED,
HELLO
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class SlackJSONMessageParser {
private static final Logger LOGGER = LoggerFactory.getLogger(SlackJSONMessageParser.class);

public static enum SlackMessageSubType
public enum SlackMessageSubType
{
CHANNEL_JOIN("channel_join"), CHANNEL_LEAVE("channel_leave"), MESSAGE_CHANGED("message_changed"), MESSAGE_DELETED("message_deleted"), OTHER("-"), FILE_SHARE("file_share"), MESSAGE_REPLIED("message_replied");

Expand Down Expand Up @@ -96,6 +96,8 @@ static SlackEvent decode(SlackSession slackSession, JsonObject obj) {
return extractPinRemovedEvent(slackSession, obj);
case USER_TYPING:
return extractUserTypingEvent(slackSession, obj);
case HELLO:
return new Hello();
default:
return new UnknownEvent(obj.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ void dispatch(SlackEvent event) {
case USER_TYPING:
dispatchImpl((UserTyping) event, userTypingListener);
break;
case HELLO:
// don't need to dispatch this
break;
default:
LOGGER.warn("event of type " + event.getEventType() + " not handled: " + ((UnknownEvent)event).getJsonPayload());
}
Expand Down

0 comments on commit f5ff4cc

Please sign in to comment.