diff --git a/client.go b/client.go index 99c3211..cd023d9 100644 --- a/client.go +++ b/client.go @@ -24,8 +24,6 @@ type Client interface { } type RemoteClient struct { - Registered chan bool - server *Server name string diff --git a/handlers.go b/handlers.go index 640fff9..aac7cc0 100644 --- a/handlers.go +++ b/handlers.go @@ -55,7 +55,7 @@ func handleCmdPrivmsg(sv *Server, msg *irc.Message) { clid := strings.ToLower(msg.Pre) chid := strings.ToLower(msg.Args[0]) if sv.channelCheckMode(chid, "m") && - !sv.channelCheckPerm(chid, clid, "qaohv") { + !sv.channelCheckPerm(chid, clid, "ohv") { sv.sendReply(clid, ERR_CANNOTSENDTOCHAN, chid, "Cannot send to channel") return } @@ -86,17 +86,17 @@ func handleCmdJoin(sv *Server, msg *irc.Message) { sv.channelNames(msg.Pre, msg.Args[0]) _, isadm := sv.admins[clid] if isadm { - mode := "q " + clid + mode := "o " + clid sv.chModes[chid][mode] = true - sv.sendMsg(irc.M(sv.host, "MODE", chid+" +q "+clid, "")) + sv.sendMsg(irc.M(sv.host, "MODE", chid+" +o "+clid, "")) sv.sendMsg(irc.M(sv.host, "PRIVMSG", chid, clid+" is a server administrator")) return } _, isop := sv.opers[clid] if isop { - mode := "a " + clid + mode := "o " + clid sv.chModes[chid][mode] = true - sv.sendMsg(irc.M(sv.host, "MODE", chid+" +a "+clid, "")) + sv.sendMsg(irc.M(sv.host, "MODE", chid+" +o "+clid, "")) sv.sendMsg(irc.M(sv.host, "PRIVMSG", chid, clid+" is a server operator")) return } @@ -120,8 +120,8 @@ func handleCmdPart(sv *Server, msg *irc.Message) { } sv.sendMsg(msg) delete(sv.chUsers[chid], clid) - delete(sv.chModes[chid], "q "+clid) - delete(sv.chModes[chid], "a "+clid) + //delete(sv.chModes[chid], "q "+clid) + //delete(sv.chModes[chid], "a "+clid) delete(sv.chModes[chid], "o "+clid) delete(sv.chModes[chid], "h "+clid) delete(sv.chModes[chid], "v "+clid) @@ -158,27 +158,27 @@ func handleCmdMode(sv *Server, msg *irc.Message) { switch modeSwitch[1] { // maybe this can be done more elegant case 'o': - if !sv.channelCheckPerm(chid, clid, "qao") { + if !sv.channelCheckPerm(chid, clid, "o") { goto noPerm } case 'h': - if !sv.channelCheckPerm(chid, clid, "qao") { + if !sv.channelCheckPerm(chid, clid, "o") { goto noPerm } case 'b': - if !sv.channelCheckPerm(chid, clid, "qaoh") { + if !sv.channelCheckPerm(chid, clid, "oh") { goto noPerm } case 'v': - if !sv.channelCheckPerm(chid, clid, "qaoh") { + if !sv.channelCheckPerm(chid, clid, "oh") { goto noPerm } case 'm': - if !sv.channelCheckPerm(chid, clid, "qaoh") { + if !sv.channelCheckPerm(chid, clid, "oh") { goto noPerm } case 't': - if !sv.channelCheckPerm(chid, clid, "qaoh") { + if !sv.channelCheckPerm(chid, clid, "oh") { goto noPerm } default: @@ -210,7 +210,7 @@ func handleCmdTopic(sv *Server, msg *irc.Message) { sv.sendReply(msg.Pre, RPL_TOPIC, chid, sv.chTopics[chid]) } else { if sv.channelCheckMode(chid, "t") && - !sv.channelCheckPerm(chid, clid, "qaoh") { + !sv.channelCheckPerm(chid, clid, "oh") { sv.sendReply(clid, ERR_CHANOPRIVSNEEDED, chid, "You're not channel operator") return } @@ -224,13 +224,13 @@ func handleCmdKick(sv *Server, msg *irc.Message) { chid := strings.ToLower(msg.Args[0]) clid := strings.ToLower(msg.Pre) target := strings.ToLower(msg.Args[1]) - if !sv.channelCheckPerm(chid, clid, "qaoh") { + if !sv.channelCheckPerm(chid, clid, "oh") { sv.sendReply(clid, ERR_CHANOPRIVSNEEDED, chid, "You're not channel operator") } sv.sendMsg(msg) delete(sv.chUsers[chid], target) - delete(sv.chModes[chid], "q "+target) - delete(sv.chModes[chid], "a "+target) + //delete(sv.chModes[chid], "q "+target) + //delete(sv.chModes[chid], "a "+target) delete(sv.chModes[chid], "o "+target) delete(sv.chModes[chid], "h "+target) delete(sv.chModes[chid], "v "+target) diff --git a/server.go b/server.go index 3fba1c6..a550352 100644 --- a/server.go +++ b/server.go @@ -22,7 +22,9 @@ const ( ) var myinfo string = "%s %s/%s * *" -var isupport string = "CASEMAPPING=rfc1459 CHANTYPES=# NICKLEN=32 MODES=1 PREFIX=(qaohv)~&@%+" + +//var isupport string = "CASEMAPPING=rfc1459 CHANTYPES=# NICKLEN=32 MODES=1 PREFIX=(qaohv)~&@%+" +var isupport string = "CASEMAPPING=rfc1459 CHANTYPES=# NICKLEN=32 MODES=1 PREFIX=(ohv)@%+" type Server struct { queue chan *irc.Message @@ -332,8 +334,8 @@ func (sv *Server) channelNames(nick, ch string) { if names != "" { names += " " } - modeFlags := "qaohv" - modeChars := "~&@%+" + modeFlags := "ohv" + modeChars := "@%+" for i, mf := range modeFlags { if _, exists := sv.chModes[chid][string(mf)+" "+clid]; exists { name = string(modeChars[i]) + name