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