Exemplo n.º 1
0
int
rdfRetrievalType (RDFFile f)
{
	URL_Struct		*urls;
	char			*url;
	int			type;

	url = f->url;
	if (f->localp)
	{
		urls = NET_CreateURLStruct(url,  NET_CACHE_ONLY_RELOAD);
		if ((urls != NULL) && (NET_IsURLInDiskCache(urls) || NET_IsURLInMemCache(urls)))
		{
			type = NET_DONT_RELOAD;
		}
		else
		{
			type = NET_DONT_RELOAD;
		}
		if (urls != NULL)	NET_FreeURLStruct(urls);
	}
	else
	{
		type = NET_DONT_RELOAD;
	}
	return(type);
}
Exemplo n.º 2
0
int
rdf_GetURL (MWContext *cx, int method, Net_GetUrlExitFunc *exit_routine, RDFFile rdfFile)
{
	MozillaEvent_rdf_GetURL		*event;
	URL_Struct      		*urls = NULL;
        char				*url;

#ifdef DEBUG_gagan
        return 0;
#endif

    if (cx == NULL)  return 0;
        if (rdfFile->refreshingp && rdfFile->updateURL) {
          url = rdfFile->updateURL;
        } else {
          url = rdfFile->url;
        }
        if (strcmp(url, gNavCntrUrl) == 0) {
          urls = NET_CreateURLStruct(url,  NET_CACHE_ONLY_RELOAD);
#ifdef NU_CACHE
          if (!CacheManager_Contains(url)) {
#else
          if (NET_IsURLInDiskCache(urls) || NET_IsURLInMemCache(urls)) {
          } else {
#endif
            NET_FreeURLStruct(urls);
            urls = NULL;
          }
        }
	if (!urls) 
          urls = NET_CreateURLStruct(url, (rdfFile->refreshingp ? 
                                           NET_SUPER_RELOAD : NET_NORMAL_RELOAD));
	if (urls == NULL) return 0;
	urls->fe_data = rdfFile;
	if (method) urls->method = method;

	if (PR_CurrentThread() == mozilla_thread)
	{
		htLoadBegins(urls, url);
		NET_GetURL(urls, FO_CACHE_AND_RDF, cx, rdf_GetUrlExitFunc);
	}
	else
	{
		/* send event to Mozilla thread */
		
		if (mozilla_event_queue == NULL)	return(0);
		event = PR_NEW(MozillaEvent_rdf_GetURL);
		if (event == NULL)	return(0);
		PR_InitEvent(&(event->ce.event), cx,
			(PRHandleEventProc)rdf_HandleEvent_GetURL,
			(PRDestroyEventProc)rdf_DisposeEvent_GetURL);
		event->url = copyString(url);
		event->urls = urls;
		event->method = FO_CACHE_AND_RDF;
		event->cx = cx;
		event->exitFunc = rdf_GetUrlExitFunc;
		PR_PostEvent(mozilla_event_queue, &(event->ce.event));
	}
	return 1;
}
#endif /* MOZILLA_CLIENT */



void
possiblyRereadRDFFiles (void* data)
{
	possiblyRefreshRDFFiles();
/*	timerID = FE_SetTimeout(possiblyRereadRDFFiles, NULL, 1000 * 60 * 10); 
	once every 10 minutes
	diabled for legal reasons.*/
}



void
RDFglueInitialize()
{
#ifdef MOZILLA_CLIENT

	timerID = FE_SetTimeout(possiblyRereadRDFFiles, NULL, 1000 * 60 * 10); /* once every 10 minutes */
	if (gRLForbiddenDomains != NULL)
	{
		freeMem(gRLForbiddenDomains);
		gRLForbiddenDomains = NULL;
	}
	if (PREF_CopyCharPref("browser.relatedLinksDisabledForDomains", &gRLForbiddenDomains) != PREF_OK)
	{
		gRLForbiddenDomains = NULL;
	}

#endif /* MOZILLA_CLIENT */
}