mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
If we receive a 0 length topic, record it as unset
Fixes #888. Previously we showed that there was a topic set when using /topic, just an empty one. This was different than how we show such topics when initially joining a channel. Now we say that the topic is unset in both cases.
This commit is contained in:
parent
b9e301362d
commit
15840ac27b
@ -126,23 +126,25 @@ static void channel_change_topic(IRC_SERVER_REC *server, const char *channel,
|
||||
|
||||
chanrec = channel_find(SERVER(server), channel);
|
||||
if (chanrec == NULL) return;
|
||||
|
||||
g_free_and_null(chanrec->topic);
|
||||
g_free_and_null(chanrec->topic_by);
|
||||
chanrec->topic_time = 0;
|
||||
|
||||
/* the topic may be sent out encoded, so we need to
|
||||
recode it back or /topic <tab> will not work properly */
|
||||
recoded = recode_in(SERVER(server), topic, channel);
|
||||
if (topic != NULL) {
|
||||
g_free_not_null(chanrec->topic);
|
||||
chanrec->topic = recoded == NULL ? NULL : g_strdup(recoded);
|
||||
}
|
||||
if (recoded == NULL || strlen(recoded) == 0) {
|
||||
signal_emit("channel topic changed", 1, chanrec);
|
||||
g_free(recoded);
|
||||
return;
|
||||
}
|
||||
|
||||
g_free_not_null(chanrec->topic_by);
|
||||
chanrec->topic = recoded;
|
||||
chanrec->topic_by = g_strdup(setby);
|
||||
|
||||
if (chanrec->topic_by == NULL) {
|
||||
if (chanrec->topic_by != NULL) {
|
||||
/* ensure invariant topic_time > 0 <=> topic_by != NULL.
|
||||
this could be triggered by a topic command without sender */
|
||||
chanrec->topic_time = 0;
|
||||
} else {
|
||||
chanrec->topic_time = settime;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user