1 |
From 54d453623d879ea83d0818a80bd14151192953ec Mon Sep 17 00:00:00 2001 |
2 |
From: ailin-nemui <ailin-nemui@users.noreply.github.com> |
3 |
Date: Wed, 3 Jan 2018 12:45:43 +0100 |
4 |
Subject: [PATCH] do not record topic change time when sender is blank |
5 |
|
6 |
--- |
7 |
src/irc/core/channel-events.c | 8 +++++++- |
8 |
1 file changed, 7 insertions(+), 1 deletion(-) |
9 |
|
10 |
diff --git a/src/irc/core/channel-events.c b/src/irc/core/channel-events.c |
11 |
index b0bddab21..46bbd5fad 100644 |
12 |
--- a/src/irc/core/channel-events.c |
13 |
+++ b/src/irc/core/channel-events.c |
14 |
@@ -138,7 +138,13 @@ static void channel_change_topic(IRC_SERVER_REC *server, const char *channel, |
15 |
g_free_not_null(chanrec->topic_by); |
16 |
chanrec->topic_by = g_strdup(setby); |
17 |
|
18 |
- chanrec->topic_time = settime; |
19 |
+ if (chanrec->topic_by == NULL) { |
20 |
+ /* ensure invariant topic_time > 0 <=> topic_by != NULL. |
21 |
+ this could be triggered by a topic command without sender */ |
22 |
+ chanrec->topic_time = 0; |
23 |
+ } else { |
24 |
+ chanrec->topic_time = settime; |
25 |
+ } |
26 |
|
27 |
signal_emit("channel topic changed", 1, chanrec); |
28 |
} |