summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--catgirl.17
-rw-r--r--chat.c3
-rw-r--r--chat.h1
-rw-r--r--handle.c6
4 files changed, 15 insertions, 2 deletions
diff --git a/catgirl.1 b/catgirl.1
index 4d8176f..93ed604 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -13,6 +13,7 @@
 .Op Fl a Ar auth
 .Op Fl h Ar host
 .Op Fl j Ar chan
+.Op Fl k Ar keys
 .Op Fl l Ar path
 .Op Fl n Ar nick
 .Op Fl p Ar port
@@ -58,6 +59,12 @@ after connecting.
 .Ar chan
 may be a comma-separated list.
 .
+.It Fl k Ar keys
+Set keys for channels in
+.Fl j .
+.Ar keys
+may be a comma-separated list.
+.
 .It Fl l Ar path
 Log messages to
 subdirectories of
diff --git a/chat.c b/chat.c
index 2ec20bd..a9677cf 100644
--- a/chat.c
+++ b/chat.c
@@ -53,13 +53,14 @@ int main(int argc, char *argv[]) {
 	setlocale(LC_CTYPE, "");
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "NW:a:h:j:l:n:p:r:u:vw:"))) {
+	while (0 < (opt = getopt(argc, argv, "NW:a:h:j:k:l:n:p:r:u:vw:"))) {
 		switch (opt) {
 			break; case 'N': self.notify = true;
 			break; case 'W': self.webp = dupe(optarg);
 			break; case 'a': self.auth = dupe(optarg);
 			break; case 'h': self.host = dupe(optarg);
 			break; case 'j': self.join = dupe(optarg);
+			break; case 'k': self.keys = dupe(optarg);
 			break; case 'l': logOpen(optarg);
 			break; case 'n': self.nick = dupe(optarg);
 			break; case 'p': self.port = dupe(optarg);
diff --git a/chat.h b/chat.h
index a3ce3f9..71a96ff 100644
--- a/chat.h
+++ b/chat.h
@@ -43,6 +43,7 @@ struct {
 	char *user;
 	char *real;
 	char *join;
+	char *keys;
 	bool raw;
 	bool notify;
 	bool quit;
diff --git a/handle.c b/handle.c
index a46c149..4f9015c 100644
--- a/handle.c
+++ b/handle.c
@@ -138,7 +138,11 @@ static void handleReplyWelcome(char *prefix, char *params) {
 		self.nick = strdup(nick);
 		if (!self.nick) err(EX_OSERR, "strdup");
 	}
-	if (self.join) ircFmt("JOIN %s\r\n", self.join);
+	if (self.join && self.keys) {
+		ircFmt("JOIN %s %s\r\n", self.join, self.keys);
+	} else if (self.join) {
+		ircFmt("JOIN %s\r\n", self.join);
+	}
 	tabTouch(TagStatus, self.nick);
 
 	uiLog(TagStatus, UICold, L"You have arrived");
title='2018-08-07 00:12:08 -0400'>2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe This is so embarrassing. It only started crashing once it had strings that were long enough, and then it took me so long to notice this mistake. I was worried I was still doing va_list wrong somehow. 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe vaswprintf is a nightmare. 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe This is actually possible with use_default_colors! 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe Fall back to using bold if there are only 8 colors. This also allowed bright background colors in 16-color terminals. I must port this system to torus. I'll be able to remove the awful termcap patch hack. 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe Oh boy that's embarrassing. 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe Don't really have a way to implement the M-* keys, and currently missing C-w. 2018-08-04Handle /topicJune McEnroe