3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 20:09:41 +01:00

fix ModeString

This commit is contained in:
Jeremy Latt 2014-02-09 08:53:06 -08:00
parent 1787ac8ebf
commit 6367e4b654
4 changed files with 15 additions and 4 deletions

View File

@ -130,6 +130,9 @@ func (channel *Channel) ModeString() (str string) {
if channel.noOutside { if channel.noOutside {
str += NoOutside.String() str += NoOutside.String()
} }
if len(str) > 0 {
str = "+" + str
}
return return
} }

View File

@ -104,11 +104,15 @@ func (client *Client) InterestedClients() ClientSet {
return clients return clients
} }
func (c *Client) UModeString() string { // <mode>
func (c *Client) ModeString() (str string) {
if c.invisible { if c.invisible {
return "i" str += Invisible.String()
} }
return "" if len(str) > 0 {
str = "+" + str
}
return
} }
func (c *Client) UserHost() string { func (c *Client) UserHost() string {

View File

@ -178,7 +178,7 @@ func RplMyInfo(server *Server) Reply {
} }
func RplUModeIs(server *Server, client *Client) Reply { func RplUModeIs(server *Server, client *Client) Reply {
return NewNumericReply(server, RPL_UMODEIS, client.UModeString()) return NewNumericReply(server, RPL_UMODEIS, client.ModeString())
} }
func RplNoTopic(channel *Channel) Reply { func RplNoTopic(channel *Channel) Reply {

View File

@ -17,6 +17,10 @@ type ModeOp rune
// user mode flags // user mode flags
type UserMode rune type UserMode rune
func (mode UserMode) String() string {
return fmt.Sprintf("%c", mode)
}
// channel mode flags // channel mode flags
type ChannelMode rune type ChannelMode rune