only list our blessed channel
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
10e9aa473d
commit
cb3ba59cf7
45
server.go
45
server.go
@ -120,18 +120,14 @@ func (s *Server) handleCommand(client *Client, command string, args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if args[0] == "0" {
|
switch args[0] {
|
||||||
// Intend to quit all channels
|
case BLESSED_CHANNEL:
|
||||||
// But we don't allow that
|
// That's fine, but they're already there
|
||||||
return
|
case "0":
|
||||||
}
|
// Intend to quit all channels, but we don't allow that
|
||||||
|
default:
|
||||||
channels := strings.Split(args[0], ",")
|
client.reply(rplKill, "There is only '"+BLESSED_CHANNEL+"'.", "")
|
||||||
for _, channel := range channels {
|
client.disconnect()
|
||||||
//Join the channel if it's valid
|
|
||||||
if channelRegexp.MatchString(channel) {
|
|
||||||
client.joinChannel(channel)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "PART":
|
case "PART":
|
||||||
@ -227,31 +223,12 @@ func (s *Server) handleCommand(client *Client, command string, args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) == 0 {
|
// FIXME
|
||||||
for channelName, channel := range s.channelMap {
|
channel := s.channelMap[BLESSED_CHANNEL]
|
||||||
if channel.mode.secret {
|
listItem := fmt.Sprintf("%s %d :%s", channel.name, len(channel.clientMap), channel.topic)
|
||||||
if _, inChannel := channel.clientMap[client.key]; !inChannel {
|
|
||||||
//Not in the channel, skip
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
listItem := fmt.Sprintf("%s %d :%s", channelName, len(channel.clientMap), channel.topic)
|
|
||||||
client.reply(rplList, listItem)
|
client.reply(rplList, listItem)
|
||||||
}
|
|
||||||
|
|
||||||
client.reply(rplListEnd)
|
client.reply(rplListEnd)
|
||||||
} else {
|
|
||||||
channels := strings.Split(args[0], ",")
|
|
||||||
|
|
||||||
for _, channelName := range channels {
|
|
||||||
if channel, exists := s.channelMap[strings.ToLower(channelName)]; exists {
|
|
||||||
listItem := fmt.Sprintf("%s %d :%s", channelName, len(channel.clientMap), channel.topic)
|
|
||||||
client.reply(rplList, listItem)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
client.reply(rplListEnd)
|
|
||||||
}
|
|
||||||
case "OPER":
|
case "OPER":
|
||||||
if client.registered == false {
|
if client.registered == false {
|
||||||
client.reply(errNotReg)
|
client.reply(errNotReg)
|
||||||
|
@ -5,6 +5,7 @@ import "net"
|
|||||||
const (
|
const (
|
||||||
VERSION = "1.0.0"
|
VERSION = "1.0.0"
|
||||||
APP_DESCRIPTION = "nmdc-ircfrontend v" + VERSION
|
APP_DESCRIPTION = "nmdc-ircfrontend v" + VERSION
|
||||||
|
BLESSED_CHANNEL = "#chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user