diff --git a/net/irssi-icb/Makefile b/net/irssi-icb/Makefile index 5e4d1d2eb61..8415e38bfd6 100644 --- a/net/irssi-icb/Makefile +++ b/net/irssi-icb/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.19 2010/05/19 09:17:51 sthen Exp $ +# $OpenBSD: Makefile,v 1.20 2010/06/04 14:16:22 phessler Exp $ SHARED_ONLY= Yes COMMENT= ICB plugin for irssi DISTNAME= irssi-icb-0.14 -PKGNAME= ${DISTNAME}p4 +PKGNAME= ${DISTNAME}p5 MASTER_SITES= http://www.phil.uu.nl/~lievisse/distfiles/ CATEGORIES= net diff --git a/net/irssi-icb/patches/patch-src_core_icb-protocol_c b/net/irssi-icb/patches/patch-src_core_icb-protocol_c new file mode 100644 index 00000000000..d59d4d0caa1 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_core_icb-protocol_c @@ -0,0 +1,99 @@ +$OpenBSD: patch-src_core_icb-protocol_c,v 1.1 2010/06/04 14:16:22 phessler Exp $ + +Break lines longer than 255 chars + +--- src/core/icb-protocol.c.orig Sat May 4 19:21:44 2002 ++++ src/core/icb-protocol.c Fri Jun 4 10:12:25 2010 +@@ -121,7 +121,91 @@ static void icb_login(ICB_SERVER_REC *server) + + void icb_send_open_msg(ICB_SERVER_REC *server, const char *text) + { +- icb_send_cmd(server, 'b', text, NULL); ++ size_t remain; ++ ++ /* ++ * ICB has 255 byte line length limit, and public messages are sent ++ * out with our nickname, so split text accordingly. ++ * ++ * 250 = 255 - 'b' - 1 space after nick - ^A - nul - extra ++ * ++ * Taken from ircII's icb.c, thanks phone :-) ++ */ ++ remain = 250 - strlen(server->connrec->nick); ++ ++ while(*text) { ++ char buf[256], *sendbuf; ++ size_t len, copylen; ++ ++ len = strlen(text); ++ copylen = remain; ++ if (len > remain) { ++ int i; ++ ++ /* try to split on a word boundary */ ++ for (i = 1; i < 128 && i < len; i++) { ++ if (isspace(text[remain - i])) { ++ copylen -= i - 1; ++ break; ++ } ++ } ++ strncpy(buf, text, copylen); ++ buf[copylen] = 0; ++ sendbuf = buf; ++ } else { ++ sendbuf = (char *)text; ++ } ++ icb_send_cmd(server, 'b', sendbuf, NULL); ++ text += len > copylen ? copylen : len; ++ } ++} ++ ++void icb_send_private_msg(ICB_SERVER_REC *server, const char *target, ++ const char *text) ++{ ++ size_t mylen, targlen, remain; ++ ++ /* ++ * ICB has 255 byte line length limit. Private messages are sent ++ * out with our nickname, but received with the target nickname, ++ * so deduct the larger of the two in addition to other parts. ++ * ++ * 248 = 255 - 'hm' - 1 space after nick - ^A's - nul - extra ++ * ++ * Taken from ircII's icb.c, thanks phone :-) ++ */ ++ mylen = strlen(server->connrec->nick); ++ targlen = strlen(target); ++ if (mylen > targlen) { ++ remain = 248 - mylen; ++ } else { ++ remain = 248 - targlen; ++ } ++ while(*text) { ++ char buf[256], *sendbuf; ++ size_t len, copylen; ++ ++ len = strlen(text); ++ copylen = remain; ++ if (len > remain) { ++ int i; ++ ++ /* try to split on a word boundary */ ++ for (i = 1; i < 128 && i < len; i++) { ++ if (isspace(text[remain - i])) { ++ copylen -= i - 1; ++ break; ++ } ++ } ++ strncpy(buf, text, copylen); ++ buf[copylen] = 0; ++ sendbuf = g_strconcat(target, " ", buf, NULL); ++ } else { ++ sendbuf = g_strconcat(target, " ", text, NULL); ++ } ++ icb_send_cmd(server, 'h', "m", sendbuf, NULL); ++ text += len > copylen ? copylen : len; ++ } + } + + void icb_command(ICB_SERVER_REC *server, const char *cmd, diff --git a/net/irssi-icb/patches/patch-src_core_icb-protocol_h b/net/irssi-icb/patches/patch-src_core_icb-protocol_h new file mode 100644 index 00000000000..bc990ef3442 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_core_icb-protocol_h @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_core_icb-protocol_h,v 1.1 2010/06/04 14:16:22 phessler Exp $ + +Break lines longer than 255 chars + +--- src/core/icb-protocol.h.orig Sat May 4 19:21:44 2002 ++++ src/core/icb-protocol.h Fri Jun 4 10:12:25 2010 +@@ -4,6 +4,8 @@ + #define ICB_PROTOCOL_LEVEL 1 + + void icb_send_open_msg(ICB_SERVER_REC *server, const char *text); ++void icb_send_private_msg(ICB_SERVER_REC *server, const char *target, ++ const char *text); + void icb_command(ICB_SERVER_REC *server, const char *cmd, + const char *args, const char *id); + void icb_protocol(ICB_SERVER_REC *server, const char *level, diff --git a/net/irssi-icb/patches/patch-src_core_icb-servers_c b/net/irssi-icb/patches/patch-src_core_icb-servers_c new file mode 100644 index 00000000000..ea30e1ce9e8 --- /dev/null +++ b/net/irssi-icb/patches/patch-src_core_icb-servers_c @@ -0,0 +1,25 @@ +$OpenBSD: patch-src_core_icb-servers_c,v 1.1 2010/06/04 14:16:22 phessler Exp $ + +Break lines longer than 255 chars + +--- src/core/icb-servers.c.orig Tue May 28 18:56:34 2002 ++++ src/core/icb-servers.c Fri Jun 4 10:12:25 2010 +@@ -113,7 +113,6 @@ static void send_message(SERVER_REC *server, const cha + const char *msg, int target_type) + { + ICB_SERVER_REC *icbserver; +- char *str; + + icbserver = ICB_SERVER(server); + g_return_if_fail(server != NULL); +@@ -125,9 +124,7 @@ static void send_message(SERVER_REC *server, const cha + icb_send_open_msg(icbserver, msg); + } else { + /* private message */ +- str = g_strconcat(target, " ", msg, NULL); +- icb_command(icbserver, "m", str, NULL); +- g_free(str); ++ icb_send_private_msg(icbserver, target, msg); + } + } +