diff --git a/src/distroquery.c b/src/distroquery.c
index 03b172c..ec74b1c 100644
--- a/src/distroquery.c
+++ b/src/distroquery.c
@@ -817,7 +817,21 @@ void printSpecialQueryResponse() {
sqlite3_stmt *statement, *stmt1;
struct configTag* ct;
int i;
+ long buildtime;
char updates[PATH_MAX];
+ humanDate strdate;
+
+ struct tm *ytm;
+ time_t timesec;
+
+ timesec = time(×ec);
+ ytm = localtime((time_t *) ×ec);
+ ytm->tm_sec = 0;
+ ytm->tm_min = 0;
+ ytm->tm_hour = 0;
+ ytm->tm_mday = 1;
+ ytm->tm_mon = 0;
+ timesec = mktime(ytm);
if (strstr(query, "$latest$") == query) {
repository = query + 8;
@@ -854,13 +868,38 @@ void printSpecialQueryResponse() {
}
i++;
}
+
+ snprintf(sql, PATH_MAX, "SELECT * FROM changelog,packagers "
+ "WHERE id_source=%d AND changelog.id_packager=packagers.id "
+ "ORDER BY changelog.time DESC LIMIT 2",
+ sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
+ if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
+ snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n\n%s", _("Latest changes:"));
+ while (sqlite3_step(stmt1) == SQLITE_ROW) {
+ snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s - %s (%s)\n%s",
+ (char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
+ (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")),
+ (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
+ (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
+ }
+// strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates));
+ }
+
get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
if (updates[0] != 0) {
printf(" ", updates);
} else {
printf(" ");
}
- printf(" ", buffer);
+
+ buildtime = sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime"));
+ if (buildtime < timesec) {
+ simpleTimeToTemplate(buildtime,"%Y/%m/%d",&strdate);
+ } else {
+ simpleTimeToTemplate(buildtime,"%m/%d",&strdate);
+ }
+
+ printf("%s ", strdate, buffer);
printf(""
"%s %s-%s
",