printpkgicon: print the last two changelog entries and rework function to optimize code

This commit is contained in:
Silvan Calarco 2012-05-17 12:12:45 +02:00
parent 222691ea78
commit 4d081e2ee6
2 changed files with 35 additions and 31 deletions

View File

@ -1,4 +1 @@
VERSION = 1.2 VERSION = 1.2.1

View File

@ -152,37 +152,44 @@ void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceLi
char buffer[PATH_MAX]; char buffer[PATH_MAX];
char strdate[16]; char strdate[16];
if (s->updrepository >= 0) {
fprintf(fout,
"<img src=\"%s/pkgup.png\" ",
configtag->configdefaults->url_dir);
} else {
fprintf(fout,
"<img src=\"%s/pkg.png\" ",
configtag->configdefaults->url_dir);
}
if (s->changelog) { if (s->changelog) {
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate); simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
if (s->updrepository >= 0) { fprintf(fout,
fprintf(fout, "title=\"%s - %s (%s)\n%s",
"<img src=\"%s/pkgup.png\" title=\"%s - %s (%s)\n%s\n\nUpdates package in %s\">", strdate,
configtag->configdefaults->url_dir, s->changelog->pkg->name,
strdate, s->changelog->release,
s->changelog->pkg->name, htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
s->changelog->release, if (s->changelog->next) {
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX), simpleTimeToHuman(s->changelog->next->time, (humanDate *) & strdate);
configtag->repository[s->updrepository]->tag); fprintf(fout,
} else { "\n%s - %s (%s)\n%s",
fprintf(fout, strdate,
"<img src=\"%s/pkg.png\" title=\"%s - %s (%s)\n%s\">", s->changelog->next->pkg->name,
configtag->configdefaults->url_dir, s->changelog->next->release,
strdate, htmlcleanNoBr(s->changelog->next->text,buffer,PATH_MAX));
s->changelog->pkg->name,
s->changelog->release,
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
} }
} else { } else {
if (s->updrepository >= 0) { fprintf(fout,
fprintf(fout, "title=\"WARNING: missing changelog");
"<img src=\"%s/pkgup.png\" title=\"WARNING: missing changelog\n\nUpdates package in %s\">", }
configtag->configdefaults->url_dir,
configtag->repository[s->updrepository]->tag); if (s->updrepository >= 0) {
} else { fprintf(fout,
fprintf(fout, "\n\nUpdates package in %s\">",
"<img src=\"%s/pkg.png\" title=\"WARNING: missing changelog\">", configtag->repository[s->updrepository]->tag);
configtag->configdefaults->url_dir); } else {
} fprintf(fout, "\">");
} }
} }