irssi-import / bugs.irssi.org

bugs.irssi.org archive
https://github.com/irssi/irssi/issues
0 stars 0 forks source link

2 icb bugs #60

Open irssibot opened 20 years ago

irssibot commented 20 years ago

I've fixed two bugs that have been annoying me lately in the icb plugin: 1) "/nick newnick" changes your nick, but doesn't update the statusbar. 2) the name of the person beeping you doesn't appear.

This patch is against the 0.14 icb plugin found here: http://www.irssi.org/files/plugins/icb/irssi-icb-0.14.tar.gz

diff -uwr orig.irssi-icb-0.14/src/fe-common/fe-icb.c irssi-icb-0.14/src/fe-common/fe-icb.c
--- orig.irssi-icb-0.14/src/fe-common/fe-icb.c  Sat Apr 27 13:56:18 2002
+++ irssi-icb-0.14/src/fe-common/fe-icb.c       Mon May 31 02:24:06 2004
@@ -24,6 +24,7 @@
 #include "commands.h"
 #include "servers-setup.h"
 #include "levels.h"
+#include "nicklist.h"

 #include "icb.h"
 #include "icb-servers.h"
@@ -36,12 +37,27 @@
 static void event_status(ICB_SERVER_REC *server, const char *data)
 {
        char **args;
+       int len;
+       char *newnick;

        /* FIXME: status messages should probably divided into their own
           signals so irssi could track joins, parts, etc. */
        args = icb_split(data, 2);
        printformat(server, server->group->name, MSGLEVEL_CRAP,
                    ICBTXT_STATUS, args[0], args[1]);
+
+       len = strlen("Name");
+       if (strncmp(args[0],"Name",len) == 0) {
+
+               newnick = strrchr(args[1], ' ');
+               if (newnick != NULL) {
+                       newnick++;  /* skip the space */
+
+                       server_change_nick(SERVER(server), newnick);
+                       nicklist_rename(SERVER(server), server->connrec->nick, newnick);
+               }
+       }
+
         icb_split_free(args);
 }

diff -uwr orig.irssi-icb-0.14/src/fe-common/module-formats.c irssi-icb-0.14/src/fe-common/module-formats.c
--- orig.irssi-icb-0.14/src/fe-common/module-formats.c  Sat Apr 27 13:56:18 2002
+++ irssi-icb-0.14/src/fe-common/module-formats.c       Mon May 31 02:19:23 2004
@@ -30,7 +30,7 @@
        { "status", "[$0] $1", 2, { 0, 0 } },
        { "important", "[$0!] $1", 2, { 0, 0 } },
        { "status", "{error [Error]} $0", 1, { 0 } },
-       { "beep", "[beep] $1 beeps you", 1, { 0 } },
+       { "beep", "[beep] $0 beeps you", 1, { 0 } },

        { NULL, NULL, 0 }
 };
irssibot commented 20 years ago

p

patch file

diff -uwr orig.irssi-icb-0.14/src/fe-common/fe-icb.c irssi-icb-0.14/src/fe-common/fe-icb.c
--- orig.irssi-icb-0.14/src/fe-common/fe-icb.c  Sat Apr 27 13:56:18 2002
+++ irssi-icb-0.14/src/fe-common/fe-icb.c   Mon May 31 02:24:06 2004
@@ -24,6 +24,7 @@
 #include "commands.h"
 #include "servers-setup.h"
 #include "levels.h"
+#include "nicklist.h"

 #include "icb.h"
 #include "icb-servers.h"
@@ -36,12 +37,27 @@
 static void event_status(ICB_SERVER_REC *server, const char *data)
 {
    char **args;
+   int len;
+   char *newnick;

    /* FIXME: status messages should probably divided into their own
       signals so irssi could track joins, parts, etc. */
    args = icb_split(data, 2);
    printformat(server, server->group->name, MSGLEVEL_CRAP,
            ICBTXT_STATUS, args[0], args[1]);
+
+   len = strlen("Name");
+   if (strncmp(args[0],"Name",len) == 0) {
+
+       newnick = strrchr(args[1], ' ');
+       if (newnick != NULL) {
+           newnick++;  /* skip the space */
+
+           server_change_nick(SERVER(server), newnick);
+           nicklist_rename(SERVER(server), server->connrec->nick, newnick);
+       }
+   }
+
         icb_split_free(args);
 }

diff -uwr orig.irssi-icb-0.14/src/fe-common/module-formats.c irssi-icb-0.14/src/fe-common/module-formats.c
--- orig.irssi-icb-0.14/src/fe-common/module-formats.c  Sat Apr 27 13:56:18 2002
+++ irssi-icb-0.14/src/fe-common/module-formats.c   Mon May 31 02:19:23 2004
@@ -30,7 +30,7 @@
    { "status", "[$0] $1", 2, { 0, 0 } },
    { "important", "[$0!] $1", 2, { 0, 0 } },
    { "status", "{error [Error]} $0", 1, { 0 } },
-   { "beep", "[beep] $1 beeps you", 1, { 0 } },
+   { "beep", "[beep] $0 beeps you", 1, { 0 } },

    { NULL, NULL, 0 }
 };