fix
This commit is contained in:
parent
aca6a0dfa4
commit
db03367945
@ -315,17 +315,19 @@ func (mod *modEngine) HandleMessage(msgid string) {
|
|||||||
pubkey := nntp.Pubkey()
|
pubkey := nntp.Pubkey()
|
||||||
for _, line := range strings.Split(nntp.Message(), "\n") {
|
for _, line := range strings.Split(nntp.Message(), "\n") {
|
||||||
line = strings.Trim(line, "\r\t\n ")
|
line = strings.Trim(line, "\r\t\n ")
|
||||||
|
if len(line) > 0 {
|
||||||
ev := ParseModEvent(line)
|
ev := ParseModEvent(line)
|
||||||
mod.Execute(ev, pubkey)
|
mod.Execute(ev, pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *modEngine) Do(ev ModEvent) {
|
func (mod *modEngine) Do(ev ModEvent) {
|
||||||
action := ev.Action()
|
action := ev.Action()
|
||||||
target := ev.Target()
|
target := ev.Target()
|
||||||
if action == ModDelete || action == ModDeleteAlt {
|
if action == ModDelete || action == ModDeleteAlt {
|
||||||
msgid := ev.Target()
|
msgid := target
|
||||||
if !ValidMessageID(msgid) {
|
if !ValidMessageID(msgid) {
|
||||||
// invalid message-id
|
// invalid message-id
|
||||||
log.Println("invalid message-id", msgid)
|
log.Println("invalid message-id", msgid)
|
||||||
|
@ -469,11 +469,11 @@ func (self *articleStore) GetMessage(msgid string) (nntp NNTPMessage) {
|
|||||||
R: msg.Body,
|
R: msg.Body,
|
||||||
N: MaxMessageSize,
|
N: MaxMessageSize,
|
||||||
}
|
}
|
||||||
err = read_message_body(body, hdr, nil, nil, true, func(nntp NNTPMessage) {
|
err = read_message_body(body, hdr, nil, nil, true, func(n NNTPMessage) {
|
||||||
c := chnl
|
c := chnl
|
||||||
// inject pubkey for mod
|
// inject pubkey for mod
|
||||||
nntp.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
|
n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
|
||||||
c <- nntp
|
c <- n
|
||||||
close(c)
|
close(c)
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Reference in New Issue
Block a user