shithub: wired

Download patch

ref: c0172717d6d97c793847defd61d0fa8bf78f2fa3
parent: 789c8e5cafff824fa80f2496b501e6c359c86fe6
author: james palmer <foura@biobuf.link>
date: Mon Jun 7 18:30:42 EDT 2021

add control-d to send the message. strip trailing control-d and newlines.

--- a/main.c
+++ b/main.c
@@ -57,6 +57,11 @@
 				sendp(ctl, "act");
 				
 			break;
+		case 'I':
+			if(strcmp(ev.text, "") == 0)
+				sendp(ctl, "send");
+				
+			break;
 		}
 	}	
 }
@@ -66,10 +71,18 @@
 {
 	Biobuf *fd;
 	char *buf;
+	int i;
 	
 	fd = awinfsbopen(w, "body", OREAD);
 	buf = Brdstr(fd, '\0', 0);
 	Bterm(fd);
+	
+	for(i = strlen(buf)-1; i > 0; i--) {
+		if(buf[i] == '' || buf[i] == '\n')
+			buf[i] = '\0';
+		else
+			break;
+	}
 	
 	awinclear(w);