|
|
@ -6,9 +6,11 @@ package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"runtime"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/beevik/etree" // BSD-2-clause
|
|
|
|
"github.com/beevik/etree" // BSD-2-clause
|
|
|
|
"github.com/xmppo/go-xmpp" // BSD-3-Clause
|
|
|
|
"github.com/xmppo/go-xmpp" // BSD-3-Clause
|
|
|
@ -24,7 +26,11 @@ func sendIQ(client *xmpp.Client, iqc chan xmpp.IQ, target string, iQtype string,
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return iq, fmt.Errorf("sendIQ: failed to send iq: %w", err)
|
|
|
|
return iq, fmt.Errorf("sendIQ: failed to send iq: %w", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
iq = <-c
|
|
|
|
select {
|
|
|
|
|
|
|
|
case iq = <-c:
|
|
|
|
|
|
|
|
case <-time.After(60 * time.Second):
|
|
|
|
|
|
|
|
return iq, errors.New("sendIQ: server didn't reply to IQ: " + content)
|
|
|
|
|
|
|
|
}
|
|
|
|
return iq, nil
|
|
|
|
return iq, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|