summaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/qthelper.cpp11
-rw-r--r--subsurface-core/qthelperfromc.h1
-rw-r--r--subsurface-core/save-git.c2
-rw-r--r--subsurface-core/version.c5
-rw-r--r--subsurface-core/version.h1
5 files changed, 11 insertions, 9 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index a840f4dd2..d55e8438f 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -791,9 +791,9 @@ QString getUserAgent()
// fill in the system data - use ':' as separator
// replace all other ':' with ' ' so that this is easy to parse
#ifdef SUBSURFACE_MOBILE
- QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_canonical_version());
#else
- QString userAgent = QString("Subsurface:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface:%1:").arg(subsurface_canonical_version());
#endif
userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":");
arch = SubsurfaceSysInfo::buildCpuArchitecture().replace(':', ' ');
@@ -805,6 +805,13 @@ QString getUserAgent()
}
+extern "C" const char *subsurface_user_agent()
+{
+ static QString uA = getUserAgent();
+
+ return strdup(qPrintable(uA));
+}
+
QString uiLanguage(QLocale *callerLoc)
{
QString shortDateFormat;
diff --git a/subsurface-core/qthelperfromc.h b/subsurface-core/qthelperfromc.h
index d2e80144c..32aed8949 100644
--- a/subsurface-core/qthelperfromc.h
+++ b/subsurface-core/qthelperfromc.h
@@ -17,5 +17,6 @@ void cache_picture(struct picture *picture);
char *cloud_url();
char *hashfile_name_string();
char *picturedir_string();
+const char *subsurface_user_agent();
#endif // QTHELPERFROMC_H
diff --git a/subsurface-core/save-git.c b/subsurface-core/save-git.c
index 9bdf9dfd0..310882606 100644
--- a/subsurface-core/save-git.c
+++ b/subsurface-core/save-git.c
@@ -1047,7 +1047,7 @@ static void create_commit_message(struct membuffer *msg)
} while ((dc = dc->next) != NULL);
put_format(msg, "\n");
}
- put_format(msg, "Created by subsurface %s\n", subsurface_version());
+ put_format(msg, "Created by subsurface %s\n", subsurface_user_agent());
}
static int create_new_commit(git_repository *repo, const char *remote, const char *branch, git_oid *tree_id)
diff --git a/subsurface-core/version.c b/subsurface-core/version.c
index 5b54bf4c7..98207efe2 100644
--- a/subsurface-core/version.c
+++ b/subsurface-core/version.c
@@ -1,10 +1,5 @@
#include "ssrf-version.h"
-const char *subsurface_version(void)
-{
- return VERSION_STRING;
-}
-
const char *subsurface_git_version(void)
{
return GIT_VERSION_STRING;
diff --git a/subsurface-core/version.h b/subsurface-core/version.h
index bc0aac00d..98385e970 100644
--- a/subsurface-core/version.h
+++ b/subsurface-core/version.h
@@ -5,7 +5,6 @@
extern "C" {
#endif
-const char *subsurface_version(void);
const char *subsurface_git_version(void);
const char *subsurface_canonical_version(void);