mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-07-25 15:04:34 +02:00
updated in line with comments in PR
* reduce change footprint to parameter list * moved Op flag display to last line as to not break bots
This commit is contained in:
parent
5f201e0f20
commit
b6a8763f3b
2
host.go
2
host.go
@ -411,7 +411,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
|
|||||||
var whois string
|
var whois string
|
||||||
switch room.IsOp(msg.From()) {
|
switch room.IsOp(msg.From()) {
|
||||||
case true:
|
case true:
|
||||||
whois = id.WhoisAdmin(room, h)
|
whois = id.WhoisAdmin(room)
|
||||||
case false:
|
case false:
|
||||||
whois = id.Whois()
|
whois = id.Whois()
|
||||||
}
|
}
|
||||||
|
11
identity.go
11
identity.go
@ -60,7 +60,7 @@ func (i Identity) Whois() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WhoisAdmin returns a whois description for admin users.
|
// WhoisAdmin returns a whois description for admin users.
|
||||||
func (i Identity) WhoisAdmin(room *chat.Room, host *Host) string {
|
func (i Identity) WhoisAdmin(room *chat.Room) string {
|
||||||
ip, _, _ := net.SplitHostPort(i.RemoteAddr().String())
|
ip, _, _ := net.SplitHostPort(i.RemoteAddr().String())
|
||||||
fingerprint := "(no public key)"
|
fingerprint := "(no public key)"
|
||||||
if i.PublicKey() != nil {
|
if i.PublicKey() != nil {
|
||||||
@ -68,15 +68,14 @@ func (i Identity) WhoisAdmin(room *chat.Room, host *Host) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isOp := ""
|
isOp := ""
|
||||||
user, ok := host.GetUser(i.id)
|
if member, ok := room.MemberByID(i.ID()); ok && room.IsOp(member.User) {
|
||||||
if ok && room.IsOp(user) {
|
isOp = message.Newline + " > op: true"
|
||||||
isOp = " > Op" + message.Newline
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "name: " + i.Name() + message.Newline +
|
return "name: " + i.Name() + message.Newline +
|
||||||
isOp +
|
|
||||||
" > ip: " + ip + message.Newline +
|
" > ip: " + ip + message.Newline +
|
||||||
" > fingerprint: " + fingerprint + message.Newline +
|
" > fingerprint: " + fingerprint + message.Newline +
|
||||||
" > client: " + sanitize.Data(string(i.ClientVersion()), 64) + message.Newline +
|
" > client: " + sanitize.Data(string(i.ClientVersion()), 64) + message.Newline +
|
||||||
" > joined: " + humantime.Since(i.created) + " ago"
|
" > joined: " + humantime.Since(i.created) + " ago" +
|
||||||
|
isOp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user