func cmdOperflags(source interface{}, params [][]byte) { c := source.(*Client) var target *core.User if target = core.GetUserByNick(string(params[0])); target == nil { c.SendLineTo(nil, "401", "%s %s :No such user.", c.u.Nick(), params[0]) return } var flags string if flags = target.Data("op"); flags == "" { c.SendLineTo(nil, "304", ":OPERFLAGS: %s has no server oper flags.", target.Nick()) return } if flags == "on" { flags = perm.DefaultServerOp() } c.SendLineTo(nil, "304", ":OPERFLAGS: %s has server oper flags: %s", target.Nick(), flags) var commands string if commands = target.Data("opcommands"); commands == "" { return } c.SendLineTo(nil, "304", ":OPERFLAGS: %s also has the following specific commands: %s", target.Nick(), commands) }
func cmdOpflags(source interface{}, params [][]byte) { c := source.(*Client) channame := string(params[0]) if channame[0] == '#' { channame = channame[1:] } var ch *core.Channel if ch = core.FindChannel("", channame); ch == nil { c.SendLineTo(nil, "403", "#%s :No such channel.", channame) return } // If the user isn't on the channel, don't let them check unless they // can view private channel data. if m := ch.GetMember(c.u); m == nil { if ok, err := perm.CheckChanViewData(me, c.u, ch, "members"); !ok { c.SendLineTo(nil, "482", "#%s :%s", ch.Name(), err) return } } var target *core.User if target = core.GetUserByNick(string(params[1])); target == nil { c.SendLineTo(nil, "401", "%s :No such user.", params[1]) return } var m *core.Membership if m = ch.GetMember(target); m == nil { c.SendLineTo(nil, "304", ":OPFLAGS #%s: %s is not in the channel.", ch.Name(), target.Nick()) return } if ok, err := perm.CheckMemberViewData(me, c.u, m, "op"); !ok { c.SendLineTo(nil, "482", "#%s :%s: %s", ch.Name(), target.Nick(), err) return } var flags string if flags = m.Data("op"); flags == "" { c.SendLineTo(nil, "304", ":OPFLAGS #%s: %s has no channel op flags.", ch.Name(), target.Nick()) return } if flags == "on" { flags = perm.DefaultChanOp() } c.SendLineTo(nil, "304", ":OPFLAGS #%s: %s has channel op flags: %s", ch.Name(), target.Nick(), flags) }
// Introduce a user to a given local server. func send_uid(l *local, u *core.User) { irc.SendFrom(l, from(nil), "UID %s 1 %d +i %s %s %s %s :%s", u.Nick(), u.NickTS(), u.GetIdent(), u.GetHostname(), u.GetIP(), u.ID(), u.Data("realname")) }