From c5f81f1139c33eccc59146d45893c8037d63e94f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 8 Feb 2006 03:20:03 +0000 Subject: Add support for last seen information --- hcid/storage.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'hcid/storage.c') diff --git a/hcid/storage.c b/hcid/storage.c index 02c5dc0c..063b6952 100644 --- a/hcid/storage.c +++ b/hcid/storage.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,22 @@ int write_features_info(bdaddr_t *local, bdaddr_t *peer, unsigned char *features return textfile_put(filename, addr, str); } +int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) +{ + char filename[PATH_MAX + 1], addr[18], str[24]; + + memset(str, 0, sizeof(str)); + strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", tm); + + ba2str(local, addr); + snprintf(filename, PATH_MAX, "%s/%s/lastseen", STORAGEDIR, addr); + + create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + + ba2str(peer, addr); + return textfile_put(filename, addr, str); +} + int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, int type) { char filename[PATH_MAX + 1], addr[18], str[35]; -- cgit