diff --git a/CMakeLists.txt b/CMakeLists.txt index ecb88d1b8..18fd7fca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ OPTION(ENABLE_NLS "Enable Native Language Support" ON) OPTION(ENABLE_GCRYPT "Enable libgcrypt support" ON) OPTION(ENABLE_GNUTLS "Enable SSLv3/TLS support" ON) OPTION(ENABLE_LARGEFILE "Enable Large File Support" ON) +OPTION(ENABLE_ZLIB "Enable Zlib support" ON) OPTION(ENABLE_ALIAS "Enable Alias plugin" ON) OPTION(ENABLE_ASPELL "Enable Aspell plugin" ON) OPTION(ENABLE_CHARSET "Enable Charset plugin" ON) diff --git a/ChangeLog b/ChangeLog index 795d77148..80566c6dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,6 +48,7 @@ Version 0.3.7 (under dev!) * irc: auto-connect to servers created with "irc://" on command line but not other servers if "-a" ("--no-connect") is given * guile: new script plugin for scheme (task #7289) +* relay: add WeeChat protocol for remote GUI * ruby: fix crash when reloading ruby plugin (bug #34474) * xfer: display origin of xfer in core and xfer buffers (task #10956) diff --git a/cmake/FindPackageHandleStandardArgs.cmake b/cmake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..1acb021e8 --- /dev/null +++ b/cmake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,260 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( ... ) +# +# This function is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE(). +# It also sets the _FOUND variable. +# The package is considered found if all variables ... listed contain +# valid results, e.g. valid filepaths. +# +# There are two modes of this function. The first argument in both modes is +# the name of the Find-module where it is called (in original casing). +# +# The first simple mode looks like this: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( (DEFAULT_MSG|"Custom failure message") ... ) +# If the variables to are all valid, then _FOUND +# will be set to TRUE. +# If DEFAULT_MSG is given as second argument, then the function will generate +# itself useful success and error messages. You can also supply a custom error message +# for the failure case. This is not recommended. +# +# The second mode is more powerful and also supports version checking: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS ...] +# [VERSION_VAR +# [CONFIG_MODE] +# [FAIL_MESSAGE "Custom failure message"] ) +# +# As above, if through are all valid, _FOUND +# will be set to TRUE. +# After REQUIRED_VARS the variables which are required for this package are listed. +# Following VERSION_VAR the name of the variable can be specified which holds +# the version of the package which has been found. If this is done, this version +# will be checked against the (potentially) specified required version used +# in the find_package() call. The EXACT keyword is also handled. The default +# messages include information about the required version and the version +# which has been actually found, both if the version is ok or not. +# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for +# a find_package(... NO_MODULE) call, in this case all the information +# provided by the config-mode of find_package() will be evaluated +# automatically. +# Via FAIL_MESSAGE a custom failure message can be specified, if this is not +# used, the default message will be displayed. +# +# Example for mode 1: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, success will be reported, including the content of . +# On repeated Cmake runs, the same message won't be printed again. +# +# Example for mode 2: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE +# VERSION_VAR BISON_VERSION) +# In this case, BISON is considered to be found if the variable(s) listed +# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case. +# Also the version of BISON will be checked by using the version contained +# in BISON_VERSION. +# Since no FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) +# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE) +# and adds an additional search directory for automoc4. +# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +INCLUDE(FindPackageMessage) +INCLUDE(CMakeParseArguments) + +# internal helper macro +MACRO(_FPHSA_FAILURE_MESSAGE _msg) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_msg}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_msg}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) +ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg) + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + IF(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + ELSE(${_NAME}_CONFIG) + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + IF(${_NAME}_CONSIDERED_CONFIGS) + SET(configsText "") + LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + MATH(EXPR configsCount "${configsCount} - 1") + FOREACH(currentConfigIndex RANGE ${configsCount}) + LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + SET(configsText "${configsText} ${filename} (version ${version})\n") + ENDFOREACH(currentConfigIndex) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + ELSE(${_NAME}_CONSIDERED_CONFIGS) + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + ENDIF(${_NAME}_CONSIDERED_CONFIGS) + ENDIF(${_NAME}_CONFIG) +ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + + +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + +# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in +# new extended or in the "old" mode: + SET(options CONFIG_MODE) + SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) + SET(multiValueArgs REQUIRED_VARS) + SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + IF(${INDEX} EQUAL -1) + SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + SET(FPHSA_REQUIRED_VARS ${ARGN}) + SET(FPHSA_VERSION_VAR) + ELSE(${INDEX} EQUAL -1) + + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + IF(FPHSA_UNPARSED_ARGUMENTS) + MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + ENDIF(FPHSA_UNPARSED_ARGUMENTS) + + IF(NOT FPHSA_FAIL_MESSAGE) + SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + ENDIF(NOT FPHSA_FAIL_MESSAGE) + ENDIF(${INDEX} EQUAL -1) + +# now that we collected all arguments, process them + + IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + IF(FPHSA_CONFIG_MODE) + LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + SET(FPHSA_VERSION_VAR ${_NAME}_VERSION) + ENDIF(FPHSA_CONFIG_MODE) + + IF(NOT FPHSA_REQUIRED_VARS) + MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + ENDIF(NOT FPHSA_REQUIRED_VARS) + + LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + STRING(TOUPPER ${_NAME} _NAME_UPPER) + STRING(TOLOWER ${_NAME} _NAME_LOWER) + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + SET(MISSING_VARS "") + SET(DETAILS "") + SET(${_NAME_UPPER}_FOUND TRUE) + # check if all passed variables are valid + FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + ELSE(NOT ${_CURRENT_VAR}) + SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + + # version handling: + SET(VERSION_MSG "") + SET(VERSION_OK TRUE) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) + IF (${_NAME}_FIND_VERSION) + + IF(VERSION) + + IF(${_NAME}_FIND_VERSION_EXACT) # exact version required + IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + + ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: + IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") + ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ELSE(VERSION) + + # if the package was not found, but a version was given, add that to the output: + IF(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + ELSE(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ENDIF(VERSION) + ELSE (${_NAME}_FIND_VERSION) + IF(VERSION) + SET(VERSION_MSG "(found version \"${VERSION}\")") + ENDIF(VERSION) + ENDIF (${_NAME}_FIND_VERSION) + + IF(VERSION_OK) + SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + ELSE(VERSION_OK) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(VERSION_OK) + + + # print the result: + IF (${_NAME_UPPER}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") + ELSE (${_NAME_UPPER}_FOUND) + + IF(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + ELSE(FPHSA_CONFIG_MODE) + IF(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ELSE(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ENDIF(NOT VERSION_OK) + ENDIF(FPHSA_CONFIG_MODE) + + ENDIF (${_NAME_UPPER}_FOUND) + + SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) + +ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG) diff --git a/cmake/FindZLIB.cmake b/cmake/FindZLIB.cmake new file mode 100644 index 000000000..f7161c0ba --- /dev/null +++ b/cmake/FindZLIB.cmake @@ -0,0 +1,77 @@ +# - Find zlib +# Find the native ZLIB includes and library. +# Once done this will define +# +# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. +# ZLIB_LIBRARIES - List of libraries when using zlib. +# ZLIB_FOUND - True if zlib found. +# +# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) +# ZLIB_VERSION_MAJOR - The major version of zlib +# ZLIB_VERSION_MINOR - The minor version of zlib +# ZLIB_VERSION_PATCH - The patch version of zlib +# ZLIB_VERSION_TWEAK - The tweak version of zlib +# +# The following variable are provided for backward compatibility +# +# ZLIB_MAJOR_VERSION - The major version of zlib +# ZLIB_MINOR_VERSION - The minor version of zlib +# ZLIB_PATCH_VERSION - The patch version of zlib + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +FIND_PATH(ZLIB_INCLUDE_DIR zlib.h + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include" +) + +SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) +FIND_LIBRARY(ZLIB_LIBRARY + NAMES + ${ZLIB_NAMES} + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib" +) +MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) + +IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") + + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") + + # only append a TWEAK version if it exists: + SET(ZLIB_VERSION_TWEAK "") + IF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + + SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") + SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") + SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") +ENDIF() + +# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR + VERSION_VAR ZLIB_VERSION_STRING) + +IF(ZLIB_FOUND) + SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) + SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) +ENDIF() + diff --git a/configure.in b/configure.in index 64f1f15b1..876f74f74 100644 --- a/configure.in +++ b/configure.in @@ -102,6 +102,7 @@ AH_VERBATIM([HAVE_GCRYPT], [#undef HAVE_GCRYPT]) AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS]) AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK]) AH_VERBATIM([HAVE_EAT_NEWLINE_GLITCH], [#undef HAVE_EAT_NEWLINE_GLITCH]) +AH_VERBATIM([HAVE_ZLIB], [#undef HAVE_ZLIB]) AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS]) AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL]) AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET]) @@ -127,6 +128,7 @@ AC_ARG_ENABLE(ncurses, [ --disable-ncurses turn off ncurses interfac AC_ARG_ENABLE(gtk, [ --enable-gtk turn on Gtk interface (default=off)],enable_gtk=$enableval,enable_gtk=no) AC_ARG_ENABLE(gcrypt, [ --disable-gcrypt turn off gcrypt support (default=compiled if found)],enable_gcrypt=$enableval,enable_gcrypt=yes) AC_ARG_ENABLE(gnutls, [ --disable-gnutls turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes) +AC_ARG_ENABLE(zlib, [ --disable-zlib turn off zlib support (default=compiled if found)],enable_zlib=$enableval,enable_zlib=yes) AC_ARG_ENABLE(largefile, [ --disable-largefile turn off Large File Support (default=on)],enable_largefile=$enableval,enable_largefile=yes) AC_ARG_ENABLE(alias, [ --disable-alias turn off Alias plugin (default=compiled)],enable_alias=$enableval,enable_alias=yes) AC_ARG_ENABLE(aspell, [ --disable-aspell turn off Aspell plugin (default=compiled)],enable_aspell=$enableval,enable_aspell=yes) @@ -897,6 +899,36 @@ else not_found="$not_found eat_newline_glitch" fi +# ------------------------------------------------------------------------------ +# zlib +# ------------------------------------------------------------------------------ + +if test "x$enable_zlib" = "xyes" ; then + AC_CHECK_HEADER(zlib.h,ac_found_zlib_header="yes",ac_found_zlib_header="no") + AC_CHECK_LIB(z,compress2,ac_found_zlib_lib="yes",ac_found_zlib_lib="no") + + AC_MSG_CHECKING(for zlib headers and librairies) + if test "x$ac_found_zlib_header" = "xno" -o "x$ac_found_zlib_lib" = "xno" ; then + AC_MSG_RESULT(no) + AC_MSG_WARN([ +*** zlib was not found. You may want to get it from http://zlib.net/ +*** WeeChat will be built without zlib support. +*** Compression of packets in Relay plugin will be disabled (for WeeChat protocol).]) + enable_zlib="no" + not_found="$not_found zlib" + else + AC_MSG_RESULT(yes) + ZLIB_CFLAGS=`pkg-config zlib --cflags` + ZLIB_LFLAGS=`pkg-config zlib --libs` + AC_SUBST(ZLIB_CFLAGS) + AC_SUBST(ZLIB_LFLAGS) + AC_DEFINE(HAVE_ZLIB) + CFLAGS="$CFLAGS -DHAVE_ZLIB" + fi +else + not_asked="$not_asked zlib" +fi + # ------------------------------------------------------------------------------ # documentation # ------------------------------------------------------------------------------ @@ -1015,6 +1047,7 @@ CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENS # ------------------------------------------------------------------------------ AM_CONDITIONAL(HAVE_GCRYPT, test "$enable_gcrypt" = "yes") +AM_CONDITIONAL(HAVE_ZLIB, test "$enable_zlib" = "yes") AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes") AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes") @@ -1145,6 +1178,9 @@ listoptional="" if test "x$enable_gcrypt" = "xyes"; then listoptional="$listoptional gcrypt" fi +if test "x$enable_zlib" = "xyes"; then + listoptional="$listoptional zlib" +fi if test "x$enable_gnutls" = "xyes"; then listoptional="$listoptional gnutls" fi diff --git a/debian/control b/debian/control index 5b8678bfa..1e7766de7 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Emmanuel Bouthenot Build-Depends-Indep: asciidoc (>= 8.5), source-highlight Build-Depends: debhelper (>= 7.0.50), cmake, libncursesw5-dev, ruby1.9.1, ruby1.9.1-dev, libperl-dev, python-dev, libaspell-dev, liblua5.1-0-dev, - tcl8.5-dev, guile-1.8-dev, libgcrypt11-dev, libgnutls-dev, dpkg-dev (>= 1.13.19), - pkg-config + tcl8.5-dev, guile-1.8-dev, libgcrypt11-dev, libgnutls-dev, zlib1g-dev, + dpkg-dev (>= 1.13.19), pkg-config Standards-Version: 3.9.2 Homepage: http://weechat.org/ Vcs-Git: git://git.debian.org/users/kolter/weechat.git diff --git a/debian/weechat-doc.doc-base.relay-protocol-en b/debian/weechat-doc.doc-base.relay-protocol-en new file mode 100644 index 000000000..bd81ef1f0 --- /dev/null +++ b/debian/weechat-doc.doc-base.relay-protocol-en @@ -0,0 +1,10 @@ +Document: weechat-relay-protocol-en +Title: WeeChat Relay Protocol (English) +Author: Sebastien Helleu +Abstract: This manual describes WeeChat Relay Protocol, used by +remote GUI to communicate with Relay plugin (English version). +Section: Network/Communication + +Format: HTML +Index: /usr/share/doc/weechat-doc/html/weechat_relay_protocol.en.html +Files: /usr/share/doc/weechat-doc/html/weechat_relay_protocol.en.html diff --git a/doc/de/autogen/user/relay_options.txt b/doc/de/autogen/user/relay_options.txt index 37aef4314..cc50e82b3 100644 --- a/doc/de/autogen/user/relay_options.txt +++ b/doc/de/autogen/user/relay_options.txt @@ -48,11 +48,21 @@ ** Typ: integer ** Werte: 0 .. 65535 (Standardwert: `256`) +* [[option_relay.network.allowed_ips]] *relay.network.allowed_ips* +** Beschreibung: `regular expression with IPs allowed to use relay, example: "^(123.45.67.89|192.160.*)$"` +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: `""`) + * [[option_relay.network.bind_address]] *relay.network.bind_address* ** Beschreibung: `Adresse für Bind (falls nicht gesetzt ist eine Verbindung zu allen Interfaces möglich. Wird die Adresse "127.0.0.1" genutzt kann nur eine Verbindung mit dem lokalen Rechner hergestellt werden)` ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) +* [[option_relay.network.compression_level]] *relay.network.compression_level* +** Beschreibung: `compression level for packets sent to client with WeeChat protocol (0 = disable compression, 1 = low compression ... 9 = best compression)` +** Typ: integer +** Werte: 0 .. 9 (Standardwert: `6`) + * [[option_relay.network.max_clients]] *relay.network.max_clients* ** Beschreibung: `Maximale Anzahl an Clients die mit einem Port verbunden sein dürfen` ** Typ: integer diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt index e18ab6e60..aa2c5bd13 100644 --- a/doc/en/CMakeLists.txt +++ b/doc/en/CMakeLists.txt @@ -95,3 +95,14 @@ ADD_CUSTOM_COMMAND( ) ADD_CUSTOM_TARGET(doc-dev-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat_dev.en.html) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat_dev.en.html DESTINATION ${SHAREDIR}/doc/${PROJECT_NAME}) + +# relay protocol +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.en.html + COMMAND ${ASCIIDOC_EXECUTABLE} ARGS -a toc -a toclevels=4 -a date=`date "+%F"` -a revision="${VERSION}" -a stylesheet=${CMAKE_CURRENT_SOURCE_DIR}/../asciidoc.css -f ${CMAKE_CURRENT_SOURCE_DIR}/../asciidoc.conf -n -o ${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.en.html ${CMAKE_CURRENT_SOURCE_DIR}/weechat_relay_protocol.en.txt + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/weechat_relay_protocol.en.txt + COMMENT "Building weechat_relay_protocol.en.html" +) +ADD_CUSTOM_TARGET(doc-relay-protocol-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.en.html) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat_relay_protocol.en.html DESTINATION ${SHAREDIR}/doc/${PROJECT_NAME}) diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am index e6d0d6366..da96305a9 100644 --- a/doc/en/Makefile.am +++ b/doc/en/Makefile.am @@ -28,6 +28,7 @@ EXTRA_DIST = CMakeLists.txt \ weechat_quickstart.en.txt \ weechat_tester.en.txt \ weechat_dev.en.txt \ + weechat_relay_protocol.en.txt \ $(wildcard autogen/user/*.txt) \ $(wildcard autogen/plugin_api/*.txt) @@ -37,7 +38,8 @@ all-local: weechat_user.en.html \ weechat_faq.en.html \ weechat_quickstart.en.html \ weechat_tester.en.html \ - weechat_dev.en.html + weechat_dev.en.html \ + weechat_relay_protocol.en.html # user's guide weechat_user.en.html: weechat_user.en.txt $(wildcard autogen/user/*.txt) @@ -67,6 +69,10 @@ weechat_tester.en.html: weechat_tester.en.txt weechat_dev.en.html: weechat_dev.en.txt $(ASCIIDOC) -a toc -a toclevels=4 -a date=`date "+%F"` -a revision="$(VERSION)" -a stylesheet=$(abs_top_srcdir)/doc/asciidoc.css -f $(abs_top_srcdir)/doc/asciidoc.conf -n -o weechat_dev.en.html $(abs_top_srcdir)/doc/en/weechat_dev.en.txt +# relay protocol +weechat_relay_protocol.en.html: weechat_relay_protocol.en.txt + $(ASCIIDOC) -a toc -a toclevels=4 -a date=`date "+%F"` -a revision="$(VERSION)" -a stylesheet=$(abs_top_srcdir)/doc/asciidoc.css -f $(abs_top_srcdir)/doc/asciidoc.conf -n -o weechat_relay_protocol.en.html $(abs_top_srcdir)/doc/en/weechat_relay_protocol.en.txt + # install docs install-data-hook: diff --git a/doc/en/autogen/user/relay_options.txt b/doc/en/autogen/user/relay_options.txt index 9e5dc5a5b..e11887a88 100644 --- a/doc/en/autogen/user/relay_options.txt +++ b/doc/en/autogen/user/relay_options.txt @@ -48,11 +48,21 @@ ** type: integer ** values: 0 .. 65535 (default value: `256`) +* [[option_relay.network.allowed_ips]] *relay.network.allowed_ips* +** description: `regular expression with IPs allowed to use relay, example: "^(123.45.67.89|192.160.*)$"` +** type: string +** values: any string (default value: `""`) + * [[option_relay.network.bind_address]] *relay.network.bind_address* ** description: `address for bind (if empty, connection is possible on all interfaces, use "127.0.0.1" to allow connections from local machine only)` ** type: string ** values: any string (default value: `""`) +* [[option_relay.network.compression_level]] *relay.network.compression_level* +** description: `compression level for packets sent to client with WeeChat protocol (0 = disable compression, 1 = low compression ... 9 = best compression)` +** type: integer +** values: 0 .. 9 (default value: `6`) + * [[option_relay.network.max_clients]] *relay.network.max_clients* ** description: `maximum number of clients connecting to a port` ** type: integer diff --git a/doc/en/weechat_dev.en.txt b/doc/en/weechat_dev.en.txt index 652284e30..ff67fb138 100644 --- a/doc/en/weechat_dev.en.txt +++ b/doc/en/weechat_dev.en.txt @@ -159,113 +159,117 @@ Plugins [width="100%",cols="1l,5",options="header"] |======================================== -| Path/file | Description -| plugins/ | Root of plugins -| plugin.c | Plugins management (load/unload dynamic C libraries) -| plugin-api.c | Extra functions for plugin API (wrapper around WeeChat core functions) -| plugin-config.c | Plugin configuration options (file plugins.conf) -| weechat-plugin.h | Header designed to be distributed with WeeChat plugins, in order to compile them -| alias/ | Alias plugin -| alias.c | Main alias functions -| alias-config.c | Alias config options -| alias-info.c | Info and infolists from alias plugin -| aspell/ | Aspell plugin -| weechat-aspell.c | Main aspell functions -| weechat-aspell-config.c | Aspell config options -| weechat-aspell-speller.c | Spellers management -| charset/ | Charset plugin -| charset.c | Charset functions -| demo/ | Demo plugin -| demo.c | Demo functions -| fifo/ | Fifo plugin -| fifo.c | Main fifo functions -| fifo-info.c | Info and infolists from fifo plugin -| irc/ | IRC (Internet Relay Chat) plugin -| irc.c | Main IRC functions -| irc-bar-item.c | IRC bar items -| irc-buffer.c | IRC buffers -| irc-channel.c | IRC channels -| irc-color.c | Color functions -| irc-command.c | IRC commands -| irc-completion.c | IRC completions -| irc-config.c | IRC config options -| irc-ctcp.c | IRC CTCP -| irc-debug.c | IRC debug functions -| irc-display.c | IRC display functions -| irc-ignore.c | IRC Ignore -| irc-info.c | Info and infolists from IRC plugin -| irc-input.c | Input of commands/text -| irc-message.c | Functions to manipulate IRC messages -| irc-mode.c | Functions about channel/nick modes -| irc-msgbuffer.c | Target buffer for IRC messages -| irc-nick.c | IRC nicks -| irc-notify.c | IRC notify lists -| irc-protocol.c | IRC protocol -| irc-raw.c | IRC raw buffer -| irc-redirect.c | Redirection of IRC command output -| irc-sasl.c | SASL authentication with IRC server -| irc-server.c | I/O communication with IRC servers -| irc-upgrade.c | Save/restore IRC data when upgrading WeeChat -| logger/ | Logger plugin -| logger.c | Main logger functions -| logger-buffer.c | Logger buffer list management -| logger-config.c | Logger config options -| logger-info.c | Info and infolists from logger plugin -| logger-tail.c | Return last lines of a file -| relay/ | Relay plugin (IRC proxy and relay for remote interfaces) -| relay.c | Main relay functions -| relay-buffer.c | Relay buffer -| relay-client-irc.c | IRC proxy -| relay-client-weechat.c | Relay for remote interface -| relay-client.c | Clients of relay -| relay-command.c | Relay commands -| relay-completion.c | Relay completions -| relay-config.c | Relay config options -| relay-info.c | Info and infolists from relay plugin -| relay-raw.c | Relay raw buffer -| relay-server.c | Relay server -| relay-upgrade.c | Save/restore relay data when upgrading WeeChat -| rmodifier/ | Rmodifier plugin -| rmodifier.c | Main rmodifier functions -| rmodifier-command.c | Rmodifier commands -| rmodifier-completion.c | Rmodifier completions -| rmodifier-config.c | Rmodifier config options -| rmodifier-debug.c | Rmodifier debug functions -| rmodifier-info.c | Info and infolists from rmodifier plugin -| scripts/ | Scripting API -| script.c | Common functions used by script plugins -| script-api.c | Script API functions: wrappers around some plugin API functions -| script-callback.c | Callback management for scripts -| python/ | Python plugin -| weechat-python.c | Main python functions (load/unload scripts, execute python code) -| weechat-python-api.c | Python scripting API functions -| perl/ | Perl plugin -| weechat-perl.c | Main perl functions (load/unload scripts, execute perl code) -| weechat-perl-api.c | Perl scripting API functions -| ruby/ | Ruby plugin -| weechat-ruby.c | Main ruby functions (load/unload scripts, execute ruby code) -| weechat-ruby-api.c | Ruby scripting API functions -| lua/ | Lua plugin -| weechat-lua.c | Main lua functions (load/unload scripts, execute lua code) -| weechat-lua-api.c | Lua scripting API functions -| tcl/ | Tcl plugin -| weechat-tcl.c | Main tcl functions (load/unload scripts, execute tcl code) -| weechat-tcl-api.c | Tcl scripting API functions -| guile/ | Guile (scheme) plugin -| weechat-guile.c | Main guile functions (load/unload scripts, execute guile code) -| weechat-guile-api.c | Guile scripting API functions -| xfer/ | Xfer plugin (IRC DCC file/chat) -| xfer.c | Main xfer functions -| xfer-buffer.c | Xfer buffer -| xfer-chat.c | Xfer DCC chat -| xfer-command.c | Xfer commands -| xfer-completion.c | Xfer completions -| xfer-config.c | Xfer config options -| xfer-dcc.c | Xfer DCC file -| xfer-file.c | File functions for xfer -| xfer-info.c | Info and infolists from xfer plugin -| xfer-network.c | Network functions for xfer -| xfer-upgrade.c | Save/restore xfer data when upgrading WeeChat +| Path/file | Description +| plugins/ | Root of plugins +| plugin.c | Plugins management (load/unload dynamic C libraries) +| plugin-api.c | Extra functions for plugin API (wrapper around WeeChat core functions) +| plugin-config.c | Plugin configuration options (file plugins.conf) +| weechat-plugin.h | Header designed to be distributed with WeeChat plugins, in order to compile them +| alias/ | Alias plugin +| alias.c | Main alias functions +| alias-config.c | Alias config options +| alias-info.c | Info and infolists from alias plugin +| aspell/ | Aspell plugin +| weechat-aspell.c | Main aspell functions +| weechat-aspell-config.c | Aspell config options +| weechat-aspell-speller.c | Spellers management +| charset/ | Charset plugin +| charset.c | Charset functions +| demo/ | Demo plugin +| demo.c | Demo functions +| fifo/ | Fifo plugin +| fifo.c | Main fifo functions +| fifo-info.c | Info and infolists from fifo plugin +| irc/ | IRC (Internet Relay Chat) plugin +| irc.c | Main IRC functions +| irc-bar-item.c | IRC bar items +| irc-buffer.c | IRC buffers +| irc-channel.c | IRC channels +| irc-color.c | Color functions +| irc-command.c | IRC commands +| irc-completion.c | IRC completions +| irc-config.c | IRC config options +| irc-ctcp.c | IRC CTCP +| irc-debug.c | IRC debug functions +| irc-display.c | IRC display functions +| irc-ignore.c | IRC Ignore +| irc-info.c | Info and infolists from IRC plugin +| irc-input.c | Input of commands/text +| irc-message.c | Functions to manipulate IRC messages +| irc-mode.c | Functions about channel/nick modes +| irc-msgbuffer.c | Target buffer for IRC messages +| irc-nick.c | IRC nicks +| irc-notify.c | IRC notify lists +| irc-protocol.c | IRC protocol +| irc-raw.c | IRC raw buffer +| irc-redirect.c | Redirection of IRC command output +| irc-sasl.c | SASL authentication with IRC server +| irc-server.c | I/O communication with IRC servers +| irc-upgrade.c | Save/restore IRC data when upgrading WeeChat +| logger/ | Logger plugin +| logger.c | Main logger functions +| logger-buffer.c | Logger buffer list management +| logger-config.c | Logger config options +| logger-info.c | Info and infolists from logger plugin +| logger-tail.c | Return last lines of a file +| relay/ | Relay plugin (IRC proxy and relay for remote interfaces) +| relay.c | Main relay functions +| relay-buffer.c | Relay buffer +| relay-client.c | Clients of relay +| relay-command.c | Relay commands +| relay-completion.c | Relay completions +| relay-config.c | Relay config options +| relay-info.c | Info and infolists from relay plugin +| relay-raw.c | Relay raw buffer +| relay-server.c | Relay server +| relay-upgrade.c | Save/restore relay data when upgrading WeeChat +| irc/ | IRC proxy +| relay-irc.c | Main IRC proxy functions +| weechat/ | Relay for remote interface +| relay-weechat.c | Relay for remote interface (main functions) +| relay-weechat-msg.c | Send binary messages to clients +| relay-weechat-protocol.c | Read commands from clients +| rmodifier/ | Rmodifier plugin +| rmodifier.c | Main rmodifier functions +| rmodifier-command.c | Rmodifier commands +| rmodifier-completion.c | Rmodifier completions +| rmodifier-config.c | Rmodifier config options +| rmodifier-debug.c | Rmodifier debug functions +| rmodifier-info.c | Info and infolists from rmodifier plugin +| scripts/ | Scripting API +| script.c | Common functions used by script plugins +| script-api.c | Script API functions: wrappers around some plugin API functions +| script-callback.c | Callback management for scripts +| python/ | Python plugin +| weechat-python.c | Main python functions (load/unload scripts, execute python code) +| weechat-python-api.c | Python scripting API functions +| perl/ | Perl plugin +| weechat-perl.c | Main perl functions (load/unload scripts, execute perl code) +| weechat-perl-api.c | Perl scripting API functions +| ruby/ | Ruby plugin +| weechat-ruby.c | Main ruby functions (load/unload scripts, execute ruby code) +| weechat-ruby-api.c | Ruby scripting API functions +| lua/ | Lua plugin +| weechat-lua.c | Main lua functions (load/unload scripts, execute lua code) +| weechat-lua-api.c | Lua scripting API functions +| tcl/ | Tcl plugin +| weechat-tcl.c | Main tcl functions (load/unload scripts, execute tcl code) +| weechat-tcl-api.c | Tcl scripting API functions +| guile/ | Guile (scheme) plugin +| weechat-guile.c | Main guile functions (load/unload scripts, execute guile code) +| weechat-guile-api.c | Guile scripting API functions +| xfer/ | Xfer plugin (IRC DCC file/chat) +| xfer.c | Main xfer functions +| xfer-buffer.c | Xfer buffer +| xfer-chat.c | Xfer DCC chat +| xfer-command.c | Xfer commands +| xfer-completion.c | Xfer completions +| xfer-config.c | Xfer config options +| xfer-dcc.c | Xfer DCC file +| xfer-file.c | File functions for xfer +| xfer-info.c | Info and infolists from xfer plugin +| xfer-network.c | Network functions for xfer +| xfer-upgrade.c | Save/restore xfer data when upgrading WeeChat |======================================== [[documentation]] diff --git a/doc/en/weechat_relay_protocol.en.txt b/doc/en/weechat_relay_protocol.en.txt new file mode 100644 index 000000000..cf63b44ee --- /dev/null +++ b/doc/en/weechat_relay_protocol.en.txt @@ -0,0 +1,708 @@ +WeeChat Relay Protocol +====================== +Sébastien Helleu + + +This document is the specification of WeeChat relay protocol: the protocol used +to relay WeeChat data to clients, which are mostly remote interfaces (GUI). + +[WARNING] +This document is a *DRAFT*. + +The protocol is under heavy development and is *NOT READY* for usage. Stay tuned! + + +[[introduction]] +Introduction +------------ + +[[terminology]] +Terminology +~~~~~~~~~~~ + +The following terms are used in this document: + +* 'relay': this is the WeeChat with relay plugin, which acts as "server" and + allows 'clients' to connect +* 'client': this is another software, connected to 'relay' via a network + connection; in most cases, this 'client' is a remote GUI + +[[network_diagram]] +Network diagram +~~~~~~~~~~~~~~~ + +The 'clients' are connected to 'relay' like shown in this diagram: + +....................................... + ┌──────────┐ + ┌────────┐ ┌─────┤ client 1 │ Workstation (Linux, BSD, Mac OS X, Windows, ...) + │ irc │◄───┐ ╔═════════════╤═══════╗ │ └──────────┘ + └────────┘ └───╢ │ ║◄─────┘ ┌──────────┐ + ...... ║ WeeChat │ Relay ║◄───────────┤ client 2 │ Mobile device (Android, iPhone, ...) + ┌────────┐ ┌───╢ │ ║◄─────┐ └──────────┘ + │ jabber │◄───┘ ╚═════════════╧═══════╝ │ ...... + └────────┘ │ ┌──────────┐ + ...... └─────┤ client N │ Other devices + └──────────┘ + + +└─────────────┘ └─────────────────────┘╘══════════╛└──────────────────────┘ +network servers ncurses interface relay graphical interfaces + protocol +........................................ + +[NOTE] +All clients here are clients using 'weechat' protocol in 'relay' plugin. The +'relay' plugin also allows IRC clients, then 'relay' plugin acts as an +'irc proxy' (not described in this document). + +[[protocol_generalities]] +Protocol generalities +--------------------- + +* Connections from 'client' to 'relay' are made using TCP sockets on IP/port + used by 'relay' plugin to listen to new connections + (option 'relay.port.weechat' in WeeChat). +* Number of 'clients' is not limited. +* Each 'client' is independent from other clients. +* Messages from 'client' to 'relay' are called 'commands', they are sent as text + (a string). +* Messages from 'relay' to 'client' are called 'messages', they are sent as + binary data. + +[[commands]] +Commands (client → relay) +------------------------- + +Commands have format: "(id) command arguments\n". + +Fields are: + +* 'id': optional message identifier that will be sent in answer from 'relay'; + it must be enclosed in parentheses, and must not start with an underscore + ("_") (ids starting with underscore are reserved for WeeChat 'event' messages) +* 'command': a command (see table below) +* 'arguments': optional arguments for command (many arguments are separated by + spaces) + +List of available commands (detail in next chapters): + +[width="60%",cols="^3m,14",options="header"] +|===================================================== +| Command | Description +| init | Initialize connection with 'relay' +| hdata | Request hdata +| info | Request info +| infolist | Request infolist +| nicklist | Request nicklist +| input | Send data to a buffer (text or command) +| quit | Disconnect from 'relay' +|===================================================== + +[[command_init]] +init +~~~~ + +Initialize connection with 'relay'. This must be first command sent to 'relay'. +If not sent, 'relay' will close connection on first command received, without +warning. + +Syntax: + +---------------------------------------- +init [