about summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-04 17:54:46 -0400
committerJune McEnroe <june@causal.agency>2018-08-04 17:54:46 -0400
commit35589a562473e6eab83933e498fbecf5540431d6 (patch)
tree014d092b3b19fb17c18a60c71b6829bd8c6184c8 /irc.c
parentFix chat draw boundaries (diff)
downloadcatgirl-35589a562473e6eab83933e498fbecf5540431d6.tar.gz
catgirl-35589a562473e6eab83933e498fbecf5540431d6.zip
Rename client to irc
Diffstat (limited to '')
-rw-r--r--irc.c (renamed from client.c)20
1 files changed, 10 insertions, 10 deletions
diff --git a/client.c b/irc.c
index 64f14cf..02a9f64 100644
--- a/client.c
+++ b/irc.c
@@ -36,13 +36,13 @@ static void webirc(const char *pass) {
 	int len = strlen(ssh);
 	const char *sp = strchr(ssh, ' ');
 	if (sp) len = sp - ssh;
-	clientFmt(
+	ircFmt(
 		"WEBIRC %s %s %.*s %.*s\r\n",
 		pass, chat.user, len, ssh, len, ssh
 	);
 }
 
-int clientConnect(const char *host, const char *port, const char *webPass) {
+int ircConnect(const char *host, const char *port, const char *webPass) {
 	int error;
 
 	struct tls_config *config = tls_config_new();
@@ -76,13 +76,13 @@ int clientConnect(const char *host, const char *port, const char *webPass) {
 	if (error) err(EX_PROTOCOL, "tls_connect");
 
 	if (webPass) webirc(webPass);
-	clientFmt("NICK %s\r\n", chat.nick);
-	clientFmt("USER %s 0 * :%s\r\n", chat.user, chat.nick);
+	ircFmt("NICK %s\r\n", chat.nick);
+	ircFmt("USER %s 0 * :%s\r\n", chat.user, chat.nick);
 
 	return sock;
 }
 
-void clientWrite(const char *ptr, size_t len) {
+void ircWrite(const char *ptr, size_t len) {
 	while (len) {
 		ssize_t ret = tls_write(client, ptr, len);
 		if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue;
@@ -92,7 +92,7 @@ void clientWrite(const char *ptr, size_t len) {
 	}
 }
 
-void clientFmt(const char *format, ...) {
+void ircFmt(const char *format, ...) {
 	char *buf;
 	va_list ap;
 	va_start(ap, format);
@@ -100,14 +100,14 @@ void clientFmt(const char *format, ...) {
 	va_end(ap);
 	if (!buf) err(EX_OSERR, "vasprintf");
 	if (chat.verbose) uiFmt("<<< %.*s", len - 2, buf);
-	clientWrite(buf, len);
+	ircWrite(buf, len);
 	free(buf);
 }
 
-void clientRead(void) {
-	static char buf[4096];
-	static size_t len;
+static char buf[4096];
+static size_t len;
 
+void ircRead(void) {
 	ssize_t read = tls_read(client, &buf[len], sizeof(buf) - len);
 	if (read < 0) errx(EX_IOERR, "tls_read: %s", tls_error(client));
 	if (!read) {