User Agent do not contain bridge version, only client in format

This commit is contained in:
Michal Horejsek
2020-04-27 14:28:40 +02:00
committed by James Houlahan
parent 1d49a484a8
commit 984b28e8f9
23 changed files with 125 additions and 74 deletions

View File

@ -76,8 +76,21 @@ func NewIMAPServer(debugClient, debugServer bool, port int, tls *tls.Config, ima
conn.Server().ForEachConn(func(candidate imapserver.Conn) {
if id, ok := candidate.(imapid.Conn); ok {
if conn.Context() == candidate.Context() {
imapBackend.setLastMailClient(id.ID())
return
// ID is not available right at the beginning of the connection.
// Clients send ID quickly after AUTH. We need to wait for it.
go func() {
start := time.Now()
for {
if id.ID() != nil {
imapBackend.setLastMailClient(id.ID())
break
}
if time.Since(start) > 10*time.Second {
break
}
time.Sleep(100 * time.Millisecond)
}
}()
}
}
})