~julienxx/castor9

be3ff72d76d6c529e45d138eca51fb0a3380119e — fulton@fulton.software 3 years ago 6a24e21
From b9f54564d6fee7515b7a4981f2eef6c121bf7e0d
From: Fulton Browne <git@fulton.software>
Date: Fri, 26 Mar 2021 21:23:17 +0000
Subject: [PATCH] Added plumbto gemini listener

With code adapted from phil9's gopher, castor9 can now recive messages from the plumber via plumbto gemini.
1 files changed, 10 insertions(+), 1 deletions(-)

M castor.c
M castor.c => castor.c +10 -1
@@ 801,7 801,8 @@ main(int argc, char *argv[])
{
	Event e;
	Url *url;
	
	enum { Eplumb = 128 };
	Plumbmsg *pm;
	if(argc == 2)
		if(strbeg(argv[1], "gemini://") != 0){
			url = urlparse(nil, smprint("gemini://%s", argv[1]));


@@ 826,8 827,16 @@ main(int argc, char *argv[])
	mkpanels();
	geminiget(url);
	eresized(0);
	eplumb(Eplumb, "gemini");
	for(;;){
		switch(event(&e)){
		case Eplumb:
			pm = e.v;
			if(pm->ndata > 0){
				geminiget(urlparse(nil, pm->data));
			}
			plumbfree(pm);
			break;
		case Ekeyboard:
			switch(e.kbdc){
			default: