about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-10 00:01:35 -0400
committerJune McEnroe <june@causal.agency>2018-08-10 00:01:35 -0400
commit1a9ae050d62dd56f285b59d3952f1dabe186ea9c (patch)
tree407deaabd88b9db6cb1bcc37cc651efe666cc0bf
parentAdd -u option for setting user (diff)
downloadcatgirl-1a9ae050d62dd56f285b59d3952f1dabe186ea9c.tar.gz
catgirl-1a9ae050d62dd56f285b59d3952f1dabe186ea9c.zip
Rename chan to join
In preparation for multi-channel?
-rw-r--r--chat.c4
-rw-r--r--chat.h20
-rw-r--r--handle.c4
-rw-r--r--input.c8
4 files changed, 18 insertions, 18 deletions
diff --git a/chat.c b/chat.c
index 12e4899..41fc3cb 100644
--- a/chat.c
+++ b/chat.c
@@ -63,7 +63,7 @@ int main(int argc, char *argv[]) {
 		switch (opt) {
 			break; case 'W': webirc = optarg;
 			break; case 'h': host = strdup(optarg);
-			break; case 'j': chat.chan = strdup(optarg);
+			break; case 'j': chat.join = strdup(optarg);
 			break; case 'n': chat.nick = strdup(optarg);
 			break; case 'p': port = optarg;
 			break; case 'u': chat.user = strdup(optarg);
@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
 	}
 
 	if (!host) host = prompt("Host: ");
-	if (!chat.chan) chat.chan = prompt("Join: ");
+	if (!chat.join) chat.join = prompt("Join: ");
 	if (!chat.nick) chat.nick = prompt("Name: ");
 	if (!chat.user) chat.user = strdup(chat.nick);
 
diff --git a/chat.h b/chat.h
index af13410..fce1ba2 100644
--- a/chat.h
+++ b/chat.h
@@ -29,18 +29,9 @@ struct {
 	bool verbose;
 	char *nick;
 	char *user;
-	char *chan;
+	char *join;
 } chat;
 
-enum {
-	IRC_BOLD      = 002,
-	IRC_COLOR     = 003,
-	IRC_REVERSE   = 026,
-	IRC_RESET     = 017,
-	IRC_ITALIC    = 035,
-	IRC_UNDERLINE = 037,
-};
-
 int ircConnect(
 	const char *host, const char *port, const char *pass, const char *webPass
 );
@@ -50,6 +41,15 @@ void ircWrite(const char *ptr, size_t len);
 __attribute__((format(printf, 1, 2)))
 void ircFmt(const char *format, ...);
 
+enum {
+	IRC_BOLD      = 002,
+	IRC_COLOR     = 003,
+	IRC_REVERSE   = 026,
+	IRC_RESET     = 017,
+	IRC_ITALIC    = 035,
+	IRC_UNDERLINE = 037,
+};
+
 void uiInit(void);
 void uiHide(void);
 void uiExit(void);
diff --git a/handle.c b/handle.c
index 7971d8d..81a38f7 100644
--- a/handle.c
+++ b/handle.c
@@ -99,7 +99,7 @@ static void handle001(char *prefix, char *params) {
 		free(chat.nick);
 		chat.nick = strdup(nick);
 	}
-	ircFmt("JOIN %s\r\n", chat.chan);
+	ircFmt("JOIN %s\r\n", chat.join);
 }
 
 static void handleJoin(char *prefix, char *params) {
@@ -272,7 +272,7 @@ static void handlePrivmsg(char *prefix, char *params) {
 static void handleNotice(char *prefix, char *params) {
 	char *nick, *user, *chan, *mesg;
 	shift(prefix, &nick, &user, NULL, params, 2, 0, &chan, &mesg);
-	if (strcmp(chan, chat.chan)) return;
+	if (strcmp(chan, chat.join)) return;
 	uiFmt(
 		"\3%d-%s-\3 %s",
 		color(user), nick, mesg
diff --git a/input.c b/input.c
index c342a78..56c38bf 100644
--- a/input.c
+++ b/input.c
@@ -28,7 +28,7 @@ static void privmsg(bool action, const char *mesg) {
 	int send;
 	asprintf(
 		&line, ":%s!%s %nPRIVMSG %s :%s%s%s",
-		chat.nick, chat.user, &send, chat.chan,
+		chat.nick, chat.user, &send, chat.join,
 		(action ? "\1ACTION " : ""), mesg, (action ? "\1" : "")
 	);
 	if (!line) err(EX_OSERR, "asprintf");
@@ -54,14 +54,14 @@ static void inputNick(char *params) {
 
 static void inputWho(char *params) {
 	(void)params;
-	ircFmt("WHO %s\r\n", chat.chan);
+	ircFmt("WHO %s\r\n", chat.join);
 }
 
 static void inputTopic(char *params) {
 	if (params) {
-		ircFmt("TOPIC %s :%s\r\n", chat.chan, params);
+		ircFmt("TOPIC %s :%s\r\n", chat.join, params);
 	} else {
-		ircFmt("TOPIC %s\r\n", chat.chan);
+		ircFmt("TOPIC %s\r\n", chat.join);
 	}
 }