From f6e7139442c6fbeca874a5686a19ee8e9852dcd5 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 1 Apr 2004 16:00:42 +0000 Subject: nb1: Make more IRC protocol correct. * Automatically issue the equivalent of a NAMES after a JOIN. * Allow PART command so that client may lurk; reissue a JOIN to re-"open" the channel on the client if a new open message arrives. * Provide a fake MOTD to make some IRC clients happier. * 353 (NAMES response) should have a single space character at the end of each line per protocol (Gaim is strict about this). --- chat/icbirc/Makefile | 3 +- chat/icbirc/distinfo | 8 +++-- chat/icbirc/patches/patch-aa | 17 +++++++--- chat/icbirc/patches/patch-ab | 76 ++++++++++++++++++++++++++++++++++++++++++++ chat/icbirc/patches/patch-ac | 13 ++++++++ chat/icbirc/patches/patch-ad | 29 +++++++++++++++++ chat/icbirc/patches/patch-ae | 11 +++++++ 7 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 chat/icbirc/patches/patch-ab create mode 100644 chat/icbirc/patches/patch-ac create mode 100644 chat/icbirc/patches/patch-ad create mode 100644 chat/icbirc/patches/patch-ae (limited to 'chat/icbirc') diff --git a/chat/icbirc/Makefile b/chat/icbirc/Makefile index 5db8036548c..623d3aa3536 100644 --- a/chat/icbirc/Makefile +++ b/chat/icbirc/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.3 2004/01/18 17:05:40 tron Exp $ +# $NetBSD: Makefile,v 1.4 2004/04/01 16:00:42 tv Exp $ DISTNAME= icbirc-1.6 +PKGREVISION= 1 CATEGORIES= chat MASTER_SITES= http://www.benzedrine.cx/ diff --git a/chat/icbirc/distinfo b/chat/icbirc/distinfo index 1d4c27e6cbe..b0cba9ae1c3 100644 --- a/chat/icbirc/distinfo +++ b/chat/icbirc/distinfo @@ -1,5 +1,9 @@ -$NetBSD: distinfo,v 1.1.1.1 2004/01/18 14:21:18 tron Exp $ +$NetBSD: distinfo,v 1.2 2004/04/01 16:00:42 tv Exp $ SHA1 (icbirc-1.6.tar.gz) = ed34478deae940e5cd97e5eb7415b279e87484d9 Size (icbirc-1.6.tar.gz) = 10936 bytes -SHA1 (patch-aa) = faa20fd7a94df6585caca93bd7744f5c822bb190 +SHA1 (patch-aa) = a660db6b48e3af9ccf566128e7f31177dcda3e1b +SHA1 (patch-ab) = 067cca58c86971f1f0f2f426622be1e906a95508 +SHA1 (patch-ac) = 513482d11aeb0efa5dd6cee620deab7b6f756c96 +SHA1 (patch-ad) = 039e10c46d9a5fa15b4a7fbd83ffbf3d4a139210 +SHA1 (patch-ae) = 74133ff7125740943cef136a59fbc7641261212b diff --git a/chat/icbirc/patches/patch-aa b/chat/icbirc/patches/patch-aa index b1887efa82e..6396abeff6c 100644 --- a/chat/icbirc/patches/patch-aa +++ b/chat/icbirc/patches/patch-aa @@ -1,8 +1,17 @@ -$NetBSD: patch-aa,v 1.1.1.1 2004/01/18 14:21:18 tron Exp $ +$NetBSD: patch-aa,v 1.2 2004/04/01 16:00:42 tv Exp $ ---- icbirc.c.orig 2003-08-20 23:55:59.000000000 +0200 -+++ icbirc.c 2004-01-18 15:12:29.000000000 +0100 -@@ -318,8 +318,8 @@ +--- icbirc.c.orig Wed Aug 20 17:55:59 2003 ++++ icbirc.c +@@ -294,7 +294,7 @@ handle_client(int client_fd) + "Connection closed by server"); + break; + } +- icb_recv(buf, len, client_fd); ++ icb_recv(buf, len, client_fd, server_fd); + bytes_in += len; + } + if (FD_ISSET(client_fd, &readfds)) { +@@ -318,8 +318,8 @@ handle_client(int client_fd) done: if (server_fd >= 0) close(server_fd); diff --git a/chat/icbirc/patches/patch-ab b/chat/icbirc/patches/patch-ab new file mode 100644 index 00000000000..133fad297be --- /dev/null +++ b/chat/icbirc/patches/patch-ab @@ -0,0 +1,76 @@ +$NetBSD: patch-ab,v 1.1 2004/04/01 16:00:42 tv Exp $ + +--- icb.c.orig Sat Jan 3 19:08:07 2004 ++++ icb.c +@@ -41,7 +41,7 @@ static const char rcsid[] = "$Id: icb.c, + extern int sync_write(int, const char *, int); + + static unsigned char icb_args(const char *, unsigned char, char [255][255]); +-static void icb_cmd(const char *, unsigned char, int); ++static void icb_cmd(const char *, unsigned char, int, int); + static void icb_ico(int, const char *); + static void icb_iwl(int, const char *, const char *, long, + long, const char *, const char *); +@@ -124,7 +124,7 @@ scan(const char **s, char *d, size_t siz + } + + void +-icb_recv(const char *buf, unsigned len, int fd) ++icb_recv(const char *buf, unsigned len, int fd, int server_fd) + { + static unsigned char cmd[256]; + static unsigned off = 0; +@@ -142,7 +142,7 @@ icb_recv(const char *buf, unsigned len, + } + /* len == 0 || (off - 1) == cmd[0] */ + if ((off - 1) == cmd[0]) { +- icb_cmd(cmd + 1, off - 1 /* <= 255 */, fd); ++ icb_cmd(cmd + 1, off - 1 /* <= 255 */, fd, server_fd); + off = 0; + } + } +@@ -175,7 +175,7 @@ icb_args(const char *data, unsigned char + } + + static void +-icb_cmd(const char *cmd, unsigned char len, int fd) ++icb_cmd(const char *cmd, unsigned char len, int fd, int server_fd) + { + char args[255][255]; + const char *a = args[1]; +@@ -195,9 +195,18 @@ icb_cmd(const char *cmd, unsigned char l + irc_send_code(fd, icb_hostid, irc_nick, "002", + "Your host is %s running %s protocol %s", + icb_hostid, icb_serverid, icb_protolevel); ++ /* some clients really want to see a MOTD */ ++ irc_send_code(fd, icb_hostid, irc_nick, "375", ++ "ICB server: %s", icb_serverid); ++ irc_send_code(fd, icb_hostid, irc_nick, "376", ++ "End of MOTD"); + icb_logged_in = 1; + break; + case 'b': /* Open Message */ ++ if (!in_irc_channel) { ++ irc_send_join(fd, irc_nick, irc_channel); ++ icb_send_names(server_fd, irc_channel); ++ } + irc_send_msg(fd, args[0], irc_channel, args[1]); + break; + case 'c': /* Personal Message */ +@@ -213,6 +222,7 @@ icb_cmd(const char *cmd, unsigned char l + scan(&a, irc_channel + 1, sizeof(irc_channel) - 1, + " ", " "); + irc_send_join(fd, irc_nick, irc_channel); ++ icb_send_names(server_fd, irc_channel); + } else if (!strcmp(args[0], "Arrive") || + !strcmp(args[0], "Sign-on")) { + char nick[256], host[256]; +@@ -372,7 +382,7 @@ icb_iwl(int fd, const char *flags, const + icb_hostid, irc_nick, nick); + sync_write(fd, s, strlen(s)); + } else if (imode == imode_names && !strcmp(icurgroup, igroup)) { +- snprintf(s, sizeof(s), ":%s 353 %s @ %s :%s%s\r\n", ++ snprintf(s, sizeof(s), ":%s 353 %s @ %s :%s%s \r\n", + icb_hostid, irc_nick, icurgroup, chanop ? "@" : "", nick); + sync_write(fd, s, strlen(s)); + snprintf(s, sizeof(s), ":%s 352 %s %s %s %s %s %s H :5 %s\r\n", diff --git a/chat/icbirc/patches/patch-ac b/chat/icbirc/patches/patch-ac new file mode 100644 index 00000000000..2a897e68aa9 --- /dev/null +++ b/chat/icbirc/patches/patch-ac @@ -0,0 +1,13 @@ +$NetBSD: patch-ac,v 1.1 2004/04/01 16:00:42 tv Exp $ + +--- icb.h.orig Thu Apr 1 10:31:31 2004 ++++ icb.h +@@ -3,7 +3,7 @@ + #ifndef _ICB_H_ + #define _ICB_H_ + +-void icb_recv(const char *, unsigned, int); ++void icb_recv(const char *, unsigned, int, int); + void icb_send_login(int, const char *, const char *, const char *); + void icb_send_openmsg(int, const char *); + void icb_send_privmsg(int, const char *, const char *); diff --git a/chat/icbirc/patches/patch-ad b/chat/icbirc/patches/patch-ad new file mode 100644 index 00000000000..e9c9623ae38 --- /dev/null +++ b/chat/icbirc/patches/patch-ad @@ -0,0 +1,29 @@ +$NetBSD: patch-ad,v 1.1 2004/04/01 16:00:42 tv Exp $ + +--- irc.c.orig Thu Apr 1 10:50:38 2004 ++++ irc.c +@@ -50,6 +50,7 @@ char irc_pass[256]; + char irc_ident[256]; + char irc_nick[256]; + char irc_channel[256]; ++int in_irc_channel; + + /* + * irc_recv() receives read(2) chunks and assembles complete lines, which are +@@ -115,6 +116,8 @@ irc_cmd(const char *cmd, int fd) + cmd++; + scan(&cmd, group, sizeof(group), " ", " "); + icb_send_group(fd, group); ++ } else if (!strncasecmp(cmd, "PART ", 5)) { ++ in_irc_channel = 0; + } else if (!strncasecmp(cmd, "PRIVMSG ", 8) || + !strncasecmp(cmd, "NOTICE ", 7)) { + char dst[128]; +@@ -242,6 +245,7 @@ irc_send_join(int fd, const char *src, c + + snprintf(cmd, sizeof(cmd), ":%s JOIN :%s\r\n", src, dst); + sync_write(fd, cmd, strlen(cmd)); ++ in_irc_channel = 1; + } + + void diff --git a/chat/icbirc/patches/patch-ae b/chat/icbirc/patches/patch-ae new file mode 100644 index 00000000000..7ddb0de8f88 --- /dev/null +++ b/chat/icbirc/patches/patch-ae @@ -0,0 +1,11 @@ +$NetBSD: patch-ae,v 1.1 2004/04/01 16:00:42 tv Exp $ + +--- irc.h.orig Thu Apr 1 10:52:37 2004 ++++ irc.h +@@ -15,5 +15,6 @@ extern char irc_pass[256]; + extern char irc_ident[256]; + extern char irc_nick[256]; + extern char irc_channel[256]; ++extern int in_irc_channel; + + #endif -- cgit v1.2.3