Added ClientMode.Prefix() function

This commit is contained in:
Harry Jeffery 2013-08-28 16:38:54 +01:00
parent 0017e3f574
commit 0ad0dd2989
2 changed files with 11 additions and 5 deletions

View File

@ -98,11 +98,7 @@ func (c *Client) joinChannel(channelName string) {
nickKey := strings.ToLower(client.nick) nickKey := strings.ToLower(client.nick)
if mode, exists := channel.modeMap[nickKey]; exists { if mode, exists := channel.modeMap[nickKey]; exists {
if mode.operator { prefix = mode.Prefix()
prefix = "@"
} else if mode.voice {
prefix = "+"
}
} }
nicks = append(nicks, fmt.Sprintf("%s%s", prefix, client.nick)) nicks = append(nicks, fmt.Sprintf("%s%s", prefix, client.nick))

View File

@ -65,6 +65,16 @@ type ClientMode struct {
voice bool //Has voice voice bool //Has voice
} }
func (m *ClientMode) Prefix() string {
if m.operator {
return "@"
} else if m.voice {
return "+"
} else {
return ""
}
}
type signalCode int type signalCode int
const ( const (