Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Add Method to delete Channels. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Oct 29, 2019
1 parent dd63579 commit f379d87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public Channel addChanel(final String name) {
return channel;
}

public void removeChannel(final UUID channelUuid, final UUID userUuid) {
final Channel channel = this.getChannelByUUID(channelUuid);
this.notifyAllChannelUsers(ChatAction.CHANNEL_DELETE, channel, userUuid);
this.channels.remove(channel);
}

public Channel getChannelByUUID(final UUID uuid) {
for (final Channel channel : this.channels) if (channel.getUuid().equals(uuid)) return channel;
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ public enum ChatAction {
MEMBER_LEAVE("member-leave"),

SEND_MESSAGE("send-message"),
WHISPER_MESSAGE("whisper-message");
WHISPER_MESSAGE("whisper-message"),

CHANNEL_DELETE("channel-delete");

final String value;

Expand Down

0 comments on commit f379d87

Please sign in to comment.