summaryrefslogtreecommitdiffstats
path: root/load-git.c
diff options
context:
space:
mode:
authorGravatar Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>2014-04-11 11:47:35 +0530
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-14 09:40:30 -0700
commit3abcde9a2abade0ce576976b6dce869e8aa28601 (patch)
tree883ee747d3fd09c0359976b667ee8da5954b73cd /load-git.c
parentad9eb73d73b0200150d34807616ebcc8dd2a4b4f (diff)
downloadsubsurface-3abcde9a2abade0ce576976b6dce869e8aa28601.tar.gz
Add option to save userid in data files
The userid of Subsurface Webservice can be included in locally saved xml files and git repository. For xml files, it is stored in userid tag. For git repo, it is stored in 00-Subsurface file present in the repo. Preference dialog and webservice dialog modified to include option for saving userid locally. In case of difference in default userid and userid in local file, some semantics are followed. These can be referred to here: http://lists.hohndel.org/pipermail/subsurface/2014-April/011422.html Fixes #473 Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'load-git.c')
-rw-r--r--load-git.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/load-git.c b/load-git.c
index 4040c1677..f4467d178 100644
--- a/load-git.c
+++ b/load-git.c
@@ -572,6 +572,14 @@ static void parse_trip_notes(char *line, struct membuffer *str, void *_trip)
static void parse_settings_autogroup(char *line, struct membuffer *str, void *_unused)
{ set_autogroup(1); }
+static void parse_settings_userid(char *line, struct membuffer *str, void *_unused)
+{
+ if (line) {
+ set_save_userid_local(true);
+ set_userid(line);
+ }
+}
+
/*
* Our versioning is a joke right now, but this is more of an example of what we
* *can* do some day. And if we do change the version, this warning will show if
@@ -700,7 +708,7 @@ static void trip_parser(char *line, struct membuffer *str, void *_trip)
static struct keyword_action settings_action[] = {
#undef D
#define D(x) { #x, parse_settings_ ## x }
- D(autogroup), D(divecomputerid), D(subsurface), D(version),
+ D(autogroup), D(divecomputerid), D(subsurface), D(userid), D(version),
};
static void settings_parser(char *line, struct membuffer *str, void *_unused)
@@ -1158,6 +1166,8 @@ static int parse_settings_entry(git_repository *repo, const git_tree_entry *entr
git_blob *blob = git_tree_entry_blob(repo, entry);
if (!blob)
return report_error("Unable to read settings file");
+ set_save_userid_local(false);
+ set_userid("");
for_each_line(blob, settings_parser, NULL);
git_blob_free(blob);
return 0;