summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2021-07-26 10:41:22 +0100
committerAlastair Poole <netstar@gmail.com>2021-07-26 10:41:22 +0100
commit123edcf9027b0d8f6c030f72e8de2819d06f024e (patch)
treea89055c00f9613043dd927130bab744cd166f5a3
parent008b2717444658146e38397ab074ee13a2e46768 (diff)
client: replay
-rw-r--r--src/bin/client/client.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/bin/client/client.c b/src/bin/client/client.c
index 6880284..784b76d 100644
--- a/src/bin/client/client.c
+++ b/src/bin/client/client.c
@@ -1433,8 +1433,8 @@ path_datestamp(const char *path)
1433 return time_datestamp(st.st_mtime); 1433 return time_datestamp(st.st_mtime);
1434} 1434}
1435 1435
1436Eina_Bool 1436static Eina_List *
1437client_replay(Client *client) 1437client_replay_hours(Client *client)
1438{ 1438{
1439 int hour_last, hours; 1439 int hour_last, hours;
1440 time_t t; 1440 time_t t;
@@ -1443,15 +1443,15 @@ client_replay(Client *client)
1443 Eina_Bool last_is_current = 0; 1443 Eina_Bool last_is_current = 0;
1444 Eina_List *files = NULL; 1444 Eina_List *files = NULL;
1445 1445
1446 if (!client->replay.enabled) return 0; 1446 if (!client->replay.enabled) return NULL;
1447 1447
1448 if (client->replay.start_time >= client->replay.end_time) 1448 if (client->replay.start_time >= client->replay.end_time)
1449 return 0; 1449 return NULL;
1450 1450
1451 t = (time_t) client->replay.start_time; 1451 t = (time_t) client->replay.start_time;
1452 1452
1453 hours = (time_t) (client->replay.end_time - t) / 3600; 1453 hours = (time_t) (client->replay.end_time - t) / 3600;
1454 if (hours > 24) return 0; 1454 if (hours > 24) return NULL;
1455 1455
1456 t = (time_t) client->replay.end_time; 1456 t = (time_t) client->replay.end_time;
1457 tm_out = localtime_r(&t, &tm_buf); 1457 tm_out = localtime_r(&t, &tm_buf);
@@ -1479,7 +1479,11 @@ client_replay(Client *client)
1479 // Rough check 1479 // Rough check
1480 if ((ecore_file_exists(path)) && ((datestamp == today) || (datestamp == yday))) 1480 if ((ecore_file_exists(path)) && ((datestamp == today) || (datestamp == yday)))
1481 files = eina_list_append(files, path); 1481 files = eina_list_append(files, path);
1482 else fprintf(stderr, "cowardly ignoring: %s\n", path); 1482 else
1483 {
1484 fprintf(stderr, "cowardly ignoring: %s\n", path);
1485 free(path);
1486 }
1483 } 1487 }
1484 else 1488 else
1485 { 1489 {
@@ -1492,6 +1496,16 @@ client_replay(Client *client)
1492 } 1496 }
1493 } 1497 }
1494 1498
1499 return files;
1500}
1501
1502Eina_Bool
1503client_replay(Client *client)
1504{
1505 char *path;
1506 Eina_List *files = client_replay_hours(client);
1507 if (!files) return 0;
1508
1495 EINA_LIST_FREE(files, path) 1509 EINA_LIST_FREE(files, path)
1496 { 1510 {
1497 client_reopen(client, path); 1511 client_reopen(client, path);