From 6367e4b654c268a9dfc531697dcd688f0df776c6 Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sun, 9 Feb 2014 08:53:06 -0800 Subject: [PATCH] fix ModeString --- irc/channel.go | 3 +++ irc/client.go | 10 +++++++--- irc/reply.go | 2 +- irc/types.go | 4 ++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index 7d3bd333..c926aa8a 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -130,6 +130,9 @@ func (channel *Channel) ModeString() (str string) { if channel.noOutside { str += NoOutside.String() } + if len(str) > 0 { + str = "+" + str + } return } diff --git a/irc/client.go b/irc/client.go index 269474c8..f984cfac 100644 --- a/irc/client.go +++ b/irc/client.go @@ -104,11 +104,15 @@ func (client *Client) InterestedClients() ClientSet { return clients } -func (c *Client) UModeString() string { +// +func (c *Client) ModeString() (str string) { if c.invisible { - return "i" + str += Invisible.String() } - return "" + if len(str) > 0 { + str = "+" + str + } + return } func (c *Client) UserHost() string { diff --git a/irc/reply.go b/irc/reply.go index 45b995b1..64a3cf21 100644 --- a/irc/reply.go +++ b/irc/reply.go @@ -178,7 +178,7 @@ func RplMyInfo(server *Server) 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 { diff --git a/irc/types.go b/irc/types.go index 0c380493..c9681cab 100644 --- a/irc/types.go +++ b/irc/types.go @@ -17,6 +17,10 @@ type ModeOp rune // user mode flags type UserMode rune +func (mode UserMode) String() string { + return fmt.Sprintf("%c", mode) +} + // channel mode flags type ChannelMode rune