From 79140c3abc9a96ae1884b0b1433b18eb5d50ca3e Mon Sep 17 00:00:00 2001
From: Přemysl Janouch <p.janouch@gmail.com>
Date: Mon, 23 Nov 2015 08:33:58 +0100
Subject: degesch: make auto-away less spammy

---
 degesch.c | 34 ++++++++++------------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/degesch.c b/degesch.c
index dc16c93..21be937 100644
--- a/degesch.c
+++ b/degesch.c
@@ -6503,24 +6503,6 @@ irc_handle_rpl_inviting (struct server *s, const struct irc_message *msg)
 		"You have invited #n to #S", nickname, channel_name);
 }
 
-static void
-irc_handle_rpl_nowaway (struct server *s, const struct irc_message *msg)
-{
-	(void) msg;
-
-	if (s->irc_user)
-		s->irc_user->away = true;
-}
-
-static void
-irc_handle_rpl_unaway (struct server *s, const struct irc_message *msg)
-{
-	(void) msg;
-
-	if (s->irc_user)
-		s->irc_user->away = false;
-}
-
 static void
 irc_handle_err_nicknameinuse (struct server *s, const struct irc_message *msg)
 {
@@ -6712,6 +6694,7 @@ irc_process_numeric (struct server *s,
 	str_vector_add_vector (&copy, msg->params.vector + !!msg->params.len);
 
 	struct buffer *buffer = s->buffer;
+	int flags = BUFFER_LINE_STATUS;
 	switch (numeric)
 	{
 	case IRC_RPL_WELCOME:
@@ -6742,14 +6725,18 @@ irc_process_numeric (struct server *s,
 		irc_handle_rpl_topicwhotime  (s, msg); buffer = NULL; break;
 	case IRC_RPL_INVITING:
 		irc_handle_rpl_inviting      (s, msg); buffer = NULL; break;
-	case IRC_RPL_NOWAWAY:
-		irc_handle_rpl_nowaway       (s, msg);                break;
-	case IRC_RPL_UNAWAY:
-		irc_handle_rpl_unaway        (s, msg);                break;
 
 	case IRC_ERR_NICKNAMEINUSE:
 		irc_handle_err_nicknameinuse (s, msg); buffer = NULL; break;
 
+		// Auto-away spams server buffers with activity
+	case IRC_RPL_NOWAWAY:
+		flags |= BUFFER_LINE_UNIMPORTANT;
+		if (s->irc_user) s->irc_user->away = true;            break;
+	case IRC_RPL_UNAWAY:
+		flags |= BUFFER_LINE_UNIMPORTANT;
+		if (s->irc_user) s->irc_user->away = false;           break;
+
 	case IRC_RPL_LIST:
 	case IRC_RPL_WHOREPLY:
 	case IRC_RPL_ENDOFWHO:
@@ -6777,8 +6764,7 @@ irc_process_numeric (struct server *s,
 	if (buffer)
 	{
 		// Join the parameter vector back and send it to the server buffer
-		log_server (s, buffer, BUFFER_LINE_STATUS,
-			"#&m", join_str_vector (&copy, ' '));
+		log_server (s, buffer, flags, "#&m", join_str_vector (&copy, ' '));
 	}
 
 	str_vector_free (&copy);
-- 
cgit v1.2.3-70-g09d2