- /* Set the topic for channel */
- silc_free(channel->topic);
- channel->topic = strdup(tmp);
-
- /* Send TOPIC_SET notify type to the network */
- silc_server_send_notify_topic_set(server, SILC_PRIMARY_ROUTE(server),
- SILC_BROADCAST(server), channel,
- client->id, SILC_ID_CLIENT,
- channel->topic);
-
- idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
-
- /* Send notify about topic change to all clients on the channel */
- silc_server_send_notify_to_channel(server, NULL, channel, FALSE,
- SILC_NOTIFY_TYPE_TOPIC_SET, 2,
- idp->data, idp->len,
- channel->topic, strlen(channel->topic));
- silc_buffer_free(idp);
+ if (!channel->topic || strcmp(channel->topic, tmp)) {
+ /* Set the topic for channel */
+ silc_free(channel->topic);
+ channel->topic = strdup(tmp);
+
+ /* Send TOPIC_SET notify type to the network */
+ silc_server_send_notify_topic_set(server, SILC_PRIMARY_ROUTE(server),
+ SILC_BROADCAST(server), channel,
+ client->id, SILC_ID_CLIENT,
+ channel->topic);
+
+ /* Send notify about topic change to all clients on the channel */
+ idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
+ silc_server_send_notify_to_channel(server, NULL, channel, FALSE,
+ SILC_NOTIFY_TYPE_TOPIC_SET, 2,
+ idp->data, idp->len,
+ channel->topic,
+ strlen(channel->topic));
+ silc_buffer_free(idp);
+ }