version 1.79, 1998/11/07 19:00:45
|
version 1.80, 1999/01/06 15:38:48
|
Line 37 PRIVATE HTErrorMessage HTErrors[HTERR_EL
|
Line 37 PRIVATE HTErrorMessage HTErrors[HTERR_EL
|
*/ |
*/ |
PRIVATE HTComparer HitSort, FormatSort, LastModifiedSort, TitleSort; |
PRIVATE HTComparer HitSort, FormatSort, LastModifiedSort, TitleSort; |
|
|
PUBLIC HText * HTMainText = NULL; |
/* |
PUBLIC HTParentAnchor * HTMainAnchor = NULL; |
** Ths callbacks that we need from the libwww HTML parser |
PUBLIC HTStyleSheet * styleSheet = NULL; |
*/ |
|
PRIVATE HText_new RHText_new; |
|
PRIVATE HText_delete RHText_delete; |
|
PRIVATE HText_foundLink RHText_foundLink; |
|
|
/* ------------------------------------------------------------------------- */ |
/* ------------------------------------------------------------------------- */ |
|
|
Line 648 PRIVATE BOOL Robot_delete (Robot * mr)
|
Line 651 PRIVATE BOOL Robot_delete (Robot * mr)
|
HTList * cur = mr->htext; |
HTList * cur = mr->htext; |
HText * pres; |
HText * pres; |
while ((pres = (HText *) HTList_nextObject(cur))) |
while ((pres = (HText *) HTList_nextObject(cur))) |
HText_free(pres); |
RHText_delete(pres); |
HTList_delete(mr->htext); |
HTList_delete(mr->htext); |
} |
} |
|
|
Line 1051 PUBLIC void Serving_queue(Robot *mr)
|
Line 1054 PUBLIC void Serving_queue(Robot *mr)
|
/* HTEXT INTERFACE */ |
/* HTEXT INTERFACE */ |
/* ------------------------------------------------------------------------- */ |
/* ------------------------------------------------------------------------- */ |
|
|
PUBLIC HText * HText_new2 (HTRequest * request, HTParentAnchor * anchor, |
PUBLIC BOOL Robot_registerHTMLParser (void) |
HTStream * stream) |
{ |
|
HText_registerCDCallback(RHText_new, RHText_delete); |
|
HText_registerLinkCallback(RHText_foundLink); |
|
return YES; |
|
} |
|
|
|
PRIVATE HText * RHText_new (HTRequest * request, HTParentAnchor * anchor, |
|
HTStream * stream) |
{ |
{ |
HText * me; |
HText * me; |
Finger * finger = (Finger *) HTRequest_context(request); |
Finger * finger = (Finger *) HTRequest_context(request); |
Line 1088 PUBLIC HText * HText_new2 (HTRequest * r
|
Line 1098 PUBLIC HText * HText_new2 (HTRequest * r
|
return me; |
return me; |
} |
} |
|
|
PUBLIC void HText_free (HText * me) { |
PRIVATE BOOL RHText_delete (HText * me) { |
if (me) HT_FREE (me); |
if (me) HT_FREE (me); |
} |
} |
|
|
PUBLIC void HText_beginAnchor (HText * text, HTChildAnchor * anchor) |
PRIVATE void RHText_foundAnchor (HText * text, HTChildAnchor * anchor) |
{ |
{ |
if (text && anchor) { |
if (text && anchor) { |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Line 1219 PUBLIC void HText_beginAnchor (HText * t
|
Line 1229 PUBLIC void HText_beginAnchor (HText * t
|
} |
} |
} |
} |
|
|
PUBLIC void HText_appendImage (HText * text, HTChildAnchor * anchor, |
PRIVATE void RHText_foundImage (HText * text, HTChildAnchor * anchor, |
const char *alt, const char * align, BOOL isMap) |
const char *alt, const char * align, BOOL isMap) |
{ |
{ |
if (text && anchor) { |
if (text && anchor) { |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Line 1321 PUBLIC void HText_appendImage (HText * t
|
Line 1331 PUBLIC void HText_appendImage (HText * t
|
} |
} |
} |
} |
|
|
PUBLIC void HText_appendLink (HText * text, HTChildAnchor * anchor, |
PRIVATE void RHText_foundLink (HText * text, |
const BOOL * present, const char ** value) |
int element_number, int attribute_number, |
|
HTChildAnchor * anchor, |
|
const BOOL * present, const char ** value) |
{ |
{ |
if (text && anchor) { |
if (text && anchor) { |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Finger * finger = (Finger *) HTRequest_context(text->request); |
Robot * mr = finger->robot; |
Robot * mr = finger->robot; |
if (SHOW_QUIET(mr)) |
if (SHOW_QUIET(mr)) |
HTTrace("Robot....... Received Link element with anchor %p\n", anchor); |
HTTrace("Robot....... Received element %d, attribute %d with anchor %p\n", |
HText_beginAnchor(text, anchor); |
element_number, attribute_number, anchor); |
|
if ((element_number==HTML_IMG && attribute_number==HTML_IMG_SRC) || |
|
(element_number==HTML_BODY && attribute_number==HTML_BODY_BACKGROUND)) |
|
RHText_foundImage(text, anchor, NULL, NULL, NO); |
|
else |
|
RHText_foundAnchor(text, anchor); |
} |
} |
} |
} |
|
|
PUBLIC void HText_appendObject (HText * text, int element_number, |
PUBLIC char * get_robots_txt(char * uri) |
const BOOL * present, const char ** value) |
|
{ |
|
/* Here we can look for frames, link tags, meta tags etc. */ |
|
if (text && text->request) { |
|
Finger * finger = (Finger *) HTRequest_context(text->request); |
|
Robot * mr = finger->robot; |
|
|
|
if (SHOW_QUIET(mr)) |
|
HTTrace("Robot....... HText Object %p called with HTML element number %d\n", |
|
text, element_number); |
|
|
|
switch (element_number) { |
|
|
|
case HTML_FRAME: |
|
{ |
|
HTChildAnchor * source = HTAnchor_findChildAndLink( |
|
HTRequest_anchor(text->request), /* Parent */ |
|
NULL, /* Tag */ |
|
present[HTML_FRAME_SRC] ? value[HTML_FRAME_SRC] : NULL, /* Addresss */ |
|
NULL); /* Rels */ |
|
HText_beginAnchor(text, source); |
|
} |
|
break; |
|
|
|
case HTML_BODY: |
|
{ |
|
HTChildAnchor * source = HTAnchor_findChildAndLink( |
|
HTRequest_anchor(text->request), /* Parent */ |
|
NULL, /* Tag */ |
|
present[HTML_BODY_BACKGROUND] ? value[HTML_BODY_BACKGROUND] : NULL, /* Addresss */ |
|
NULL); /* Rels */ |
|
HText_appendImage(text, source, NULL, NULL, NO); |
|
} |
|
break; |
|
|
|
default: |
|
break; |
|
} |
|
} |
|
} |
|
|
|
PUBLIC void HText_endAnchor (HText * text) {} |
|
PUBLIC void HText_appendText (HText * text, const char * str) {} |
|
PUBLIC void HText_appendCharacter (HText * text, char ch) {} |
|
PUBLIC void HText_endAppend (HText * text) {} |
|
PUBLIC void HText_setStyle (HText * text, HTStyle * style) {} |
|
PUBLIC void HText_beginAppend (HText * text) {} |
|
PUBLIC void HText_appendParagraph (HText * text) {} |
|
|
|
|
|
PUBLIC char * |
|
get_robots_txt(char *uri) |
|
{ |
{ |
char *str = NULL; |
char *str = NULL; |
HTChunk * chunk; |
HTChunk * chunk; |