void rdf_complete(NET_StreamClass *stream) { RDFFile f = (RDFFile)stream->data_object; if (strcmp(f->url, gNavCntrUrl) == 0) { if (f->resourceCount == 0) { parseNextRDFXMLBlob(stream, gDefaultNavcntr, strlen(gDefaultNavcntr)); } else { RDF_Resource browser = RDF_GetResource(NULL, "netscape:browser", 1); RDF_Resource updateID = RDF_GetResource(NULL, "updateID", 1); char* id = RDF_GetSlotValue(gNCDB, browser, updateID, RDF_STRING_TYPE, false, true); RDF_Resource updateFrom = RDF_GetResource(NULL, "updateURL", 1); char* uf = RDF_GetSlotValue(gNCDB, browser, updateFrom, RDF_STRING_TYPE, false, true); RDF_Resource fileSize = RDF_GetResource(NULL, "fileSize", 1); char* fs = RDF_GetSlotValue(gNCDB, browser, fileSize, RDF_STRING_TYPE, false, true); uint32 fSize; if (fs == NULL) { fSize = 3000; } else { sscanf("%lu", fs, &fSize); freeMem(fs); } if ((uf != NULL) && (id != NULL)) { #ifdef MOZ_SMARTUPDATE AutoUpdateConnnection autoupdt; autoupdt = AutoUpdate_Setup(FE_GetRDFContext(), id, uf, fSize, "http://warp/u/raman/docs/js/download.html"); autoupdate_Resume(autoupdt); #endif /* MOZ_SMARTUPDATE */ freeMem(uf); freeMem(id); } /* A temporary hack to demo AutoUpdate on windows */ #ifndef MOZ_SMARTUPDATE #ifndef XP_MAC /* { AutoUpdate_LoadMainScript(FE_GetRDFContext(), "http://warp/u/raman/docs/js/download.html"); } */ #endif /* !XP_MAC */ #endif /* MOZ_SMARTUPDATE */ } } if (f) { freeMem(f->line); freeMem(f->currentSlot); freeMem(f->holdOver); freeNamespaces(f) ; f->line = NULL; f->currentSlot = NULL; f->holdOver = NULL; } }
RDF_GetResourceName(RDF rdf, RDF_Resource node) { char* name = RDF_GetSlotValue(rdf, node, gCoreVocab->RDF_name, RDF_STRING_TYPE, false, true); if (name != NULL) return name; return makeResourceName(node); }
char * resourceDescription (RDF rdf, RDF_Resource r) { return (char*)RDF_GetSlotValue(rdf, r, gWebData->RDF_description, RDF_STRING_TYPE, false, true); }
char * resourceLastVisitDate (RDF rdf, RDF_Resource r) { return (char*)RDF_GetSlotValue(rdf, r, gWebData->RDF_lastVisitDate, RDF_STRING_TYPE, false, true); }
void HT_WriteOutAsBookmarks1 (RDF rdf, PRFileDesc *fp, RDF_Resource u, RDF_Resource top, int indent) { RDF_Cursor c = RDF_GetSources(rdf, u, gCoreVocab->RDF_parent, RDF_RESOURCE_TYPE, true); RDF_Resource next; char *date, *name, *url; int loop; if (c == NULL) return; if (u == top) { name = RDF_GetResourceName(rdf, u); ht_rjcprintf(fp, "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n", NULL); ht_rjcprintf(fp, "<!-- This is an automatically generated file.\n", NULL); ht_rjcprintf(fp, "It will be read and overwritten.\n", NULL); ht_rjcprintf(fp, "Do Not Edit! -->\n", NULL); ht_rjcprintf(fp, "<TITLE>%s</TITLE>\n", (name) ? name:""); ht_rjcprintf(fp, "<H1>%s</H1>\n<DL><p>\n", (name) ? name:""); } while (next = RDF_NextValue(c)) { url = resourceID(next); if (containerp(next) && (!startsWith("ftp:",url)) && (!startsWith("file:",url)) && (!startsWith("IMAP:", url)) && (!startsWith("nes:", url)) && (!startsWith("mail:", url)) && (!startsWith("cache:", url)) && (!startsWith("ldap:", url))) { for (loop=0; loop<indent; loop++) ht_rjcprintf(fp, " ", NULL); date = numericDate(resourceID(next)); ht_rjcprintf(fp, "<DT><H3 ADD_DATE=\"%s\">", (date) ? date:""); if (date) freeMem(date); name = RDF_GetResourceName(rdf, next); ht_rjcprintf(fp, "%s</H3>\n", name); for (loop=0; loop<indent; loop++) ht_rjcprintf(fp, " ", NULL); ht_rjcprintf(fp, "<DL><p>\n", NULL); HT_WriteOutAsBookmarks1(rdf, fp, next, top, indent+1); for (loop=0; loop<indent; loop++) ht_rjcprintf(fp, " ", NULL); ht_rjcprintf(fp, "</DL><p>\n", NULL); } else if (isSeparator(next)) { for (loop=0; loop<indent; loop++) ht_rjcprintf(fp, " ", NULL); ht_rjcprintf(fp, "<HR>\n", NULL); } else { char* bkAddDate = (char*)RDF_GetSlotValue(rdf, next, gNavCenter->RDF_bookmarkAddDate, RDF_STRING_TYPE, false, true); for (loop=0; loop<indent; loop++) ht_rjcprintf(fp, " ", NULL); ht_rjcprintf(fp, "<DT><A HREF=\"%s\" ", resourceID(next)); date = numericDate(bkAddDate); ht_rjcprintf(fp, "ADD_DATE=\"%s\" ", (date) ? date: ""); if (date) freeMem(date); ht_rjcprintf(fp, "LAST_VISIT=\"%s\" ", resourceLastVisitDate(rdf, next)); ht_rjcprintf(fp, "LAST_MODIFIED=\"%s\">", resourceLastModifiedDate(rdf, next)); ht_rjcprintf(fp, "%s</A>\n", RDF_GetResourceName(rdf, next)); if (resourceDescription(rdf, next) != NULL) { ht_rjcprintf(fp, "<DD>%s\n", resourceDescription(rdf, next)); } } } RDF_DisposeCursor(c); if (u == top) { ht_rjcprintf(fp, "</DL>\n", NULL); } }