summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-15 12:19:49 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-15 12:19:49 +0100
commitbaa57dd0920e70f38117b7c93abf1668a35efbc7 (patch)
tree3a8dcc81517b964f283bd91d9b7467d54d1520ae
parent465ae3c5e5d4374c70c81be92cbd66e26670a647 (diff)
parentd8bc8410b02b53ea119193f32522a63678fdf999 (diff)
downloaduxp-master.tar.gz
Merge branch 'master' of https://repo.palemoon.org/MoonchildProductions/UXPHEADmaster
-rw-r--r--mailnews/compose/src/nsMsgCompUtils.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
index 6632e3257c..403b3c444d 100644
--- a/mailnews/compose/src/nsMsgCompUtils.cpp
+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
@@ -9,7 +9,7 @@
#include "prmem.h"
#include "nsMsgSend.h"
#include "nsIIOService.h"
-#include "nsIHttpProtocolHandler.h"
+#include "nsIXULAppInfo.h"
#include "nsMailHeaders.h"
#include "nsMsgI18N.h"
#include "nsINntpService.h"
@@ -357,14 +357,21 @@ nsresult mime_generate_headers(nsIMsgCompFields *fields,
finalHeaders->SetRawHeader(HEADER_X_MOZILLA_DRAFT_INFO, draftInfo, nullptr);
}
- nsCOMPtr<nsIHttpProtocolHandler> pHTTPHandler = do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &rv);
- if (NS_SUCCEEDED(rv) && pHTTPHandler)
- {
- nsAutoCString userAgentString;
- pHTTPHandler->GetUserAgent(userAgentString);
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
+ if (appInfo) {
+ nsAutoCString userAgentString;
+ nsAutoCString userAgentName;
+ nsAutoCString userAgentVersion;
+ appInfo->GetName(userAgentName);
+ appInfo->GetVersion(userAgentVersion);
+ if (!userAgentName.IsEmpty() && !userAgentVersion.IsEmpty()) {
+ userAgentString += userAgentName;
+ userAgentString += '/';
+ userAgentString += userAgentVersion;
+ }
if (!userAgentString.IsEmpty())
- finalHeaders->SetUnstructuredHeader("User-Agent",
+ finalHeaders->SetUnstructuredHeader("X-Mailer",
NS_ConvertUTF8toUTF16(userAgentString));
}