summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/modes.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-04-12 00:30:21 +0200
committerGitHub <noreply@github.com>2022-04-12 00:30:21 +0200
commit281ef53e7de5d30114dbf57a4b506b2d8d2720cc (patch)
tree5fe13b85ffe312053452e0d7107ca4b174a412e0 /vendor/github.com/lrstanley/girc/modes.go
parentf044b948e257814e8e1f70d4b66821bfd9c2ff06 (diff)
downloadmatterbridge-msglm-281ef53e7de5d30114dbf57a4b506b2d8d2720cc.tar.gz
matterbridge-msglm-281ef53e7de5d30114dbf57a4b506b2d8d2720cc.tar.bz2
matterbridge-msglm-281ef53e7de5d30114dbf57a4b506b2d8d2720cc.zip
Update dependencies (#1800)
Diffstat (limited to 'vendor/github.com/lrstanley/girc/modes.go')
-rw-r--r--vendor/github.com/lrstanley/girc/modes.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/vendor/github.com/lrstanley/girc/modes.go b/vendor/github.com/lrstanley/girc/modes.go
index 864df71f..35ff103a 100644
--- a/vendor/github.com/lrstanley/girc/modes.go
+++ b/vendor/github.com/lrstanley/girc/modes.go
@@ -34,7 +34,7 @@ func (c *CMode) Short() string {
// String returns a string representation of a mode, including optional
// arguments. E.g. "+b user*!ident@host.*.com"
func (c *CMode) String() string {
- if len(c.args) == 0 {
+ if c.args == "" {
return c.Short()
}
@@ -106,7 +106,7 @@ func (c *CModes) HasMode(mode string) bool {
func (c *CModes) Get(mode string) (args string, ok bool) {
for i := 0; i < len(c.modes); i++ {
if string(c.modes[i].name) == mode {
- if len(c.modes[i].args) == 0 {
+ if c.modes[i].args == "" {
return "", false
}
@@ -157,7 +157,7 @@ func (c *CModes) hasArg(set bool, mode byte) (hasArgs, isSetting bool) {
// For example, the latter would mean applying an incoming MODE with the modes
// stored for a channel.
func (c *CModes) Apply(modes []CMode) {
- var new []CMode
+ var newModes []CMode
for j := 0; j < len(c.modes); j++ {
isin := false
@@ -166,14 +166,14 @@ func (c *CModes) Apply(modes []CMode) {
continue
}
if c.modes[j].name == modes[i].name && modes[i].add {
- new = append(new, modes[i])
+ newModes = append(newModes, modes[i])
isin = true
break
}
}
if !isin {
- new = append(new, c.modes[j])
+ newModes = append(newModes, c.modes[j])
}
}
@@ -183,19 +183,19 @@ func (c *CModes) Apply(modes []CMode) {
}
isin := false
- for j := 0; j < len(new); j++ {
- if modes[i].name == new[j].name {
+ for j := 0; j < len(newModes); j++ {
+ if modes[i].name == newModes[j].name {
isin = true
break
}
}
if !isin {
- new = append(new, modes[i])
+ newModes = append(newModes, modes[i])
}
}
- c.modes = new
+ c.modes = newModes
}
// Parse parses a set of flags and args, returning the necessary list of
@@ -221,7 +221,7 @@ func (c *CModes) Parse(flags string, args []string) (out []CMode) {
}
hasArgs, isSetting := c.hasArg(add, flags[i])
- if hasArgs && len(args) >= argCount+1 {
+ if hasArgs && len(args) > argCount {
mode.args = args[argCount]
argCount++
}
@@ -351,7 +351,7 @@ func handleMODE(c *Client, e Event) {
// Loop through and update users modes as necessary.
for i := 0; i < len(modes); i++ {
- if modes[i].setting || len(modes[i].args) == 0 {
+ if modes[i].setting || modes[i].args == "" {
continue
}
@@ -493,8 +493,8 @@ func (m *Perms) reset() {
// set translates raw prefix characters into proper permissions. Only
// use this function when you have a session lock.
-func (m *Perms) set(prefix string, append bool) {
- if !append {
+func (m *Perms) set(prefix string, add bool) {
+ if !add {
m.reset()
}