|
|
|
@ -92,7 +92,7 @@ func main() {
|
|
|
|
|
// There are some errors that we ignore as we do not want to
|
|
|
|
|
// stop the execution. Failure is used to track those to exit
|
|
|
|
|
// with a non-success return value.
|
|
|
|
|
failure int
|
|
|
|
|
failure error
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Define command line flags.
|
|
|
|
@ -412,8 +412,8 @@ func main() {
|
|
|
|
|
re.OxKeyRing, err = oxGetPublicKeyRing(client, iqc, r)
|
|
|
|
|
if err != nil {
|
|
|
|
|
re.OxKeyRing = nil
|
|
|
|
|
fmt.Printf("Ox: error fetching key for %s: %v", r, err)
|
|
|
|
|
failure++
|
|
|
|
|
fmt.Printf("Ox: error fetching key for %s: %v\n", r, err)
|
|
|
|
|
failure = err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
recipients = append(recipients, re)
|
|
|
|
@ -556,9 +556,8 @@ func main() {
|
|
|
|
|
go func() {
|
|
|
|
|
for range c {
|
|
|
|
|
cancel()
|
|
|
|
|
if failure != 0 {
|
|
|
|
|
err := fmt.Errorf("errors occurred, see above")
|
|
|
|
|
closeAndExit(client, err)
|
|
|
|
|
if failure != nil {
|
|
|
|
|
closeAndExit(client, failure)
|
|
|
|
|
}
|
|
|
|
|
closeAndExit(client, nil)
|
|
|
|
|
}
|
|
|
|
@ -592,9 +591,9 @@ func main() {
|
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
|
recipient.Jid, *recipient.OxKeyRing, message, *flagSubject)
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Printf("Ox: couldn't encrypt to %s: %v",
|
|
|
|
|
fmt.Printf("Ox: couldn't encrypt to %s: %v\n",
|
|
|
|
|
recipient.Jid, err)
|
|
|
|
|
failure++
|
|
|
|
|
failure = err
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
_, err = client.SendOrg(oxMessage)
|
|
|
|
@ -623,9 +622,8 @@ func main() {
|
|
|
|
|
go func() {
|
|
|
|
|
for range c {
|
|
|
|
|
cancel()
|
|
|
|
|
if failure != 0 {
|
|
|
|
|
err := fmt.Errorf("errors occurred, see above")
|
|
|
|
|
closeAndExit(client, err)
|
|
|
|
|
if failure != nil {
|
|
|
|
|
closeAndExit(client, failure)
|
|
|
|
|
}
|
|
|
|
|
closeAndExit(client, nil)
|
|
|
|
|
}
|
|
|
|
@ -736,9 +734,9 @@ func main() {
|
|
|
|
|
oxMessage, err := oxEncrypt(client, oxPrivKey,
|
|
|
|
|
recipient.Jid, *recipient.OxKeyRing, message, *flagSubject)
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Printf("Ox: couldn't encrypt to %s: %v",
|
|
|
|
|
fmt.Printf("Ox: couldn't encrypt to %s: %v\n",
|
|
|
|
|
recipient.Jid, err)
|
|
|
|
|
failure++
|
|
|
|
|
failure = err
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
_, err = client.SendOrg(oxMessage)
|
|
|
|
@ -760,9 +758,8 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
if failure != 0 {
|
|
|
|
|
err := fmt.Errorf("errors occurred, see above")
|
|
|
|
|
closeAndExit(client, err)
|
|
|
|
|
if failure != nil {
|
|
|
|
|
closeAndExit(client, failure)
|
|
|
|
|
}
|
|
|
|
|
closeAndExit(client, nil)
|
|
|
|
|
}
|
|
|
|
|