mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
allow history queries against PRIVMSG of other clients, if the accounts match
This commit is contained in:
parent
51fcedc5a1
commit
463de94610
@ -566,15 +566,20 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
|
||||
|
||||
target := msg.Params[0]
|
||||
channel = server.channels.Get(target)
|
||||
if channel == nil {
|
||||
cftarget, _ := Casefold(target)
|
||||
if cftarget == "me" || cftarget == "self" || cftarget == client.NickCasefolded() {
|
||||
hist = client.history
|
||||
} else {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if channel != nil {
|
||||
hist = &channel.history
|
||||
} else {
|
||||
targetClient := server.clients.Get(target)
|
||||
if targetClient != nil {
|
||||
myAccount := client.Account()
|
||||
targetAccount := targetClient.Account()
|
||||
if myAccount != "" && targetAccount != "" && myAccount == targetAccount {
|
||||
hist = targetClient.history
|
||||
}
|
||||
}
|
||||
}
|
||||
if hist == nil {
|
||||
return
|
||||
}
|
||||
|
||||
preposition := strings.ToLower(msg.Params[1])
|
||||
@ -1013,16 +1018,25 @@ func historyHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
||||
target := msg.Params[0]
|
||||
var hist *history.Buffer
|
||||
channel := server.channels.Get(target)
|
||||
if channel == nil {
|
||||
cftarget, _ := Casefold(target)
|
||||
if cftarget == "me" || cftarget == "self" || cftarget == client.NickCasefolded() {
|
||||
if channel != nil {
|
||||
hist = &channel.history
|
||||
} else {
|
||||
if strings.ToLower(target) == "me" {
|
||||
hist = client.history
|
||||
} else {
|
||||
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), target, client.t("No such channel"))
|
||||
return false
|
||||
targetClient := server.clients.Get(target)
|
||||
if targetClient != nil {
|
||||
myAccount, targetAccount := client.Account(), targetClient.Account()
|
||||
if myAccount != "" && targetAccount != "" && myAccount == targetAccount {
|
||||
hist = targetClient.history
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hist = &channel.history
|
||||
}
|
||||
|
||||
if hist == nil {
|
||||
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), target, client.t("No such channel"))
|
||||
return false
|
||||
}
|
||||
|
||||
limit := 10
|
||||
|
@ -196,10 +196,12 @@ Get an explanation of <argument>, or "index" for a list of help topics.`,
|
||||
Get an explanation of <argument>, or "index" for a list of help topics.`,
|
||||
},
|
||||
"history": {
|
||||
text: `HISTSERV <target> [limit]
|
||||
text: `HISTORY <target> [limit]
|
||||
|
||||
Replay message history. <target> can be a channel name, or "self" or "me"
|
||||
to replay direct message history. At most [limit] messages will be replayed.`,
|
||||
Replay message history. <target> can be a channel name, "me" to replay direct
|
||||
message history, or a nickname to replay another client's direct message
|
||||
history (they must be logged into the same account as you). At most [limit]
|
||||
messages will be replayed.`,
|
||||
},
|
||||
"hostserv": {
|
||||
text: `HOSTSERV <command> [params]
|
||||
|
Loading…
Reference in New Issue
Block a user