1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 19:23:13 +02:00

Compare commits

...

11 Commits

Author SHA1 Message Date
Sébastien Helleu 90e7857e62 Version 4.0.6 2023-10-26 21:01:46 +02:00
Sébastien Helleu 480d603eb5 core: fix crash when a custom bar item name is already used by a default bar item (issue #2034) 2023-10-23 13:11:02 +02:00
Sébastien Helleu 3184bb92e6 core: make libintl.h required if CMake option ENABLE_NLS is enabled (issue #2031) 2023-10-15 14:58:26 +02:00
Sébastien Helleu 753a2adffc irc: move value -all at the end of completions for command /ignore del 2023-10-09 20:07:39 +02:00
Sébastien Helleu 020c8145b6 irc: fix memory leak when joining channels with keys 2023-10-07 20:34:41 +02:00
Sébastien Helleu a33f0d2132 core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026) 2023-10-05 19:05:02 +02:00
Sébastien Helleu 7a3ae654be core: use larger buffer for errors when creating a filter 2023-10-05 19:02:38 +02:00
LuK1337 64403cefc1 core: fix TOTP moving factor on big-endian systems 2023-09-25 13:52:00 +02:00
LuK1337 9621c4381b tests: use correct data type method in hdata tests 2023-09-25 13:51:05 +02:00
LuK1337 0ff08971aa tests: cast infolist time variable value to the correct data type 2023-09-25 13:50:58 +02:00
Sébastien Helleu 19bb049325 Version 4.0.6-dev 2023-09-24 09:34:52 +02:00
21 changed files with 251 additions and 132 deletions
+6 -14
View File
@@ -200,20 +200,6 @@ if(ENABLE_LARGEFILE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES) add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES)
endif() endif()
# Check for Gettext
if(ENABLE_NLS)
find_package(Gettext)
if(GETTEXT_FOUND)
add_definitions(-DENABLE_NLS)
find_package(Intl)
if(Intl_FOUND)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
endif()
else()
message(SEND_ERROR "Gettext not found")
endif()
endif()
# Check for libgcrypt # Check for libgcrypt
find_package(GCRYPT REQUIRED) find_package(GCRYPT REQUIRED)
add_definitions(-DHAVE_GCRYPT) add_definitions(-DHAVE_GCRYPT)
@@ -258,7 +244,13 @@ endif()
add_subdirectory(icons) add_subdirectory(icons)
if(ENABLE_NLS) if(ENABLE_NLS)
find_package(Gettext REQUIRED)
add_definitions(-DENABLE_NLS)
find_package(Intl REQUIRED)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
add_subdirectory(po) add_subdirectory(po)
else()
add_custom_target(translations COMMAND true)
endif() endif()
add_subdirectory(src) add_subdirectory(src)
+14
View File
@@ -10,6 +10,20 @@ This document lists all the changes for each version. +
For a list of important changes that require manual actions, please look at release notes. For a list of important changes that require manual actions, please look at release notes.
[[v4.0.6]]
== Version 4.0.6 (2023-10-26)
Bug fixes::
* core: fix crash when a custom bar item name is already used by a default bar item (issue #2034)
* core: fix generation of TOTP on Big Endian systems (issue #2021)
* irc: move value `-all` at the end of completions for command `/ignore del`
* irc: fix memory leak when joining channels with keys
Build::
* core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026, issue #2031)
[[v4.0.5]] [[v4.0.5]]
== Version 4.0.5 (2023-09-24) == Version 4.0.5 (2023-09-24)
+13
View File
@@ -11,6 +11,19 @@ It is recommended to read it when upgrading to a new stable version. +
For a complete list of changes, please look at ChangeLog. For a complete list of changes, please look at ChangeLog.
[[v4.0.6]]
== Version 4.0.6 (2023-10-26)
[[v4.0.6_custom_bar_items]]
=== Custom bar items
Custom bar items must now have a different name than default bar items
(for example the custom bar item name `time` is now forbidden).
If you have such names in your config, WeeChat will now fail to load them
(this should not happen anyway, since such bar items can not be properly used
and can cause a crash of WeeChat).
[[v4.0.5]] [[v4.0.5]]
== Version 4.0.5 (2023-09-24) == Version 4.0.5 (2023-09-24)
+22 -20
View File
@@ -45,26 +45,28 @@ set(CMAKE_REQUIRED_INCLUDES ${LIBINTL_INCLUDE})
check_include_files(libintl.h HAVE_LIBINTL_H) check_include_files(libintl.h HAVE_LIBINTL_H)
if(HAVE_LIBINTL_H) if(NOT HAVE_LIBINTL_H)
check_function_exists(dgettext LIBC_HAS_DGETTEXT) message(SEND_ERROR "Header libintl.h not found, required if ENABLE_NLS is enabled")
if(LIBC_HAS_DGETTEXT) endif()
set(GETTEXT_FOUND TRUE)
else() check_function_exists(dgettext LIBC_HAS_DGETTEXT)
find_library(LIBINTL_LIBRARY NAMES intl if(LIBC_HAS_DGETTEXT)
PATHS set(GETTEXT_FOUND TRUE)
/usr/local/lib else()
/usr/lib find_library(LIBINTL_LIBRARY NAMES intl
) PATHS
if(LIBINTL_LIBRARY) /usr/local/lib
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") /usr/lib
set(CMAKE_REQUIRED_LIBRARIES "iconv") )
check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) if(LIBINTL_LIBRARY)
else() if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) set(CMAKE_REQUIRED_LIBRARIES "iconv")
endif() check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT)
if(LIBINTL_HAS_DGETTEXT) else()
set(GETTEXT_FOUND TRUE) check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
endif() endif()
if(LIBINTL_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
endif() endif()
endif() endif()
endif() endif()
-1
View File
@@ -1,4 +1,3 @@
#cmakedefine HAVE_LIBINTL_H
#cmakedefine HAVE_SYS_RESOURCE_H #cmakedefine HAVE_SYS_RESOURCE_H
#cmakedefine HAVE_FLOCK #cmakedefine HAVE_FLOCK
#cmakedefine HAVE_LANGINFO_CODESET #cmakedefine HAVE_LANGINFO_CODESET
+52 -56
View File
@@ -17,6 +17,11 @@
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>. # along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
# #
# Check for programs xgettext, msgmerge and msgfmt
find_program(XGETTEXT_EXECUTABLE xgettext REQUIRED)
find_program(MSGMERGE_EXECUTABLE msgmerge REQUIRED)
find_program(MSGFMT_EXECUTABLE msgfmt REQUIRED)
set(PO_FILES set(PO_FILES
cs.po cs.po
de.po de.po
@@ -39,70 +44,61 @@ set(POT_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${POT_FILE}")
include(srcfiles.cmake) include(srcfiles.cmake)
# Looking for xgettext, msgmerge and msgfmt # Create PO template file weechat.pot
find_program(XGETTEXT_EXECUTABLE xgettext) set(SRC_FILES)
find_program(MSGMERGE_EXECUTABLE msgmerge) set(POT_DEPENDS)
find_program(MSGFMT_EXECUTABLE msgfmt)
if(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE) foreach(srcfile ${WEECHAT_SOURCES})
set(SRC_FILES ${SRC_FILES} ${srcfile})
set(POT_DEPENDS ${POT_DEPENDS} "${CMAKE_SOURCE_DIR}/${srcfile}")
endforeach()
# Create PO template file weechat.pot add_custom_command(
set(SRC_FILES) OUTPUT "${POT_FILE_PATH}"
set(POT_DEPENDS) COMMAND "${XGETTEXT_EXECUTABLE}"
ARGS -o "${POT_FILE_PATH}" --add-comments='TRANSLATORS:' --keyword='_' --keyword='weechat_gettext' --keyword='N_' --keyword='NG_:1,2' --keyword='weechat_ngettext:1,2' --no-location --from-code=UTF-8 --directory="${CMAKE_SOURCE_DIR}" --package-name='WeeChat' --package-version=${VERSION} --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder='NAME' ${SRC_FILES}
DEPENDS ${POT_DEPENDS}
COMMENT "Generating ${POT_FILE}"
)
foreach(srcfile ${WEECHAT_SOURCES}) set(MO_FILES)
set(SRC_FILES ${SRC_FILES} ${srcfile}) set(UPDATE_PO_TARGETS)
set(POT_DEPENDS ${POT_DEPENDS} "${CMAKE_SOURCE_DIR}/${srcfile}") foreach(pofile ${PO_FILES})
endforeach() get_filename_component(polang ${pofile} NAME_WE)
# Compile .po files in build directory (to binary .mo files)
set(modir "${CMAKE_CURRENT_BINARY_DIR}/${polang}/LC_MESSAGES")
file(MAKE_DIRECTORY "${modir}")
set(mofile "${modir}/${PROJECT_NAME}.mo")
add_custom_command( add_custom_command(
OUTPUT "${POT_FILE_PATH}" OUTPUT "${mofile}"
COMMAND "${XGETTEXT_EXECUTABLE}" COMMAND "${MSGMERGE_EXECUTABLE}" ARGS --quiet -o "${CMAKE_CURRENT_BINARY_DIR}/${pofile}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" ${POT_FILE_PATH}
ARGS -o "${POT_FILE_PATH}" --add-comments='TRANSLATORS:' --keyword='_' --keyword='weechat_gettext' --keyword='N_' --keyword='NG_:1,2' --keyword='weechat_ngettext:1,2' --no-location --from-code=UTF-8 --directory="${CMAKE_SOURCE_DIR}" --package-name='WeeChat' --package-version=${VERSION} --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder='NAME' ${SRC_FILES} COMMAND "${MSGFMT_EXECUTABLE}" ARGS -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
DEPENDS ${POT_DEPENDS} COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose --output-file=/dev/null "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
COMMENT "Generating ${POT_FILE}" DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
COMMENT "Compiling ${polang}.po"
) )
set(MO_FILES) # Update .po files in source directory (if needed)
set(UPDATE_PO_TARGETS)
foreach(pofile ${PO_FILES})
get_filename_component(polang ${pofile} NAME_WE)
# Compile .po files in build directory (to binary .mo files)
set(modir "${CMAKE_CURRENT_BINARY_DIR}/${polang}/LC_MESSAGES")
file(MAKE_DIRECTORY "${modir}")
set(mofile "${modir}/${PROJECT_NAME}.mo")
add_custom_command(
OUTPUT "${mofile}"
COMMAND "${MSGMERGE_EXECUTABLE}" ARGS --quiet -o "${CMAKE_CURRENT_BINARY_DIR}/${pofile}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" ${POT_FILE_PATH}
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose --output-file=/dev/null "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
COMMENT "Compiling ${polang}.po"
)
# Update .po files in source directory (if needed)
add_custom_target(
update-${pofile}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --previous --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" "${POT_FILE_PATH}"
COMMENT "Updating ${polang}.po"
)
set(UPDATE_PO_TARGETS ${UPDATE_PO_TARGETS} update-${pofile})
install(FILES "${mofile}" DESTINATION "${LOCALEDIR}/${polang}/LC_MESSAGES")
set(MO_FILES ${MO_FILES} ${mofile})
endforeach()
add_custom_target(translations ALL DEPENDS ${MO_FILES})
# Update weechat.pot in source directory (if needed)
add_custom_target( add_custom_target(
update-${POT_FILE} update-${pofile}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${POT_FILE}" "${POT_FILE_PATH}" COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --previous --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" "${POT_FILE_PATH}"
COMMENT "Updating ${POT_FILE}" COMMENT "Updating ${polang}.po"
) )
set(UPDATE_PO_TARGETS ${UPDATE_PO_TARGETS} update-${pofile})
# Update all .po and weechat.pot in source directory (if needed) install(FILES "${mofile}" DESTINATION "${LOCALEDIR}/${polang}/LC_MESSAGES")
add_custom_target(update-po DEPENDS update-${POT_FILE} ${UPDATE_PO_TARGETS}) set(MO_FILES ${MO_FILES} ${mofile})
endforeach()
endif() add_custom_target(translations ALL DEPENDS ${MO_FILES})
# Update weechat.pot in source directory (if needed)
add_custom_target(
update-${POT_FILE}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${POT_FILE}" "${POT_FILE_PATH}"
COMMENT "Updating ${POT_FILE}"
)
# Update all .po and weechat.pot in source directory (if needed)
add_custom_target(update-po DEPENDS update-${POT_FILE} ${UPDATE_PO_TARGETS})
+20 -10
View File
@@ -2195,17 +2195,20 @@ config_weechat_custom_bar_item_read_cb (const void *pointer, void *data,
if (!ptr_temp_item) if (!ptr_temp_item)
{ {
/* create new temporary custom bar item */ /* create new temporary custom bar item */
ptr_temp_item = gui_bar_item_custom_alloc (item_name); if (gui_bar_item_search_default (item_name) < 0)
if (ptr_temp_item)
{ {
/* add new custom bar item at the end */ ptr_temp_item = gui_bar_item_custom_alloc (item_name);
ptr_temp_item->prev_item = last_gui_temp_custom_bar_item; if (ptr_temp_item)
ptr_temp_item->next_item = NULL; {
if (last_gui_temp_custom_bar_item) /* add new custom bar item at the end */
last_gui_temp_custom_bar_item->next_item = ptr_temp_item; ptr_temp_item->prev_item = last_gui_temp_custom_bar_item;
else ptr_temp_item->next_item = NULL;
gui_temp_custom_bar_items = ptr_temp_item; if (last_gui_temp_custom_bar_item)
last_gui_temp_custom_bar_item = ptr_temp_item; last_gui_temp_custom_bar_item->next_item = ptr_temp_item;
else
gui_temp_custom_bar_items = ptr_temp_item;
last_gui_temp_custom_bar_item = ptr_temp_item;
}
} }
} }
@@ -2226,6 +2229,13 @@ config_weechat_custom_bar_item_read_cb (const void *pointer, void *data,
section->name, option_name, value); section->name, option_name, value);
} }
} }
else
{
gui_chat_printf (NULL,
_("%sUnable to add custom bar item \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
item_name);
}
free (item_name); free (item_name);
+5
View File
@@ -421,6 +421,10 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
int rc, offset, length; int rc, offset, length;
unsigned long bin_code; unsigned long bin_code;
#if __BYTE_ORDER == __BIG_ENDIAN
/* Big endian does not need to swap bytes here! */
moving_factor_swapped = moving_factor;
#else
moving_factor_swapped = (moving_factor >> 56) moving_factor_swapped = (moving_factor >> 56)
| ((moving_factor << 40) & 0x00FF000000000000) | ((moving_factor << 40) & 0x00FF000000000000)
| ((moving_factor << 24) & 0x0000FF0000000000) | ((moving_factor << 24) & 0x0000FF0000000000)
@@ -429,6 +433,7 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
| ((moving_factor >> 24) & 0x0000000000FF0000) | ((moving_factor >> 24) & 0x0000000000FF0000)
| ((moving_factor >> 40) & 0x000000000000FF00) | ((moving_factor >> 40) & 0x000000000000FF00)
| (moving_factor << 56); | (moving_factor << 56);
#endif
rc = weecrypto_hmac (secret, length_secret, rc = weecrypto_hmac (secret, length_secret,
&moving_factor_swapped, sizeof (moving_factor_swapped), &moving_factor_swapped, sizeof (moving_factor_swapped),
+2
View File
@@ -1662,9 +1662,11 @@ doc_generate (const char *path)
* (this is used to generate documentation without installing WeeChat, * (this is used to generate documentation without installing WeeChat,
* that means no need to run `make install`) * that means no need to run `make install`)
*/ */
#ifdef ENABLE_NLS
localedir = getenv ("WEECHAT_DOCGEN_LOCALEDIR"); localedir = getenv ("WEECHAT_DOCGEN_LOCALEDIR");
if (localedir && localedir[0]) if (localedir && localedir[0])
bindtextdomain (PACKAGE, localedir); bindtextdomain (PACKAGE, localedir);
#endif /* ENABLE_NLS */
for (i = 0; locales[i]; i++) for (i = 0; locales[i]; i++)
{ {
+1 -5
View File
@@ -33,11 +33,7 @@
#include <locale.h> #include <locale.h>
#if defined(ENABLE_NLS) && !defined(_) #if defined(ENABLE_NLS) && !defined(_)
#ifdef HAVE_LIBINTL_H #include <libintl.h>
#include <libintl.h>
#else
#include "../../intl/libintl.h"
#endif /* HAVE_LIBINTL_H */
#define _(string) gettext(string) #define _(string) gettext(string)
#define NG_(single,plural,number) ngettext(single,plural,number) #define NG_(single,plural,number) ngettext(single,plural,number)
#ifdef gettext_noop #ifdef gettext_noop
+63 -20
View File
@@ -439,31 +439,46 @@ gui_bar_item_custom_new (const char *name, const char *conditions,
if (gui_bar_item_custom_search (name)) if (gui_bar_item_custom_search (name))
return NULL; return NULL;
if (gui_bar_item_search_default (name) >= 0)
return NULL;
option_conditions = NULL;
option_content = NULL;
new_bar_item_custom = NULL;
option_conditions = gui_bar_item_custom_create_option ( option_conditions = gui_bar_item_custom_create_option (
name, name,
GUI_BAR_ITEM_CUSTOM_OPTION_CONDITIONS, GUI_BAR_ITEM_CUSTOM_OPTION_CONDITIONS,
conditions); conditions);
if (!option_conditions) if (!option_conditions)
return NULL; goto error;
option_content = gui_bar_item_custom_create_option ( option_content = gui_bar_item_custom_create_option (
name, name,
GUI_BAR_ITEM_CUSTOM_OPTION_CONTENT, GUI_BAR_ITEM_CUSTOM_OPTION_CONTENT,
content); content);
if (!option_content) if (!option_content)
{ goto error;
config_file_option_free (option_conditions, 0);
return NULL;
}
new_bar_item_custom = gui_bar_item_custom_new_with_options ( new_bar_item_custom = gui_bar_item_custom_new_with_options (
name, name,
option_conditions, option_conditions,
option_content); option_content);
if (!new_bar_item_custom)
goto error;
gui_bar_item_custom_create_bar_item (new_bar_item_custom);
if (!new_bar_item_custom->bar_item)
goto error;
gui_bar_item_update (name);
return new_bar_item_custom;
error:
if (new_bar_item_custom) if (new_bar_item_custom)
{ {
gui_bar_item_custom_create_bar_item (new_bar_item_custom); gui_bar_item_custom_free (new_bar_item_custom);
gui_bar_item_update (name);
} }
else else
{ {
@@ -472,8 +487,7 @@ gui_bar_item_custom_new (const char *name, const char *conditions,
if (option_content) if (option_content)
config_file_option_free (option_content, 0); config_file_option_free (option_content, 0);
} }
return NULL;
return new_bar_item_custom;
} }
/* /*
@@ -483,12 +497,13 @@ gui_bar_item_custom_new (const char *name, const char *conditions,
void void
gui_bar_item_custom_use_temp_items () gui_bar_item_custom_use_temp_items ()
{ {
struct t_gui_bar_item_custom *ptr_temp_item; struct t_gui_bar_item_custom *ptr_temp_item, *ptr_next_temp_item;
int i; int i;
for (ptr_temp_item = gui_temp_custom_bar_items; ptr_temp_item; ptr_temp_item = gui_temp_custom_bar_items;
ptr_temp_item = ptr_temp_item->next_item) while (ptr_temp_item)
{ {
ptr_next_temp_item = ptr_temp_item->next_item;
for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++) for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++)
{ {
if (!ptr_temp_item->options[i]) if (!ptr_temp_item->options[i])
@@ -500,6 +515,20 @@ gui_bar_item_custom_use_temp_items ()
} }
} }
gui_bar_item_custom_create_bar_item (ptr_temp_item); gui_bar_item_custom_create_bar_item (ptr_temp_item);
if (!ptr_temp_item->bar_item)
{
if (ptr_temp_item->prev_item)
(ptr_temp_item->prev_item)->next_item = ptr_temp_item->next_item;
if (ptr_temp_item->next_item)
(ptr_temp_item->next_item)->prev_item = ptr_temp_item->prev_item;
if (gui_temp_custom_bar_items == ptr_temp_item)
gui_temp_custom_bar_items = ptr_temp_item->next_item;
if (last_gui_temp_custom_bar_item == ptr_temp_item)
last_gui_temp_custom_bar_item = ptr_temp_item->prev_item;
gui_bar_item_custom_free_data (ptr_temp_item);
free (ptr_temp_item);
}
ptr_temp_item = ptr_next_temp_item;
} }
/* remove any existing custom bar item */ /* remove any existing custom bar item */
@@ -534,6 +563,9 @@ gui_bar_item_custom_rename (struct t_gui_bar_item_custom *item,
if (gui_bar_item_custom_search (new_name)) if (gui_bar_item_custom_search (new_name))
return 0; return 0;
if (gui_bar_item_search_default (new_name) >= 0)
return 0;
old_name = strdup (item->name); old_name = strdup (item->name);
if (!old_name) if (!old_name)
return 0; return 0;
@@ -570,6 +602,24 @@ gui_bar_item_custom_rename (struct t_gui_bar_item_custom *item,
return 1; return 1;
} }
/*
* Frees data in a custom bar item.*
*/
void
gui_bar_item_custom_free_data (struct t_gui_bar_item_custom *item)
{
int i;
if (item->name)
free (item->name);
for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++)
{
if (item->options[i])
config_file_option_free (item->options[i], 1);
}
}
/* /*
* Deletes a custom bar item. * Deletes a custom bar item.
*/ */
@@ -578,7 +628,6 @@ void
gui_bar_item_custom_free (struct t_gui_bar_item_custom *item) gui_bar_item_custom_free (struct t_gui_bar_item_custom *item)
{ {
char *name; char *name;
int i;
if (!item) if (!item)
return; return;
@@ -599,13 +648,7 @@ gui_bar_item_custom_free (struct t_gui_bar_item_custom *item)
last_gui_custom_bar_item = item->prev_item; last_gui_custom_bar_item = item->prev_item;
/* free data */ /* free data */
if (item->name) gui_bar_item_custom_free_data (item);
free (item->name);
for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++)
{
if (item->options[i])
config_file_option_free (item->options[i], 1);
}
free (item); free (item);
+1
View File
@@ -69,6 +69,7 @@ extern struct t_gui_bar_item_custom *gui_bar_item_custom_new (const char *name,
extern void gui_bar_item_custom_use_temp_items (); extern void gui_bar_item_custom_use_temp_items ();
extern int gui_bar_item_custom_rename (struct t_gui_bar_item_custom *item, extern int gui_bar_item_custom_rename (struct t_gui_bar_item_custom *item,
const char *new_name); const char *new_name);
extern void gui_bar_item_custom_free_data (struct t_gui_bar_item_custom *item);
extern void gui_bar_item_custom_free (struct t_gui_bar_item_custom *item); extern void gui_bar_item_custom_free (struct t_gui_bar_item_custom *item);
extern void gui_bar_item_custom_free_all (); extern void gui_bar_item_custom_free_all ();
+24
View File
@@ -97,6 +97,30 @@ gui_bar_item_valid (struct t_gui_bar_item *bar_item)
return 0; return 0;
} }
/*
* Searches for a default bar item by name.
*
* Returns index in gui_bar_item_names[], -1 if not found.
*/
int
gui_bar_item_search_default (const char *item_name)
{
int i;
if (!item_name || !item_name[0])
return -1;
for (i = 0; i < GUI_BAR_NUM_ITEMS; i++)
{
if (strcmp (gui_bar_item_names[i], item_name) == 0)
return i;
}
/* default bar item not found */
return -1;
}
/* /*
* Searches for a bar item by name. * Searches for a bar item by name.
*/ */
+1
View File
@@ -89,6 +89,7 @@ extern char *gui_bar_item_names[];
/* functions */ /* functions */
extern int gui_bar_item_valid (struct t_gui_bar_item *bar_item); extern int gui_bar_item_valid (struct t_gui_bar_item *bar_item);
extern int gui_bar_item_search_default (const char *item_name);
extern struct t_gui_bar_item *gui_bar_item_search (const char *name); extern struct t_gui_bar_item *gui_bar_item_search (const char *name);
extern int gui_bar_item_used_in_bar (struct t_gui_bar *bar, extern int gui_bar_item_used_in_bar (struct t_gui_bar *bar,
const char *item_name, const char *item_name,
+1 -1
View File
@@ -363,7 +363,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
{ {
struct t_gui_filter *new_filter; struct t_gui_filter *new_filter;
regex_t *regex1, *regex2; regex_t *regex1, *regex2;
char *pos_tab, *regex_prefix, buf[512], str_error[512]; char *pos_tab, *regex_prefix, buf[512], str_error[1024];
const char *ptr_start_regex, *pos_regex_message; const char *ptr_start_regex, *pos_regex_message;
int rc; int rc;
+6 -1
View File
@@ -2907,11 +2907,13 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
pos_keys++; pos_keys++;
} }
if (pos_keys[0]) if (pos_keys[0])
{
keys = weechat_string_split (pos_keys, ",", NULL, keys = weechat_string_split (pos_keys, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT | WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS, | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_keys); 0, &num_keys);
}
} }
else else
new_args = strdup (arguments); new_args = strdup (arguments);
@@ -3025,6 +3027,9 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
} }
weechat_string_free_split (channels); weechat_string_free_split (channels);
} }
if (keys)
weechat_string_free_split (keys);
} }
/* /*
@@ -7076,7 +7081,7 @@ irc_command_init ()
" /ignore add toto*@*.domain.com libera #weechat"), " /ignore add toto*@*.domain.com libera #weechat"),
"list" "list"
" || add %(irc_channel_nicks_hosts) %(irc_servers) %(irc_channels) %-" " || add %(irc_channel_nicks_hosts) %(irc_servers) %(irc_channels) %-"
" || del -all|%(irc_ignores_numbers) %-", " || del %(irc_ignores_numbers)|-all %-",
&irc_command_ignore, NULL, NULL); &irc_command_ignore, NULL, NULL);
weechat_hook_command ( weechat_hook_command (
"info", "info",
+1 -1
View File
@@ -599,7 +599,7 @@ def test_hdata():
# hdata_char # hdata_char
check(weechat.hdata_char(hdata_line_data, line1_data, 'displayed') == 1) check(weechat.hdata_char(hdata_line_data, line1_data, 'displayed') == 1)
# hdata_integer # hdata_integer
check(weechat.hdata_char(hdata_buffer, buffer2, 'number') == 2) check(weechat.hdata_integer(hdata_buffer, buffer2, 'number') == 2)
# hdata_long # hdata_long
weechat.buffer_set(buffer, 'hotlist', weechat.WEECHAT_HOTLIST_MESSAGE) weechat.buffer_set(buffer, 'hotlist', weechat.WEECHAT_HOTLIST_MESSAGE)
gui_hotlist = weechat.hdata_get_list(hdata_hotlist, 'gui_hotlist') gui_hotlist = weechat.hdata_get_list(hdata_hotlist, 'gui_hotlist')
+1 -1
View File
@@ -222,7 +222,7 @@ TEST(CoreInfolist, New)
/* check content of variable */ /* check content of variable */
STRCMP_EQUAL("test_time", var_time->name); STRCMP_EQUAL("test_time", var_time->name);
LONGS_EQUAL(INFOLIST_TIME, var_time->type); LONGS_EQUAL(INFOLIST_TIME, var_time->type);
LONGS_EQUAL(1234567890, *((int *)var_time->value)); LONGS_EQUAL(1234567890, *((time_t *)var_time->value));
LONGS_EQUAL(0, var_time->size); LONGS_EQUAL(0, var_time->size);
POINTERS_EQUAL(var_buf, var_time->prev_var); POINTERS_EQUAL(var_buf, var_time->prev_var);
POINTERS_EQUAL(NULL, var_time->next_var); POINTERS_EQUAL(NULL, var_time->next_var);
@@ -464,6 +464,7 @@ TEST(GuiBarItemCustom, Rename)
/* /*
* Tests functions: * Tests functions:
* gui_bar_item_custom_free_data
* gui_bar_item_custom_free * gui_bar_item_custom_free
* gui_bar_item_custom_free_all * gui_bar_item_custom_free_all
*/ */
+15
View File
@@ -53,6 +53,21 @@ TEST(GuiBarItem, Valid)
LONGS_EQUAL(0, gui_bar_item_valid (gui_bar_items + 1)); LONGS_EQUAL(0, gui_bar_item_valid (gui_bar_items + 1));
} }
/*
* Tests functions:
* gui_bar_item_search_default
*/
TEST(GuiBarItem, SearchDefault)
{
LONGS_EQUAL(-1, gui_bar_item_search_default (NULL));
LONGS_EQUAL(-1, gui_bar_item_search_default (""));
LONGS_EQUAL(-1, gui_bar_item_search_default ("zzz"));
CHECK(gui_bar_item_search_default ("scroll") >= 0);
CHECK(gui_bar_item_search_default ("time") >= 0);
}
/* /*
* Tests functions: * Tests functions:
* gui_bar_item_search * gui_bar_item_search
+2 -2
View File
@@ -39,8 +39,8 @@
# devel-number the devel version as hex number ("0x04010000" for "4.1.0-dev") # devel-number the devel version as hex number ("0x04010000" for "4.1.0-dev")
# #
WEECHAT_STABLE="4.0.5" WEECHAT_STABLE="4.0.6"
WEECHAT_DEVEL="4.0.5" WEECHAT_DEVEL="4.0.6"
STABLE_MAJOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f1) STABLE_MAJOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f1)
STABLE_MINOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f2) STABLE_MINOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f2)