about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-05 00:40:24 -0500
committerJune McEnroe <june@causal.agency>2020-02-05 00:40:24 -0500
commit7414a8a11cd8d16fea47e30513b3a5eaeb232ba1 (patch)
treeaaacf18fb8879577480c76693894edf55e7cb0d7
parentAlign MOTD after - (diff)
downloadtest-7414a8a11cd8d16fea47e30513b3a5eaeb232ba1.tar.gz
test-7414a8a11cd8d16fea47e30513b3a5eaeb232ba1.zip
Save own username for message echoing
-rw-r--r--chat.h1
-rw-r--r--command.c2
-rw-r--r--handle.c5
3 files changed, 6 insertions, 2 deletions
diff --git a/chat.h b/chat.h
index c8b31c2..90c7da8 100644
--- a/chat.h
+++ b/chat.h
@@ -73,6 +73,7 @@ extern struct Self {
 	char *chanTypes;
 	char *prefixes;
 	char *nick;
+	char *user;
 	enum Color color;
 } self;
 
diff --git a/command.c b/command.c
index ab05587..76d7d7b 100644
--- a/command.c
+++ b/command.c
@@ -23,7 +23,7 @@ void command(size_t id, char *input) {
 	ircFormat("PRIVMSG %s :%s\r\n", idNames[id], input);
 	struct Message msg = {
 		.nick = self.nick,
-		// TODO: .user,
+		.user = self.user,
 		.cmd = "PRIVMSG",
 		.params[0] = idNames[id],
 		.params[1] = input,
diff --git a/handle.c b/handle.c
index b5585ba..85783d7 100644
--- a/handle.c
+++ b/handle.c
@@ -187,7 +187,10 @@ static void handleJoin(struct Message *msg) {
 	require(msg, true, 1);
 	size_t id = idFor(msg->params[0]);
 	if (self.nick && !strcmp(msg->nick, self.nick)) {
-		self.color = hash(msg->user);
+		if (!self.user) {
+			set(&self.user, msg->user);
+			self.color = hash(msg->user);
+		}
 		idColors[id] = hash(msg->params[0]);
 		uiShowID(id);
 	}
ogsubject'>Add Trail of LightningJune McEnroe 2019-09-22Revert "Enable cookies in title"June McEnroe This reverts commit 3231fe21d3b389448c9a5ca7b4c91fdd25c9e677. 2019-09-20Enable cookies in titleJune McEnroe Perhaps this will make it less suspicious to Google. Who knows. 2019-09-16Use sensitivity aliases in TF2June McEnroe 2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe Aborting the request and leaving data around may be causing intermittent errors. Just discard the rest of the data. 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe Because apparently it's fine for servers to respond with Content-Encoding you didn't ask for, and curl won't decode it if you didn't ask for it. 2019-09-08Set title User-AgentJune McEnroe Some things don't like you if you don't send one. 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe Allows restarting consumers safely. 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe