~julienxx/castor9

fb52dfe4197457eb5eb4134dece22ad42752f31e — Julien Blanchard 3 years ago 1e9ebfb
Add some comments before refact
1 files changed, 8 insertions(+), 3 deletions(-)

M castor.c
M castor.c => castor.c +8 -3
@@ 602,19 602,24 @@ texthit(Panel *p, int b, Rtext *rt)
	if(link==nil)
		return;

	if(strbeg(link, "gemini://") == 0){
	if(strbeg(link, "gemini://") == 0){							/* gemini absolute */
		next_url = urlparse(nil, link);
	}else if(strbeg(link, "//") == 0){
	}else if(strstr(link, "://") != 0){							/* other protocol absolute */
		next_url = urlparse(nil, link);
	}else if(strbeg(link, "//") == 0){							/* schemeless so gemini */
		next_url = urlparse(nil, smprint("gemini:%s", link));
	}else if(strbeg(link, "mailto:") == 0){
	}else if(strbeg(link, "mailto:") == 0){						/* mailto: */
		next_url = urlparse(nil, link);
	}else{
		/* assuming relative URL */
		if(strcmp(link, "/") == 0){
			/* no slash, must be a hostname */
			n = smprint("gemini://%s", current_base_url->host);
		}else if(*link == '/'){
			/* start with a slash so skip it (+1) */
			n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link)+1);
		}else{
			/* make an absolute URL of the link */
			n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link));
		}
		next_url = urlparse(nil, n);