diff options
-rw-r--r-- | .travis.yml | 17 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | autogen.sh | 4 | ||||
-rw-r--r-- | configure.ac | 37 | ||||
-rw-r--r-- | src/core/ignore.c | 4 | ||||
-rw-r--r-- | src/core/misc.c | 37 | ||||
-rw-r--r-- | src/core/misc.h | 2 | ||||
-rw-r--r-- | src/core/recode.c | 20 | ||||
-rw-r--r-- | src/core/recode.h | 2 | ||||
-rw-r--r-- | src/fe-common/core/formats.c | 7 | ||||
-rw-r--r-- | src/fe-text/term-terminfo.c | 6 | ||||
-rw-r--r-- | src/irc/core/irc-servers.c | 4 |
12 files changed, 83 insertions, 59 deletions
diff --git a/.travis.yml b/.travis.yml index 04c19d88..35226645 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,22 @@ -language: c -compiler: - - gcc - - clang +language: perl +perl: + - "5.20-shrplib" + - "5.18-shrplib" + - "system-perl" +env: + - CC=clang + - CC=gcc before_install: - sudo apt-get update -qq + - perl -V - sudo apt-get build-dep -qq irssi - sudo apt-get install -qq lynx +install: true + script: - - ./autogen.sh --with-proxy --with-bot + - ./autogen.sh --with-proxy --with-bot --with-perl=module - cat config.log - make - sudo make install @@ -1,5 +1,7 @@ v0.8.18-head 2014-XX-YY The Irssi team <staff@irssi.org> + Disable SSLv3 due to the POODLE vulnerability. + + Try to split long lines on spaces to avoid words being splitted. Adds + a new option: 'split_line_on_space' which defaults to on. v0.8.17 2014-10-11 The Irssi team <staff@irssi.org> + Document that SSL connections aren't properly handled during /UPGRADE. See Github PR #39. @@ -28,9 +28,11 @@ cat docs/help/Makefile.am.gen|sed "s/@HELPFILES@/$files/g"|sed 's/?/\\?/g'|tr '! # .html -> .txt with lynx or elinks echo "Documentation: html -> txt..." if type lynx >/dev/null 2>&1 ; then - lynx -dump -nolist docs/faq.html|perl -pe 's/^ *//; if ($_ eq "\n" && $state eq "Q") { $_ = ""; } elsif (/^([QA]):/) { $state = $1 } elsif ($_ ne "\n") { $_ = " $_"; };' > docs/faq.txt + LC_ALL=C lynx -dump docs/faq.html|perl -pe 's/^ *//; if ($_ eq "\n" && $state eq "Q") { $_ = ""; } elsif (/^([QA]):/) { $state = $1 } elsif ($_ ne "\n") { $_ = " $_"; };' > docs/faq.txt elif type elinks >/dev/null 2>&1 ; then elinks -dump docs/faq.html|perl -pe 's/^ *//; if ($_ eq "\n" && $state eq "Q") { $_ = ""; } elsif (/^([QA]):/) { $state = $1 } elsif ($_ ne "\n") { $_ = " $_"; };' > docs/faq.txt +elif type links >/dev/null 2>&1 ; then + links -dump docs/faq.html|perl -pe 's/^ *//; if ($_ eq "\n" && $state eq "Q") { $_ = ""; } elsif (/^([QA]):/) { $state = $1 } elsif ($_ ne "\n") { $_ = " $_"; };' > docs/faq.txt else echo "**Error**: No lynx or elinks present" exit 1 diff --git a/configure.ac b/configure.ac index 477f8c4d..c312d065 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,6 @@ AM_INIT_AUTOMAKE([1.9 no-define foreign]) AM_MAINTAINER_MODE -AC_ISC_POSIX AC_PROG_CC AC_PROG_CPP AM_PROG_LIBTOOL @@ -20,7 +19,7 @@ AC_PATH_PROG(perlpath, perl) AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h) # check posix headers.. -AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h) +AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h regex.h) AC_SYS_LARGEFILE @@ -197,38 +196,22 @@ case "$host_os" in esac -AC_CHECK_FUNC(socket, [], [ - AC_CHECK_LIB(socket, socket, [ - LIBS="$LIBS -lsocket" - ]) -]) +AC_SEARCH_LIBS([socket], [socket]) -AC_CHECK_FUNC(inet_addr, [], [ - AC_CHECK_LIB(nsl, inet_addr, [ - LIBS="$LIBS -lnsl" - ]) -]) +AC_SEARCH_LIBS([inet_addr], [nsl]) dnl * gcc specific options if test "x$ac_cv_prog_gcc" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi -dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would -dnl * accept header files where to find the typedef.. -AC_MSG_CHECKING([for socklen_t]) -AC_CACHE_VAL(irssi_cv_type_socklen_t, -[AC_TRY_COMPILE([ -#include <sys/types.h> -#include <sys/socket.h>], -[socklen_t t = 0; return((int)t); ], -irssi_cv_type_socklen_t=yes, -irssi_cv_type_socklen_t=no, -)]) -if test $irssi_cv_type_socklen_t = no; then -AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.) -fi -AC_MSG_RESULT($irssi_cv_type_socklen_t) +AC_CHECK_TYPE(socklen_t, , + [AC_DEFINE([socklen_t], [int], [Define to 'int' if <sys/socket.h> doesn't define.])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +]) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) diff --git a/src/core/ignore.c b/src/core/ignore.c index 3c45967c..68fae11f 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -360,8 +360,6 @@ static void ignore_destroy(IGNORE_REC *rec, int send_signal) g_free_not_null(rec->servertag); g_free_not_null(rec->pattern); g_free(rec); - - nickmatch_rebuild(nickmatch); } void ignore_update_rec(IGNORE_REC *rec) @@ -380,8 +378,8 @@ void ignore_update_rec(IGNORE_REC *rec) ignore_init_rec(rec); signal_emit("ignore changed", 1, rec); - nickmatch_rebuild(nickmatch); } + nickmatch_rebuild(nickmatch); } static int unignore_timeout(void) diff --git a/src/core/misc.c b/src/core/misc.c index 5e6087cb..586e4f7c 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -967,19 +967,30 @@ char *ascii_strdown(char *str) return str; } -char **strsplit_len(const char *str, int len) -{ - char **ret; - size_t total_len = strlen(str); - int n = total_len / len; - int i; - - if (total_len % len) - n++; - - ret = g_new(char *, n + 1); - for (i = 0; i < n; i++, str += len) - ret[i] = g_strndup(str, len); +char **strsplit_len(const char *str, int len, gboolean onspace) +{ + char **ret = g_new(char *, 1); + int n; + int offset; + + for (n = 0; *str != '\0'; n++, str += MIN(len - offset, strlen(str))) { + offset = 0; + if (onspace) { + /* + * Try to find a space to split on and leave + * the space on the previous line. + */ + int i; + for (i = 0; i < len; i++) { + if (str[len-1-i] == ' ') { + offset = i; + break; + } + } + } + ret[n] = g_strndup(str, len - offset); + ret = g_renew(char *, ret, n + 2); + } ret[n] = NULL; return ret; diff --git a/src/core/misc.h b/src/core/misc.h index 8fb5078f..c6369489 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -116,6 +116,6 @@ uoff_t str_to_uofft(const char *str); int find_substr(const char *list, const char *item); /* split `str' into `len' sized substrings */ -char **strsplit_len(const char *str, int len); +char **strsplit_len(const char *str, int len, gboolean onspace); #endif diff --git a/src/core/recode.c b/src/core/recode.c index 029d7ff1..d001a46a 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -183,7 +183,7 @@ char *recode_out(const SERVER_REC *server, const char *str, const char *target) } char **recode_split(const SERVER_REC *server, const char *str, - const char *target, int len) + const char *target, int len, gboolean onspace) { GIConv cd = (GIConv)-1; const char *from = translit_charset; @@ -219,7 +219,7 @@ char **recode_split(const SERVER_REC *server, const char *str, cd = g_iconv_open(to, from); if (cd == (GIConv)-1) { /* Fall back to splitting by byte. */ - ret = strsplit_len(str, len); + ret = strsplit_len(str, len, onspace); goto out; } @@ -235,11 +235,25 @@ char **recode_split(const SERVER_REC *server, const char *str, */ ret[n] = NULL; g_strfreev(ret); - ret = strsplit_len(str, len); + ret = strsplit_len(str, len, onspace); goto out; } /* Outbuf overflowed, split the input string. */ + if (onspace) { + /* + * Try to find a space to split on and leave + * the space on the previous line. + */ + int i; + for (i = 0; i < inbuf - previnbuf; i++) { + if (previnbuf[inbuf-previnbuf-1-i] == ' ') { + inbuf -= i; + inbytesleft += i; + break; + } + } + } ret[n++] = g_strndup(previnbuf, inbuf - previnbuf); ret = g_renew(char *, ret, n + 1); previnbuf = inbuf; diff --git a/src/core/recode.h b/src/core/recode.h index b70ec630..719e8f54 100644 --- a/src/core/recode.h +++ b/src/core/recode.h @@ -4,7 +4,7 @@ char *recode_in (const SERVER_REC *server, const char *str, const char *target); char *recode_out (const SERVER_REC *server, const char *str, const char *target); char **recode_split(const SERVER_REC *server, const char *str, - const char *target, int len); + const char *target, int len, gboolean onspace); gboolean is_valid_charset(const char *charset); gboolean is_utf8(void); void recode_update_charset(void); diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index 375b00eb..ccf48394 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -905,10 +905,13 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str, switch (num) { case 0: - /* reset colors back to default */ + /* reset colors and attributes back to default */ fg = theme->default_color; bg = -1; - flags &= ~(GUI_PRINT_FLAG_COLOR_24_FG | GUI_PRINT_FLAG_COLOR_24_BG | GUI_PRINT_FLAG_INDENT); + flags &= ~(GUI_PRINT_FLAG_INDENT | + GUI_PRINT_FLAG_BOLD | GUI_PRINT_FLAG_ITALIC | GUI_PRINT_FLAG_UNDERLINE | + GUI_PRINT_FLAG_BLINK | GUI_PRINT_FLAG_REVERSE | + GUI_PRINT_FLAG_COLOR_24_FG | GUI_PRINT_FLAG_COLOR_24_BG); break; case 1: /* hilight */ diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 29d3f7eb..ded79c28 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -390,7 +390,8 @@ void term_set_color(TERM_WINDOW *window, int col) } /* set background color */ - if (window && (term_color256map[bg&0xff]&8) == window->term->TI_colors) + if (window && window->term->TI_colors && + (term_color256map[bg&0xff]&8) == window->term->TI_colors) col |= ATTR_BLINK; if (col & ATTR_BLINK) current_term->set_blink(current_term); @@ -413,7 +414,8 @@ void term_set_color(TERM_WINDOW *window, int col) terminfo_set_reverse(); /* bold */ - if (window && (term_color256map[fg&0xff]&8) == window->term->TI_colors) + if (window && window->term->TI_colors && + (term_color256map[fg&0xff]&8) == window->term->TI_colors) col |= ATTR_BOLD; if (col & ATTR_BOLD) terminfo_set_bold(); diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 27878989..baf8a0d2 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -85,6 +85,7 @@ static char **split_line(const SERVER_REC *server, const char *line, { const char *start = settings_get_str("split_line_start"); const char *end = settings_get_str("split_line_end"); + gboolean onspace = settings_get_bool("split_line_on_space"); char *recoded_start = recode_out(server, start, target); char *recoded_end = recode_out(server, end, target); char **lines; @@ -103,7 +104,7 @@ static char **split_line(const SERVER_REC *server, const char *line, return NULL; } - lines = recode_split(server, line, target, len); + lines = recode_split(server, line, target, len, onspace); for (i = 0; lines[i] != NULL; i++) { if (i != 0 && *start != '\0') { /* Not the first line. */ @@ -972,6 +973,7 @@ void irc_servers_init(void) settings_add_str("misc", "usermode", DEFAULT_USER_MODE); settings_add_str("misc", "split_line_start", ""); settings_add_str("misc", "split_line_end", ""); + settings_add_bool("misc", "split_line_on_space", TRUE); settings_add_time("flood", "cmd_queue_speed", DEFAULT_CMD_QUEUE_SPEED); settings_add_int("flood", "cmds_max_at_once", DEFAULT_CMDS_MAX_AT_ONCE); |