summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--handle.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/handle.c b/handle.c
index da635b4..2af5837 100644
--- a/handle.c
+++ b/handle.c
@@ -193,15 +193,31 @@ static void handleJoin(struct Message *msg) {
 	);
 }
 
+static bool isAction(struct Message *msg) {
+	if (strncmp(msg->params[1], "\1ACTION ", 8)) return false;
+	msg->params[1] += 8;
+	size_t len = strlen(msg->params[1]);
+	if (msg->params[1][len - 1] == '\1') msg->params[1][len - 1] = '\0';
+	return true;
+}
+
 static void handlePrivmsg(struct Message *msg) {
 	require(msg, true, 2);
-	bool query = self.nick && !strcmp(msg->params[0], self.nick);
-	size_t id = idFor(query ? msg->nick : msg->params[0]);
-	if (query) idColors[id] = hash(msg->user);
+	bool query = msg->params[0][0] != '#'; // FIXME: CHANTYPES.
+	bool network = query && strchr(msg->nick, '.');
+	bool notice = (msg->cmd[0] == 'N');
+	bool action = isAction(msg);
+	// TODO: Send services to Network?
+	size_t id = (network ? Network : idFor(query ? msg->nick : msg->params[0]));
+	if (query && !network) idColors[id] = hash(msg->user);
 	uiFormat(
 		id, Warm, tagTime(msg),
-		"\3%d<%s>\3 %s",
-		hash(msg->user), msg->nick, msg->params[1]
+		"\3%d%s%s%s\3 %s",
+		hash(msg->user),
+		(action ? "* " : notice ? "-" : "<"),
+		msg->nick,
+		(action ? "" : notice ? "-" : ">"),
+		msg->params[1]
 	);
 }
 
@@ -226,6 +242,7 @@ static const struct Handler {
 	{ "AUTHENTICATE", handleAuthenticate },
 	{ "CAP", handleCap },
 	{ "JOIN", handleJoin },
+	{ "NOTICE", handlePrivmsg },
 	{ "PING", handlePing },
 	{ "PRIVMSG", handlePrivmsg },
 };
mmit/filter.c?id=0c4d76755b98bb597279a1930bf4c69eca7dde62&follow=1'>filter: don't use dlsym unnecessarilyJohn Keeping 2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt