From f4df7e57fe705d1cb1eb48b00f34c4d904e40787 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Tue, 7 Feb 2017 06:16:10 -0500 Subject: [PATCH] implement CModes.HasMode() --- modes.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modes.go b/modes.go index bd5ee8c..13fac0e 100644 --- a/modes.go +++ b/modes.go @@ -71,6 +71,17 @@ func (c *CModes) String() string { return out + args } +// HasMode checks if the CModes state has a given mode. E.g. "m", or "I". +func (c *CModes) HasMode(mode string) bool { + for i := 0; i < len(c.modes); i++ { + if string(c.modes[i].name) == mode { + return true + } + } + + return false +} + // hasArg checks to see if the mode supports arguments. What ones support this?: // A = Mode that adds or removes a nick or address to a list. Always has a parameter. // B = Mode that changes a setting and always has a parameter.