functions: use g.eftv.co service to display favicons

This commit is contained in:
Silvan Calarco 2013-10-16 13:43:07 +02:00
parent 9ca0fcb65a
commit 7d2a532478

View File

@ -627,26 +627,25 @@ int scansdir(const char *dir, struct dirent ***namelist,
return(i);
}
#define favicon_url_prefix "http://g.etfv.co/"
int
get_favicon_from_url(const char* url,char *buf,int bufsize) {
int i=0,l=0;
strncpy(buf, favicon_url_prefix, bufsize);
/* expecting urls in the form http://address/... */
if (url) {
while ((i<bufsize) && url[i]) {
buf[i]=url[i];
if (buf[i] == '/') {
if (url[i] == '/') {
l++;
if (l == 3) break;
}
i++;
}
buf[i]='\0';
} else {
/* use current site as default icon */
buf[0]='\0';
}
strcat(buf,"/favicon.ico");
strncpy(&buf[strlen(buf)], url, i);
return 0;
}