Thu Nov 14 19:33:28 CET 2002 Jochen Eisinger <c0ffee@penguin-breeder.org>
authorJochen Eisinger <coffee@silcnet.org>
Thu, 14 Nov 2002 18:37:48 +0000 (18:37 +0000)
committerJochen Eisinger <coffee@silcnet.org>
Thu, 14 Nov 2002 18:37:48 +0000 (18:37 +0000)
* Never format your own nick. Closes #63

CHANGES
lib/silcclient/idlist.c

diff --git a/CHANGES b/CHANGES
index 992adc730ee2eb6d1d3c0641bca1f2979f39f822..59ff6151a24e76bebc4bb8c798b10402c8627c16 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Thu Nov 14 19:33:28 CET 2002  Jochen Eisinger <c0ffee@penguin-breeder.org>
+
+       * Print "nick now appears as newnick" and update Irssi's nicklist
+         when you change your nick to "nick". Closes #62
+       * Never format your own nick. Closes #63
+
 Thu Nov 14 09:44:54 CET 2002  Jochen Eisinger <c0ffee@penguin-breeder.org>
 
        * SILC_UMODE_GONE changes are now propagated correctly to the
index cd48b287516a3a6d55a0b25868fe0ec6438e008e..6c015ef527f0758c594d0b751a40403cd3e0097d 100644 (file)
@@ -1134,6 +1134,20 @@ void silc_client_nickname_format(SilcClient client,
   if (!len || freebase)
     return;
 
+  if (clients_count == 1)
+    unformatted = clients[0];
+  else
+    for (i = 0; i < clients_count; i++)
+      if (!strncasecmp(clients[i]->nickname, client_entry->nickname,
+                      strlen(clients[i]->nickname)))
+       unformatted = clients[i];
+
+  /* If we are changing nickname of our local entry we'll enforce
+     that we will always get the unformatted nickname.  Give our
+     format number to the one that is not formatted now. */
+  if (unformatted && client_entry == conn->local_entry)
+    client_entry = unformatted;
+
   cp = client->internal->params->nickname_format;
   while (*cp) {
     if (*cp == '%') {
@@ -1196,15 +1210,10 @@ void silc_client_nickname_format(SilcClient client,
        char tmp[6];
        int num, max = 1;
 
-       if (clients_count == 1) {
-         unformatted = clients[0];
+       if (clients_count == 1)
          break;
-       }
 
        for (i = 0; i < clients_count; i++) {
-         if (!strncasecmp(clients[i]->nickname, client_entry->nickname,
-                          strlen(clients[i]->nickname)))
-           unformatted = clients[i];
          if (strncasecmp(clients[i]->nickname, newnick, off))
            continue;
          if (strlen(clients[i]->nickname) <= off)
@@ -1236,12 +1245,6 @@ void silc_client_nickname_format(SilcClient client,
   newnick = silc_realloc(newnick, sizeof(*newnick) * (off + 1));
   newnick[off] = 0;
 
-  /* If we are changing nickname of our local entry we'll enforce
-     that we will always get the unformatted nickname.  Give our
-     format number to the one that is not formatted now. */
-  if (unformatted && client_entry == conn->local_entry)
-    client_entry = unformatted;
-
   silc_free(client_entry->nickname);
   client_entry->nickname = newnick;
   silc_free(clients);