+/* print "nick appears as" message to every channel of a server */
+static void
+silc_print_nick_change_channel(SILC_SERVER_REC *server, const char *channel,
+ const char *newnick, const char *oldnick,
+ const char *address)
+{
+ if (ignore_check(server, oldnick, address,
+ channel, newnick, MSGLEVEL_NICKS))
+ return;
+
+ printformat_module("fe-common/silc", server, channel, MSGLEVEL_NICKS,
+ SILCTXT_CHANNEL_APPEARS,
+ oldnick, newnick, channel, address);
+}
+
+static void
+silc_print_nick_change(SILC_SERVER_REC *server, const char *newnick,
+ const char *oldnick, const char *address)
+{
+ GSList *tmp, *windows;
+
+ /* Print to each channel/query where the nick is.
+ Don't print more than once to the same window. */
+ windows = NULL;
+
+ for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
+ CHANNEL_REC *channel = tmp->data;
+ WINDOW_REC *window = window_item_window((WI_ITEM_REC *) channel);
+
+ if (nicklist_find(channel, newnick) == NULL ||
+ g_slist_find(windows, window) != NULL)
+ continue;
+
+ windows = g_slist_append(windows, window);
+ silc_print_nick_change_channel(server, channel->visible_name,
+ newnick, oldnick, address);
+ }
+
+ g_slist_free(windows);
+
+}
+