about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--catgirl.17
-rw-r--r--chat.h2
-rw-r--r--handle.c18
3 files changed, 26 insertions, 1 deletions
diff --git a/catgirl.1 b/catgirl.1
index 138b982..ad820ac 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -560,6 +560,13 @@ join = #ascii.town
 .Re
 .It
 .Rs
+.%A Christine Dodrill
+.%T IRCv3.2 chghost Extension
+.%I IRCv3 Working Group
+.%U https://ircv3.net/specs/extensions/chghost-3.2
+.Re
+.It
+.Rs
 .%A Daniel Oaks
 .%T IRC Formatting
 .%I ircdocs
diff --git a/chat.h b/chat.h
index 91d175f..468d864 100644
--- a/chat.h
+++ b/chat.h
@@ -97,6 +97,7 @@ extern struct Network {
 
 #define ENUM_CAP \
 	X("causal.agency/consumer", CapConsumer) \
+	X("chghost", CapChghost) \
 	X("extended-join", CapExtendedJoin) \
 	X("invite-notify", CapInviteNotify) \
 	X("multi-prefix", CapMultiPrefix) \
@@ -119,6 +120,7 @@ extern struct Self {
 	char *join;
 	char *nick;
 	char *user;
+	char *host;
 	enum Color color;
 	char *quit;
 } self;
diff --git a/handle.c b/handle.c
index fa3f36b..f079c00 100644
--- a/handle.c
+++ b/handle.c
@@ -280,10 +280,13 @@ static void handleJoin(struct Message *msg) {
 	require(msg, true, 1);
 	uint id = idFor(msg->params[0]);
 	if (!strcmp(msg->nick, self.nick)) {
-		if (!self.user) {
+		if (!self.user || strcmp(self.user, msg->user)) {
 			set(&self.user, msg->user);
 			self.color = hash(msg->user);
 		}
+		if (!self.host || strcmp(self.host, msg->host)) {
+			set(&self.host, msg->host);
+		}
 		idColors[id] = hash(msg->params[0]);
 		completeTouch(None, msg->params[0], idColors[id]);
 		if (replies.join) {
@@ -306,6 +309,18 @@ static void handleJoin(struct Message *msg) {
 	);
 }
 
+static void handleChghost(struct Message *msg) {
+	require(msg, true, 2);
+	if (strcmp(msg->nick, self.nick)) return;
+	if (!self.user || strcmp(self.user, msg->params[0])) {
+		set(&self.user, msg->params[0]);
+		self.color = hash(msg->params[0]);
+	}
+	if (!self.host || strcmp(self.host, msg->params[1])) {
+		set(&self.host, msg->params[1]);
+	}
+}
+
 static void handlePart(struct Message *msg) {
 	require(msg, true, 1);
 	uint id = idFor(msg->params[0]);
@@ -1076,6 +1091,7 @@ static const struct Handler {
 	{ "906", handleErrorSASLFail },
 	{ "AUTHENTICATE", handleAuthenticate },
 	{ "CAP", handleCap },
+	{ "CHGHOST", handleChghost },
 	{ "ERROR", handleError },
 	{ "INVITE", handleInvite },
 	{ "JOIN", handleJoin },
'>2019-02-18Match whitespace between * [] {}June McEnroe 2019-02-18Fix function-like #define regexJune McEnroe A define like #define FOO (1) is not function-like. 2019-02-18Match Tag in RustJune McEnroe 2019-02-18Match sh functions as TagJune McEnroe 2019-02-18Match Sh and Ss as Tag in mdocJune McEnroe 2019-02-18Match statics and typedefs as TagJune McEnroe 2019-02-18Clean up htmlHeaderJune McEnroe 2019-02-18Remove hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe