distroquery: better check for is_update in latest packages

This commit is contained in:
Silvan Calarco 2013-10-30 22:59:52 +01:00
parent f15c8bf750
commit 93c410f724

View File

@ -855,6 +855,7 @@ void printSpecialQueryResponse() {
sqlite3_stmt *statement, *stmt1;
struct configTag* ct;
int i,a, id, built_for_arch[ARCHS_MAX], built_for_arch_upstream[ARCHS_MAX];
int is_update;
long buildtime;
char updates[PATH_MAX];
char warning[PATH_MAX];
@ -893,6 +894,7 @@ void printSpecialQueryResponse() {
if (db && (sqlite3_prepare_v2(db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
/* loop packages in repository */
while (sqlite3_step(statement) == SQLITE_ROW) {
is_update = 0;
i=0;
updates[0]=0;
warning[0]=0;
@ -906,6 +908,7 @@ void printSpecialQueryResponse() {
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")));
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
if (sqlite3_step(stmt1) == SQLITE_ROW) {
is_update = 1;
snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)\n", _("Updates"),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
ct->repository[i]->tag,
@ -989,11 +992,10 @@ void printSpecialQueryResponse() {
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
}
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
// 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) {
if (is_update) {
printf("<img src=\"%s/pkgup.png\" title=\"%s\" width=\"14\" height=\"14\">&nbsp;",
ct->configdefaults->url_dir, updates);
} else {