Archived
1
0
This commit is contained in:
Jeff 2017-04-20 18:00:59 -04:00
parent aca6a0dfa4
commit db03367945
2 changed files with 8 additions and 6 deletions

View File

@ -315,8 +315,10 @@ func (mod *modEngine) HandleMessage(msgid string) {
pubkey := nntp.Pubkey()
for _, line := range strings.Split(nntp.Message(), "\n") {
line = strings.Trim(line, "\r\t\n ")
ev := ParseModEvent(line)
mod.Execute(ev, pubkey)
if len(line) > 0 {
ev := ParseModEvent(line)
mod.Execute(ev, pubkey)
}
}
}
}
@ -325,7 +327,7 @@ func (mod *modEngine) Do(ev ModEvent) {
action := ev.Action()
target := ev.Target()
if action == ModDelete || action == ModDeleteAlt {
msgid := ev.Target()
msgid := target
if !ValidMessageID(msgid) {
// invalid message-id
log.Println("invalid message-id", msgid)

View File

@ -469,11 +469,11 @@ func (self *articleStore) GetMessage(msgid string) (nntp NNTPMessage) {
R: msg.Body,
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
// inject pubkey for mod
nntp.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
c <- nntp
n.Headers().Set("X-PubKey-Ed25519", hdr.Get("X-PubKey-Ed25519"))
c <- n
close(c)
})
if err == nil {