mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ab538c0d9 | |||
| 93d472e3d0 | |||
| e226c2e147 | |||
| 890a9e54be | |||
| 15bb7656a5 | |||
| 733eb99b17 | |||
| a7ea40da2c | |||
| 068776b5a7 | |||
| ccf18f4bf6 | |||
| fc1571645d | |||
| 53a9a161f4 | |||
| 27dd6cf72f | |||
| b78b5575c3 | |||
| 4e43be6d2c | |||
| fc71ce0d43 | |||
| 9358f076a3 | |||
| 795b9c9da9 | |||
| 7a76a959ec | |||
| a6aee98cb1 | |||
| 4c871760d2 | |||
| ddd7a85f2d | |||
| a538a9c08e | |||
| 5597c93b64 | |||
| e7b604c97e | |||
| 13fc108c6d | |||
| aa8a1cc775 | |||
| 2cc265f34e | |||
| 3c3311bf17 | |||
| 124b2668fe | |||
| 5262e05177 | |||
| 6dcb1e7b10 | |||
| dbc30707aa |
+1
-1
@@ -34,7 +34,7 @@ endif()
|
||||
|
||||
# version
|
||||
set(VERSION_MAJOR "1")
|
||||
set(VERSION_MINOR "0-rc2")
|
||||
set(VERSION_MINOR "0-rc3")
|
||||
set(VERSION_PATCH "")
|
||||
if(VERSION_PATCH STREQUAL "")
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
|
||||
+13
-2
@@ -15,13 +15,18 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 1.0 (under dev)
|
||||
|
||||
* core: fix zero-length malloc of an hashtable item with type "buffer"
|
||||
* core: fix memory leak on /upgrade when file signature in upgrade file is
|
||||
invalid
|
||||
* core: fix memory leak in completion of config options values
|
||||
* core: fix memory leak when removing script files
|
||||
* core: fix result of hash function (in hashtables) on 32-bit systems
|
||||
* core: add terabyte unit for size displayed
|
||||
* core: fix insert of mouse code in input line after a partial key combo
|
||||
(closes #130)
|
||||
* core: check code point value in UTF-8 check function (closes #108)
|
||||
* core: display a warning on startup if $TERM is not screen(-256color) under
|
||||
screen/tmux
|
||||
* core: display a warning on startup if $TERM does not start with "screen"
|
||||
under screen/tmux
|
||||
* core: add option "-mask" in command /unset (closes #112)
|
||||
* core: add option weechat.color.status_nicklist_count (closes #109,
|
||||
closes #110)
|
||||
@@ -127,6 +132,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
* alias: change default command for alias /beep to "/print -beep"
|
||||
* exec: add exec plugin: new command /exec and file exec.conf
|
||||
* guile: fix module used after unload of a script
|
||||
* irc: fix memory leak in CTCP answer
|
||||
* irc: fix duplicate sender name in display of wallops (closes #142,
|
||||
closes #145)
|
||||
* irc: display locally away status changes in private buffers (in addition to
|
||||
@@ -171,6 +177,10 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
* python: fix read of return value for callbacks returning an integer
|
||||
in Python 2.x (closes #125)
|
||||
* python: fix interpreter used after unload of a script
|
||||
* relay: fix memory leak during handshake on websocket
|
||||
* relay: fix memory leak when receiving commands from client (weechat protocol)
|
||||
* relay: fix crash when an IRC "MODE" command is received from client without
|
||||
arguments
|
||||
* relay: fix number of bytes sent/received on 32-bit systems
|
||||
* relay: fix crash when closing relay buffers (closes #57, closes #78)
|
||||
* relay: check pointers received in hdata command to prevent crashes with bad
|
||||
@@ -315,6 +325,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
* irc: add option irc.look.notice_welcome_tags
|
||||
* irc: add server option "default_msg_kick" to customize default kick/kickban
|
||||
message (task #12777)
|
||||
* logger: fix memory leaks in backlog
|
||||
* logger: replace backslashs in name by logger replacement char under Cygwin
|
||||
(bug #41207)
|
||||
* lua: fix detection of Lua 5.2 in autotools (patch #8270)
|
||||
|
||||
@@ -46,6 +46,7 @@ Following packages are optional:
|
||||
* for scripting: python, perl, ruby, lua, tcl, guile
|
||||
* for building doc: asciidoc, source-highlight
|
||||
(for man page: xsltproc, docbook-xml, docbook-xsl)
|
||||
* for building tests: C++ compiler, CppUTest
|
||||
|
||||
For a complete list of dependencies and versions recommended, please look at
|
||||
http://weechat.org/files/doc/devel/weechat_user.en.html#dependencies[user's guide].
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 1.0-rc2, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 1.0-rc3, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
@@ -98,8 +98,6 @@ Pełna licencja znajduje się w pliku COPYING.
|
||||
|
||||
Strona www: <http://weechat.org/>
|
||||
|
||||
// TRANSLATION MISSING
|
||||
== SUPPORT / REPORTING BUGS
|
||||
== WSPARCIE / ZGŁASZANIE BŁĘDÓW
|
||||
|
||||
// TRANSLATION MISSING
|
||||
For help or a bug report: <http://weechat.org/dev/support>
|
||||
W celu uzyskania pomocy, lub zgłoszenia błędu zajrzyj na: <http://weechat.org/dev/support>
|
||||
|
||||
@@ -35,8 +35,7 @@ Więcej informacji na stronie: http://weechat.org/about/features
|
||||
[[gui]]
|
||||
=== Słyszałem o wielu GUI dla WeeChat. Jak mogę je skompilować/użyć?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
Some remote GUIs are available, see the links on features page:
|
||||
Dostępne są zdalne interfejsy, linki można znaleźć na stronie z cechami:
|
||||
http://weechat.org/about/features
|
||||
|
||||
[[compile_git]]
|
||||
@@ -218,8 +217,7 @@ użyty w żadnym z pasków:
|
||||
[[terminal_copy_paste]]
|
||||
=== Jak mogę kopiować/wklejać tekst bez wklejania listy nicków?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
With WeeChat ≥ 1.0, you can use the bare display (default key: key[alt-l]).
|
||||
W WeeChat od wersji ≥ 1.0, możesz użyć trybu niesformatowanego wyświetlania (domyślnie: key[alt-l]).
|
||||
|
||||
Możesz użyć terminala z prostokątnym zaznaczaniem (jak rxvt-unicode,
|
||||
konsole, gnome-terminal, ...). Klawisze to zazwyczaj key[ctrl-]key[alt-] zaznaczenie myszką.
|
||||
@@ -233,8 +231,7 @@ Innym rozwiązaniem jest przesunięcie listy nicków na górę lub dół, na prz
|
||||
[[urls]]
|
||||
=== Jak mogę kliknąć na długi URL (dłuższy niż linia)?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
With WeeChat ≥ 1.0, you can use the bare display (default key: key[alt-l]).
|
||||
W WeeChat od wersji ≥ 1.0, możesz użyć trybu niesformatowanego wyświetlania (domyślnie: key[alt-l]).
|
||||
|
||||
Domyślnie WeeChat wyświetla czas i przedrostki dla każdej linii i opcjonalne paski
|
||||
dookoła obszaru rozmowy. Aby usprawnić klikanie w urle można przesunąć listę nicków
|
||||
@@ -267,16 +264,14 @@ Innym rozwiązaniem jest użycie skryptu:
|
||||
[[change_locale_without_quit]]
|
||||
=== Chcę zmienić język komunikatów wyświetlanych przez WeeChat, ale bez jego zamykania, czy jest to możliwe?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
Yes, with WeeChat ≥ 1.0:
|
||||
Tak, dla wersji WeeChat ≥ 1.0:
|
||||
|
||||
----
|
||||
/set env LANG pl_PL.UTF-8
|
||||
/upgrade
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
With older WeeChat:
|
||||
Dla starszych wersji WeeChat:
|
||||
|
||||
----
|
||||
/script install shell.py
|
||||
@@ -305,9 +300,8 @@ Jeśli używasz screena, możesz dodać to do swojego '~/.screenrc':
|
||||
term screen-256color
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
If your 'TERM' variable has wrong value and that WeeChat is already running,
|
||||
you can change it with these two commands (with WeeChat ≥ 1.0):
|
||||
Jeśli twoja zmienna 'TERM' posiada złą wartość i WeeChat jest już uruchomiony,
|
||||
możesz zmienić ją za pomocą tych dwóch komend (dla wersji Weechat ≥ 1.0):
|
||||
|
||||
----
|
||||
/set env TERM screen-256color
|
||||
@@ -330,25 +324,24 @@ Poruszanie się między podświetleniami: key[alt-p] / key[alt-n].
|
||||
|
||||
Po więcej informacji zajrzyj do poradnika użytkownika (domyślne skróty klawiszowe).
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[[terminal_focus]]
|
||||
=== How can I execute commands when terminal gets/loses focus?
|
||||
=== Jak mogę wykonywać komendy, kiedy terminal stanie się/przestanie być aktywny?
|
||||
|
||||
You must enable the focus events with a special code sent to terminal.
|
||||
Musisz włączyć obsługę tego zdarzenia za pomocą specjalnego kodu wysyłanego do terminala.
|
||||
|
||||
*Important*:
|
||||
*Ważne*:
|
||||
|
||||
* Currently, *only* 'xterm' seems to support this feature.
|
||||
* It does *not* work under screen/tmux.
|
||||
* Obecnie *tylko* 'xterm' wspiera tą funkcję.
|
||||
* *Nie* działa to pod screen/tmux.
|
||||
|
||||
To send the code when WeeChat is starting:
|
||||
Żeby wysłać kod podczas uruchamiania WeeChat:
|
||||
|
||||
----
|
||||
/set weechat.startup.command_after_plugins "/print -stdout \033[?1004h\n"
|
||||
----
|
||||
|
||||
And then you bind two keys for the focus (replace the `/print` commands by the
|
||||
commands of your choice):
|
||||
Następnie przypisz dwie kombinacje klawiszy dla stanu aktywności (zamień komendy
|
||||
`/print` własnymi komendami:
|
||||
|
||||
----
|
||||
/key bind meta2-I /print -core focus
|
||||
@@ -469,9 +462,8 @@ key[shift]).
|
||||
[[irc_ssl_connection]]
|
||||
=== Mam problemy podczas połączenia z serwerem używającym SSL, co mogę zrobić?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
If you are using Mac OS X, you must install `curl-ca-bundle` and set the path
|
||||
to certificates in WeeChat:
|
||||
Jeśli używasz Mac OS X, musisz zainstalować `curl-ca-bundle` i ustawić ścieżkę
|
||||
do certyfikatów w WeeChat:
|
||||
|
||||
----
|
||||
/set weechat.network.gnutls_ca_file "/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt"
|
||||
@@ -529,7 +521,7 @@ Niektóre serwery jak 'twitch' wymagają oauth do połączenia.
|
||||
|
||||
Oauth to po prostu hasło w postaci "oauth:hasło".
|
||||
|
||||
W celu dodania takiego serwera i połączenia się z nim należ wykonać nastepujące
|
||||
W celu dodania takiego serwera i połączenia się z nim należ wykonać następujące
|
||||
polecenia (należy zastąpić nazwę i adres odpowiednimi wartościami):
|
||||
|
||||
----
|
||||
@@ -595,15 +587,13 @@ Więcej informacji: `/help filter` i `/help irc.look.smart_filter`
|
||||
[[filter_irc_join_channel_messages]]
|
||||
=== Jak mogę filtrować wyświetlane wiadomości podczas wejścia na kanał IRC?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
With WeeChat ≥ 0.4.1, you can choose which messages are displayed or not when
|
||||
joining a channel with the option 'irc.look.display_join_message' (see
|
||||
`/help irc.look.display_join_message` for more info).
|
||||
W wersjach WeeChat ≥ 0.4.1, możesz wybrać to, jakie wiadomości są wyświetlane
|
||||
a jakie nie podczas wchodzenia na kanał, za pomocą opcji 'irc.look.display_join_message'
|
||||
(więcej informacji można znaleźć wykonując `/help irc.look.display_join_message`).
|
||||
|
||||
// TRANSLATION MISSING
|
||||
To hide messages (but keep them in buffer), you can filter them using the tag
|
||||
(for example 'irc_329' for channel creation date). See `/help filter` for help
|
||||
with filters.
|
||||
W celu ukrycia wiadomości (ale zachowując je w buforze), możesz je filtrować
|
||||
używając tagu (na przykład 'irc_329' dla daty utworzenia kanału). zobacz
|
||||
`/help filter` w celu uzyskania pomocy z filtrami.
|
||||
|
||||
[[filter_voice_messages]]
|
||||
=== Jak mogę filtrować informacje o przyznaniu voice (np na serwerze Bitlbee)?
|
||||
@@ -695,13 +685,11 @@ Musisz ustawić:
|
||||
/plugin autoload
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[[install_scripts]]
|
||||
=== How can I install scripts? Are scripts compatible with other IRC clients?
|
||||
=== Jak mogę instalować skrypty? Czy są one kompatybilne z innymi klientami IRC?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
You can use the command `/script` to install and manage scripts
|
||||
(see `/help script` for help).
|
||||
Możesz użyć komendy `/script` do instalowania i zarządzania skryptami
|
||||
(zobacz `/help script` po więcej informacji).
|
||||
|
||||
Skrypty nie są kompatybilne z innymi klientami IRC.
|
||||
|
||||
@@ -724,18 +712,16 @@ W celu zmniejszenia używanej pamięci możesz zastosować się do poniższych r
|
||||
wartość opcji 'weechat.history.max_buffer_lines_minutes'
|
||||
* zmniejszyć wartość opcji 'weechat.history.max_commands'
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[[cpu_usage]]
|
||||
=== How can I tweak WeeChat to use less CPU?
|
||||
=== Jak mogę zmusić WeeChat do zużywania mniejszej mocy CPU?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
You can follow same tips as for <<memory_usage,memory>>, and these ones:
|
||||
Możesz skorzystać z tych samych porad jak dla <<memory_usage,memory>>, oraz tych:
|
||||
|
||||
* hide "nicklist" bar: `/bar hide nicklist`
|
||||
* remove display of seconds in status bar time:
|
||||
`/set weechat.look.item_time_format "%H:%M"` (this is the default value)
|
||||
* set the 'TZ' variable (for example: `export TZ="Europe/Paris"`), to prevent
|
||||
frequent access to file '/etc/localtime'
|
||||
* schowaj pasek "nicklist": `/bar hide nicklist`
|
||||
* usuń wyświetlanie sekund w czasie na pasku statusu:
|
||||
`/set weechat.look.item_time_format "%H:%M"` (domyślna wartość)
|
||||
* ustaw zmienną 'TZ' (na przykład: `export TZ="Europe/Warsaw"`), w celu zmniejszenia
|
||||
częstotliwości czytania pliku '/etc/localtime'
|
||||
|
||||
[[development]]
|
||||
== Rozwój
|
||||
@@ -743,8 +729,7 @@ You can follow same tips as for <<memory_usage,memory>>, and these ones:
|
||||
[[bug_task_patch]]
|
||||
=== Jak zgłaszać błędy, prosić o nowe możliwości lub wysyłać patche?
|
||||
|
||||
// TRANSLATION MISSING
|
||||
See: http://weechat.org/dev/support
|
||||
Zobacz: http://weechat.org/dev/support
|
||||
|
||||
[[gdb_error_threads]]
|
||||
=== Kiedy uruchamiam WeeChat pod gdb dostaję komunikat o wątkach, co mogę z tym zrobić?
|
||||
|
||||
@@ -94,11 +94,9 @@ na liście "irc" oraz inne wtyczki.
|
||||
[[create_irc_server]]
|
||||
== Tworzenie serwera IRC
|
||||
|
||||
// TRANSLATION MISSING
|
||||
The server 'freenode' is created by default on first startup.
|
||||
Serwer 'freenode' jest tworzony domyślnie przy pierwszym uruchomieniu.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
You can add another IRC server with `/server` command, for example:
|
||||
Możesz dodać inne serwery IRC za pomocą komendy '/server', na przykład:
|
||||
|
||||
----
|
||||
/server add oftc irc.oftc.net/6667
|
||||
@@ -140,8 +138,7 @@ Aby włączyć automatyczne łączenie się z serwerem przy starcie:
|
||||
/set irc.server.freenode.autoconnect on
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
To connect with SSL:
|
||||
W celu połączenia z użyciem SSL:
|
||||
|
||||
----
|
||||
/set irc.server.freenode.addresses "chat.freenode.net/7000"
|
||||
@@ -149,10 +146,9 @@ To connect with SSL:
|
||||
/set irc.server.freenode.ssl_dhkey_size 1024
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[NOTE]
|
||||
Freenode does not support the default dhkey size of 2048, so it has to be set
|
||||
to 1024.
|
||||
Freenode nie wspiera domyślnego rozmiaru klucza dhkey 2048, dlatego należy go
|
||||
ustawić na 1024.
|
||||
|
||||
Jeśli SASL jest dostępny na serwerze, można użyć go do uwierzytelnienia (zostaniesz
|
||||
zidentyfikowany przed wejściem na kanał):
|
||||
@@ -170,9 +166,8 @@ przez nickserv (tylko jeśli nie uwierzytelniasz się przez SASL):
|
||||
/set irc.server.freenode.command "/msg nickserv identify xxxxxxx"
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[NOTE]
|
||||
Many commands in option 'command' can be separated by ';' (semi-colon).
|
||||
Opcja 'command' może zawierać wiele komend, należy je oddzielić ';' (średnik).
|
||||
|
||||
Aby automatycznie wejść na kanały po połączeniu z serwerem:
|
||||
|
||||
@@ -202,12 +197,12 @@ nazwa opcji):
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
Ta komenda może być użyta do utworzenia i połączenia sie z nowym serwerem bez
|
||||
Ta komenda może być użyta do utworzenia i połączenia się z nowym serwerem bez
|
||||
użycia komendy `/server` (czy mam powtarzać, że pomoc dla tej komendy można
|
||||
uzyskać dzięki `/help connect` ?).
|
||||
|
||||
Domyślnie bufory serwerów są połączone z buforem WeeChat 'core'. Aby przełączać
|
||||
się pomiędzy biforem 'core' a buforami serwerów możesz użyć key[ctrl-x].
|
||||
się pomiędzy buforem 'core' a buforami serwerów możesz użyć key[ctrl-x].
|
||||
|
||||
Jest możliwe wyłączenie automatycznego łączenia buforów serwerów, aby mieć
|
||||
oddzielne bufory dla serwerów:
|
||||
@@ -237,17 +232,16 @@ Zamknięcie bufora serwera lub kanału (`/close` jest aliasem `/buffer close`):
|
||||
/close
|
||||
----
|
||||
|
||||
// TRANSLATION MISSING
|
||||
[[irc_private_messages]]
|
||||
== IRC private messages
|
||||
== Prywatne wiadomości IRC
|
||||
|
||||
Open a buffer and send a message to another user (nick 'foo'):
|
||||
Otworzenie bufora i wysłanie wiadomości do innego użytkownika (nick 'foo'):
|
||||
|
||||
----
|
||||
/query foo this is a message
|
||||
/query foo to jest wiadomość
|
||||
----
|
||||
|
||||
Close the private buffer:
|
||||
Zamykanie prywatnego bufora:
|
||||
|
||||
----
|
||||
/close
|
||||
|
||||
+292
-309
File diff suppressed because it is too large
Load Diff
@@ -68,6 +68,7 @@ else
|
||||
else
|
||||
# git version not found in file => update file with this git version
|
||||
echo "Updating file ${HEADERFILE} with git version: \"${GIT_VERSION}\""
|
||||
sed -i "s/#define PACKAGE_VERSION_GIT \".*\"/#define PACKAGE_VERSION_GIT \"${GIT_VERSION}\"/" ${HEADERFILE}
|
||||
sed "s/#define PACKAGE_VERSION_GIT \".*\"/#define PACKAGE_VERSION_GIT \"${GIT_VERSION}\"/" ${HEADERFILE} >${HEADERFILE}.tmp
|
||||
mv -f ${HEADERFILE}.tmp ${HEADERFILE}
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -606,7 +606,7 @@ COMMAND_CALLBACK(buffer)
|
||||
else
|
||||
{
|
||||
ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]);
|
||||
number = strtol (argv[2], &error, 10);
|
||||
(void) strtol (argv[i], &error, 10);
|
||||
clear_number = (error && !error[0]);
|
||||
}
|
||||
if (ptr_buffer)
|
||||
@@ -784,7 +784,7 @@ COMMAND_CALLBACK(buffer)
|
||||
ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
number = strtol (argv[2], &error, 10);
|
||||
(void) strtol (argv[i], &error, 10);
|
||||
if (error && !error[0])
|
||||
{
|
||||
for (ptr_buffer2 = gui_buffers; ptr_buffer2;
|
||||
@@ -822,7 +822,7 @@ COMMAND_CALLBACK(buffer)
|
||||
ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
number = strtol (argv[2], &error, 10);
|
||||
(void) strtol (argv[i], &error, 10);
|
||||
if (error && !error[0])
|
||||
{
|
||||
for (ptr_buffer2 = gui_buffers; ptr_buffer2;
|
||||
|
||||
+209
-206
@@ -910,231 +910,234 @@ completion_list_add_config_option_values_cb (void *data,
|
||||
(void) completion_item;
|
||||
(void) buffer;
|
||||
|
||||
if (completion->args)
|
||||
if (!completion->args)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
pos_space = strchr (completion->args, ' ');
|
||||
if (pos_space)
|
||||
option_full_name = string_strndup (completion->args,
|
||||
pos_space - completion->args);
|
||||
else
|
||||
option_full_name = strdup (completion->args);
|
||||
|
||||
if (!option_full_name)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
file = NULL;
|
||||
section = NULL;
|
||||
pos_option = NULL;
|
||||
|
||||
pos_section = strchr (option_full_name, '.');
|
||||
pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL;
|
||||
|
||||
if (pos_section && pos_option)
|
||||
{
|
||||
pos_space = strchr (completion->args, ' ');
|
||||
if (pos_space)
|
||||
option_full_name = string_strndup (completion->args,
|
||||
pos_space - completion->args);
|
||||
else
|
||||
option_full_name = strdup (completion->args);
|
||||
|
||||
if (option_full_name)
|
||||
file = string_strndup (option_full_name,
|
||||
pos_section - option_full_name);
|
||||
section = string_strndup (pos_section + 1,
|
||||
pos_option - pos_section - 1);
|
||||
pos_option++;
|
||||
}
|
||||
if (file && section && pos_option)
|
||||
{
|
||||
ptr_config = config_file_search (file);
|
||||
if (ptr_config)
|
||||
{
|
||||
file = NULL;
|
||||
section = NULL;
|
||||
pos_option = NULL;
|
||||
|
||||
pos_section = strchr (option_full_name, '.');
|
||||
pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL;
|
||||
|
||||
if (pos_section && pos_option)
|
||||
ptr_section = config_file_search_section (ptr_config,
|
||||
section);
|
||||
if (ptr_section)
|
||||
{
|
||||
file = string_strndup (option_full_name,
|
||||
pos_section - option_full_name);
|
||||
section = string_strndup (pos_section + 1,
|
||||
pos_option - pos_section - 1);
|
||||
pos_option++;
|
||||
}
|
||||
if (file && section && pos_option)
|
||||
{
|
||||
ptr_config = config_file_search (file);
|
||||
if (ptr_config)
|
||||
config_file_search_section_option (ptr_config,
|
||||
ptr_section,
|
||||
pos_option,
|
||||
§ion_found,
|
||||
&option_found);
|
||||
if (option_found)
|
||||
{
|
||||
ptr_section = config_file_search_section (ptr_config,
|
||||
section);
|
||||
if (ptr_section)
|
||||
switch (option_found->type)
|
||||
{
|
||||
config_file_search_section_option (ptr_config,
|
||||
ptr_section,
|
||||
pos_option,
|
||||
§ion_found,
|
||||
&option_found);
|
||||
if (option_found)
|
||||
{
|
||||
switch (option_found->type)
|
||||
case CONFIG_OPTION_TYPE_BOOLEAN:
|
||||
gui_completion_list_add (completion, "on",
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
gui_completion_list_add (completion, "off",
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
gui_completion_list_add (completion, "toggle",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
case CONFIG_OPTION_TYPE_BOOLEAN:
|
||||
if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE)
|
||||
gui_completion_list_add (completion, "on",
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
gui_completion_list_add (completion, "off",
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
gui_completion_list_add (completion, "toggle",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE)
|
||||
gui_completion_list_add (completion, "on",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
else
|
||||
gui_completion_list_add (completion, "off",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_INTEGER:
|
||||
if (option_found->string_values)
|
||||
{
|
||||
for (i = 0; option_found->string_values[i]; i++)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
option_found->string_values[i],
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
option_found->string_values[CONFIG_INTEGER(option_found)],
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min)
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max)
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value)
|
||||
{
|
||||
length = 64;
|
||||
value_string = malloc (length);
|
||||
if (value_string)
|
||||
{
|
||||
snprintf (value_string, length,
|
||||
"%d", CONFIG_INTEGER(option_found));
|
||||
gui_completion_list_add (completion,
|
||||
value_string,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
free (value_string);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_STRING:
|
||||
gui_completion_list_add (completion,
|
||||
"\"\"",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value)
|
||||
{
|
||||
length = strlen (CONFIG_STRING(option_found)) + 2 + 1;
|
||||
value_string = malloc (length);
|
||||
if (value_string)
|
||||
{
|
||||
snprintf (value_string, length,
|
||||
"\"%s\"",
|
||||
CONFIG_STRING(option_found));
|
||||
gui_completion_list_add (completion,
|
||||
value_string,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
free (value_string);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_COLOR:
|
||||
num_colors = gui_color_get_weechat_colors_number ();
|
||||
for (i = 0; i < num_colors; i++)
|
||||
{
|
||||
color_name = gui_color_get_name (i);
|
||||
if (color_name)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_name,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
}
|
||||
num_colors = gui_color_get_term_colors ();
|
||||
for (i = 0; i <= num_colors; i++)
|
||||
{
|
||||
color_palette = gui_color_palette_get (i);
|
||||
if (color_palette)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_palette->alias,
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (str_number,
|
||||
sizeof (str_number),
|
||||
"%d",
|
||||
i);
|
||||
gui_completion_list_add (completion,
|
||||
str_number,
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
}
|
||||
}
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
color_name = gui_color_get_name (CONFIG_INTEGER(option_found));
|
||||
if (color_name)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_name,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
break;
|
||||
case CONFIG_NUM_OPTION_TYPES:
|
||||
break;
|
||||
else
|
||||
gui_completion_list_add (completion, "off",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
if (option_found->value
|
||||
&& option_found->null_value_allowed)
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0,
|
||||
WEECHAT_LIST_POS_END);
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_INTEGER:
|
||||
if (option_found->string_values)
|
||||
{
|
||||
for (i = 0; option_found->string_values[i]; i++)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
option_found->string_values[i],
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
option_found->string_values[CONFIG_INTEGER(option_found)],
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min)
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max)
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value)
|
||||
{
|
||||
length = 64;
|
||||
value_string = malloc (length);
|
||||
if (value_string)
|
||||
{
|
||||
snprintf (value_string, length,
|
||||
"%d", CONFIG_INTEGER(option_found));
|
||||
gui_completion_list_add (completion,
|
||||
value_string,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
free (value_string);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_STRING:
|
||||
gui_completion_list_add (completion,
|
||||
"\"\"",
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
if (option_found->value)
|
||||
{
|
||||
length = strlen (CONFIG_STRING(option_found)) + 2 + 1;
|
||||
value_string = malloc (length);
|
||||
if (value_string)
|
||||
{
|
||||
snprintf (value_string, length,
|
||||
"\"%s\"",
|
||||
CONFIG_STRING(option_found));
|
||||
gui_completion_list_add (completion,
|
||||
value_string,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
free (value_string);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_COLOR:
|
||||
num_colors = gui_color_get_weechat_colors_number ();
|
||||
for (i = 0; i < num_colors; i++)
|
||||
{
|
||||
color_name = gui_color_get_name (i);
|
||||
if (color_name)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_name,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
}
|
||||
num_colors = gui_color_get_term_colors ();
|
||||
for (i = 0; i <= num_colors; i++)
|
||||
{
|
||||
color_palette = gui_color_palette_get (i);
|
||||
if (color_palette)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_palette->alias,
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (str_number,
|
||||
sizeof (str_number),
|
||||
"%d",
|
||||
i);
|
||||
gui_completion_list_add (completion,
|
||||
str_number,
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
}
|
||||
}
|
||||
gui_completion_list_add (completion, "++1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
gui_completion_list_add (completion, "--1",
|
||||
0, WEECHAT_LIST_POS_END);
|
||||
if (option_found->value)
|
||||
{
|
||||
color_name = gui_color_get_name (CONFIG_INTEGER(option_found));
|
||||
if (color_name)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
color_name,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0, WEECHAT_LIST_POS_BEGINNING);
|
||||
}
|
||||
break;
|
||||
case CONFIG_NUM_OPTION_TYPES:
|
||||
break;
|
||||
}
|
||||
if (option_found->value
|
||||
&& option_found->null_value_allowed)
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
WEECHAT_CONFIG_OPTION_NULL,
|
||||
0,
|
||||
WEECHAT_LIST_POS_END);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file)
|
||||
free (file);
|
||||
if (section)
|
||||
free (section);
|
||||
}
|
||||
}
|
||||
|
||||
if (file)
|
||||
free (file);
|
||||
if (section)
|
||||
free (section);
|
||||
|
||||
free (option_full_name);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -979,6 +979,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
|
||||
option->value = malloc (sizeof (int));
|
||||
if (option->value)
|
||||
CONFIG_INTEGER(option) = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (CONFIG_INTEGER(option) == CONFIG_INTEGER_DEFAULT(option))
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
@@ -1009,6 +1011,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
|
||||
option->value = malloc (sizeof (int));
|
||||
if (option->value)
|
||||
CONFIG_INTEGER(option) = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (CONFIG_COLOR(option) == CONFIG_COLOR_DEFAULT(option))
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
|
||||
@@ -270,7 +270,7 @@ hashtable_alloc_type (enum t_hashtable_type type,
|
||||
*size = sizeof (void *);
|
||||
break;
|
||||
case HASHTABLE_BUFFER:
|
||||
if (value)
|
||||
if (value && (size_value > 0))
|
||||
{
|
||||
*pointer = malloc (size_value);
|
||||
if (*pointer)
|
||||
|
||||
+5
-12
@@ -674,12 +674,9 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
|
||||
if (!buffer || !string || !string[0])
|
||||
return -1;
|
||||
|
||||
rc = hook_command_run_exec (buffer, string);
|
||||
if (rc == WEECHAT_RC_OK_EAT)
|
||||
if (hook_command_run_exec (buffer, string) == WEECHAT_RC_OK_EAT)
|
||||
return 1;
|
||||
|
||||
rc = -1;
|
||||
|
||||
argv = string_split (string, " ", 0, 0, &argc);
|
||||
if (argc == 0)
|
||||
{
|
||||
@@ -726,12 +723,9 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
|
||||
ptr_hook = next_hook;
|
||||
}
|
||||
|
||||
if (!hook_plugin && !hook_other_plugin)
|
||||
{
|
||||
/* command not found at all */
|
||||
rc = -1;
|
||||
}
|
||||
else
|
||||
rc = -1;
|
||||
|
||||
if (hook_plugin || hook_other_plugin)
|
||||
{
|
||||
if (!hook_plugin && (count_other_plugin > 1)
|
||||
&& (hook_other_plugin->priority == hook_other_plugin2->priority))
|
||||
@@ -1517,7 +1511,7 @@ hook_process_child (struct t_hook *hook_process)
|
||||
(void) f;
|
||||
}
|
||||
|
||||
rc = EXIT_SUCCESS;
|
||||
rc = EXIT_FAILURE;
|
||||
|
||||
if (strncmp (HOOK_PROCESS(hook_process, command), "url:", 4) == 0)
|
||||
{
|
||||
@@ -1605,7 +1599,6 @@ hook_process_child (struct t_hook *hook_process)
|
||||
string_free_split (exec_args);
|
||||
fprintf (stderr, "Error with command '%s'\n",
|
||||
HOOK_PROCESS(hook_process, command));
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
@@ -1354,12 +1354,12 @@ string_replace_regex_get_replace (const char *string, regmatch_t *regex_match,
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* string | regex | replace | result
|
||||
* ----------+---------------+-----------+-------------
|
||||
* test foo | test | Z | Z foo
|
||||
* test foo | ^(test +)(.*) | $2 | foo
|
||||
* test foo | ^(test +)(.*) | $1 / $.*2 | test / ***
|
||||
* test foo | ^(test +)(.*) | $.%+ | %%%
|
||||
* string | regex | replace | result
|
||||
* ----------+---------------+----------+-------------
|
||||
* test foo | test | Z | Z foo
|
||||
* test foo | ^(test +)(.*) | $2 | foo
|
||||
* test foo | ^(test +)(.*) | $1/ $.*2 | test / ***
|
||||
* test foo | ^(test +)(.*) | $.%+ | %%%
|
||||
*
|
||||
* Note: result must be freed after use.
|
||||
*/
|
||||
@@ -1374,7 +1374,7 @@ string_replace_regex (const char *string, void *regex, const char *replace,
|
||||
int length, length_replace, start_offset, i, rc, end, last_match;
|
||||
regmatch_t regex_match[100];
|
||||
|
||||
if (!string)
|
||||
if (!string || !regex)
|
||||
return NULL;
|
||||
|
||||
length = strlen (string) + 1;
|
||||
|
||||
@@ -759,6 +759,8 @@ upgrade_file_read (struct t_upgrade_file *upgrade_file,
|
||||
{
|
||||
UPGRADE_ERROR(_("read - bad signature (upgrade file format may have "
|
||||
"changed since last version)"), "");
|
||||
if (signature)
|
||||
free (signature);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -402,8 +402,7 @@ weechat_term_check ()
|
||||
sty = getenv ("STY");
|
||||
tmux = getenv ("TMUX");
|
||||
|
||||
is_term_ok = (term && ((strcmp (term, "screen") == 0)
|
||||
|| (strcmp (term, "screen-256color") == 0)));
|
||||
is_term_ok = (term && (strncmp (term, "screen", 6) == 0));
|
||||
is_screen = (sty && sty[0]);
|
||||
is_tmux = (tmux && tmux[0]);
|
||||
|
||||
|
||||
@@ -379,7 +379,6 @@ gui_mouse_event_code2key (const char *code)
|
||||
* buttonX-gesture-right-long | >= 40 |
|
||||
*/
|
||||
|
||||
distance = 0;
|
||||
if (key[0]
|
||||
&& ((gui_mouse_event_x[0] != gui_mouse_event_x[1])
|
||||
|| (gui_mouse_event_y[0] != gui_mouse_event_y[1])))
|
||||
|
||||
@@ -1191,8 +1191,9 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
|
||||
{
|
||||
old_date = ptr_line->data->date;
|
||||
date_tmp = localtime (&old_date);
|
||||
if (date_tmp)
|
||||
memcpy (&old_line_date, date_tmp, sizeof (struct tm));
|
||||
if (!date_tmp)
|
||||
return;
|
||||
memcpy (&old_line_date, date_tmp, sizeof (struct tm));
|
||||
}
|
||||
|
||||
while (ptr_line)
|
||||
@@ -1213,8 +1214,9 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
|
||||
else
|
||||
{
|
||||
date_tmp = localtime (&(ptr_line->data->date));
|
||||
if (date_tmp)
|
||||
memcpy (&line_date, date_tmp, sizeof (struct tm));
|
||||
if (!date_tmp)
|
||||
return;
|
||||
memcpy (&line_date, date_tmp, sizeof (struct tm));
|
||||
if (old_date > ptr_line->data->date)
|
||||
diff_date = old_date - ptr_line->data->date;
|
||||
else
|
||||
|
||||
@@ -135,10 +135,11 @@ exec_add ()
|
||||
|
||||
new_exec_cmd->prev_cmd = last_exec_cmd;
|
||||
new_exec_cmd->next_cmd = NULL;
|
||||
if (!exec_cmds)
|
||||
exec_cmds = new_exec_cmd;
|
||||
else
|
||||
if (exec_cmds)
|
||||
last_exec_cmd->next_cmd = new_exec_cmd;
|
||||
else
|
||||
exec_cmds = new_exec_cmd;
|
||||
|
||||
last_exec_cmd = new_exec_cmd;
|
||||
|
||||
new_exec_cmd->number = number;
|
||||
|
||||
@@ -417,17 +417,23 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
|
||||
* Linux 2.6.32-5-amd64 / x86_64
|
||||
*/
|
||||
buf_uname = (struct utsname *)malloc (sizeof (struct utsname));
|
||||
if (buf_uname && (uname (buf_uname) >= 0))
|
||||
if (buf_uname)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %s / %s",
|
||||
buf_uname->sysname, buf_uname->release,
|
||||
buf_uname->machine);
|
||||
if (uname (buf_uname) >= 0)
|
||||
{
|
||||
snprintf (buf, sizeof (buf), "%s %s / %s",
|
||||
buf_uname->sysname, buf_uname->release,
|
||||
buf_uname->machine);
|
||||
temp = weechat_string_replace (res, "$osinfo", buf);
|
||||
free (res);
|
||||
if (!temp)
|
||||
{
|
||||
free (buf_uname);
|
||||
return NULL;
|
||||
}
|
||||
res = temp;
|
||||
}
|
||||
free (buf_uname);
|
||||
temp = weechat_string_replace (res, "$osinfo", buf);
|
||||
free (res);
|
||||
if (!temp)
|
||||
return NULL;
|
||||
res = temp;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -664,6 +664,17 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
new_nick->host = (host) ? strdup (host) : NULL;
|
||||
length = strlen (irc_server_get_prefix_chars (server));
|
||||
new_nick->prefixes = malloc (length + 1);
|
||||
if (!new_nick->name || !new_nick->prefixes)
|
||||
{
|
||||
if (new_nick->name)
|
||||
free (new_nick->name);
|
||||
if (new_nick->host)
|
||||
free (new_nick->host);
|
||||
if (new_nick->prefixes)
|
||||
free (new_nick->prefixes);
|
||||
free (new_nick);
|
||||
return NULL;
|
||||
}
|
||||
if (new_nick->prefixes)
|
||||
{
|
||||
memset (new_nick->prefixes, ' ', length);
|
||||
|
||||
@@ -101,6 +101,8 @@ logger_tail_file (const char *filename, int n_lines)
|
||||
bytes_read = read (fd, buf, to_read);
|
||||
if (bytes_read <= 0)
|
||||
{
|
||||
if (part_of_line)
|
||||
free (part_of_line);
|
||||
logger_tail_free (ptr_line);
|
||||
close (fd);
|
||||
return NULL;
|
||||
@@ -140,6 +142,7 @@ logger_tail_file (const char *filename, int n_lines)
|
||||
if (!new_line->data)
|
||||
{
|
||||
free (part_of_line);
|
||||
free (new_line);
|
||||
logger_tail_free (ptr_line);
|
||||
close (fd);
|
||||
return NULL;
|
||||
|
||||
@@ -907,9 +907,16 @@ plugin_script_remove_file (struct t_weechat_plugin *weechat_plugin,
|
||||
while (i < 2)
|
||||
{
|
||||
path_script = plugin_script_search_path (weechat_plugin, name);
|
||||
/* script not found? */
|
||||
/*
|
||||
* script not found? (if path_script == name, that means the function
|
||||
* above did not find the script)
|
||||
*/
|
||||
if (!path_script || (strcmp (path_script, name) == 0))
|
||||
{
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
break;
|
||||
}
|
||||
num_found++;
|
||||
if (unlink (path_script) == 0)
|
||||
{
|
||||
|
||||
@@ -1633,58 +1633,58 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
|
||||
weechat_hashtable_set (hash_redirect, "signal", str_signal);
|
||||
if (weechat_strcasecmp (irc_command, "mode") == 0)
|
||||
{
|
||||
if (irc_argc == 1)
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel");
|
||||
if (irc_argc > 0)
|
||||
{
|
||||
if (irc_argc == 1)
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel");
|
||||
weechat_hashtable_set (hash_redirect, "string",
|
||||
irc_argv[0]);
|
||||
}
|
||||
snprintf (str_server_channel,
|
||||
sizeof (str_server_channel),
|
||||
"%s,%s",
|
||||
client->protocol_args,
|
||||
irc_argv[0]);
|
||||
info = weechat_info_get ("irc_is_channel",
|
||||
str_server_channel);
|
||||
if (info && (strcmp (info, "1") == 0))
|
||||
{
|
||||
/* command "MODE #channel ..." */
|
||||
if (irc_argc == 2)
|
||||
snprintf (str_server_channel,
|
||||
sizeof (str_server_channel),
|
||||
"%s,%s",
|
||||
client->protocol_args,
|
||||
irc_argv[0]);
|
||||
info = weechat_info_get ("irc_is_channel",
|
||||
str_server_channel);
|
||||
if (info && (strcmp (info, "1") == 0))
|
||||
{
|
||||
if ((strcmp (irc_argv[1], "b") == 0)
|
||||
|| (strcmp (irc_argv[1], "+b") == 0))
|
||||
/* command "MODE #channel ..." */
|
||||
if (irc_argc == 2)
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_ban");
|
||||
}
|
||||
else if ((strcmp (irc_argv[1], "e") == 0)
|
||||
|| (strcmp (irc_argv[1], "+e") == 0))
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_ban_exception");
|
||||
}
|
||||
else if ((strcmp (irc_argv[1], "I") == 0)
|
||||
|| (strcmp (irc_argv[1], "+I") == 0))
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_invite");
|
||||
if ((strcmp (irc_argv[1], "b") == 0)
|
||||
|| (strcmp (irc_argv[1], "+b") == 0))
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_ban");
|
||||
}
|
||||
else if ((strcmp (irc_argv[1], "e") == 0)
|
||||
|| (strcmp (irc_argv[1], "+e") == 0))
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_ban_exception");
|
||||
}
|
||||
else if ((strcmp (irc_argv[1], "I") == 0)
|
||||
|| (strcmp (irc_argv[1], "+I") == 0))
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_channel_invite");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* command "MODE nick ..." */
|
||||
if (irc_argc == 1)
|
||||
else
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_user");
|
||||
/* command "MODE nick ..." */
|
||||
if (irc_argc == 1)
|
||||
{
|
||||
redirect_msg = 1;
|
||||
weechat_hashtable_set (hash_redirect, "pattern",
|
||||
"mode_user");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,6 +388,7 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
|
||||
*/
|
||||
free (client->partial_message);
|
||||
client->partial_message = NULL;
|
||||
weechat_string_free_split (lines);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,8 @@ relay_websocket_build_handshake (struct t_relay_client *client)
|
||||
weechat_string_encode_base64 ((char *)result, length, sec_websocket_accept);
|
||||
gcry_md_close (hd);
|
||||
|
||||
free (key);
|
||||
|
||||
/* build the handshake (it will be sent as-is to client) */
|
||||
snprintf (handshake, sizeof (handshake),
|
||||
"HTTP/1.1 101 Switching Protocols\r\n"
|
||||
|
||||
@@ -628,7 +628,6 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
goto end;
|
||||
ptr_hdata = ptr_hdata_head;
|
||||
strcpy (path_returned, hdata_head);
|
||||
hdata_name = hdata_head;
|
||||
for (i = 1; i < num_path; i++)
|
||||
{
|
||||
pos = strchr (list_path[i], '(');
|
||||
|
||||
@@ -1394,6 +1394,7 @@ relay_weechat_protocol_recv (struct t_relay_client *client, const char *data)
|
||||
|
||||
if (id)
|
||||
free (id);
|
||||
free (command);
|
||||
if (argv)
|
||||
weechat_string_free_split (argv);
|
||||
if (argv_eol)
|
||||
|
||||
@@ -174,22 +174,22 @@ script_repo_get_filename_loaded (struct t_script_repo *script)
|
||||
weechat_home = weechat_info_get ("weechat_dir", NULL);
|
||||
length = strlen (weechat_home) + strlen (script->name_with_extension) + 64;
|
||||
filename = malloc (length);
|
||||
if (filename)
|
||||
if (!filename)
|
||||
return NULL;
|
||||
|
||||
snprintf (filename, length, "%s/%s/autoload/%s",
|
||||
weechat_home,
|
||||
script_language[script->language],
|
||||
script->name_with_extension);
|
||||
if (stat (filename, &st) != 0)
|
||||
{
|
||||
snprintf (filename, length, "%s/%s/autoload/%s",
|
||||
snprintf (filename, length, "%s/%s/%s",
|
||||
weechat_home,
|
||||
script_language[script->language],
|
||||
script->name_with_extension);
|
||||
if (stat (filename, &st) != 0)
|
||||
{
|
||||
snprintf (filename, length, "%s/%s/%s",
|
||||
weechat_home,
|
||||
script_language[script->language],
|
||||
script->name_with_extension);
|
||||
if (stat (filename, &st) != 0)
|
||||
{
|
||||
filename[0] = '\0';
|
||||
}
|
||||
filename[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <string.h>
|
||||
#include "../src/core/wee-hashtable.h"
|
||||
#include "../src/plugins/plugin.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(Hashtable)
|
||||
@@ -37,7 +39,35 @@ TEST_GROUP(Hashtable)
|
||||
|
||||
TEST(Hashtable, HashDbj2)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
unsigned long long hash;
|
||||
|
||||
hash = hashtable_hash_key_djb2 ("test");
|
||||
CHECK(hash == 5849825121ULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test callback hashing a key.
|
||||
*
|
||||
* It returns the djb2 hash + 1.
|
||||
*/
|
||||
|
||||
unsigned long long
|
||||
test_hashtable_hash_key_cb (struct t_hashtable *hashtable, const void *key)
|
||||
{
|
||||
return hashtable_hash_key_djb2 ((const char *)key) + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test callback comparing two keys.
|
||||
*
|
||||
* It just makes a string comparison (strcmp) between both keys.
|
||||
*/
|
||||
|
||||
int
|
||||
test_hashtable_keycmp_cb (struct t_hashtable *hashtable,
|
||||
const void *key1, const void *key2)
|
||||
{
|
||||
return strcmp ((const char *)key1, (const char *)key2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -47,7 +77,42 @@ TEST(Hashtable, HashDbj2)
|
||||
|
||||
TEST(Hashtable, New)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
struct t_hashtable *hashtable;
|
||||
|
||||
hashtable = hashtable_new (-1, NULL, NULL, NULL, NULL);
|
||||
POINTERS_EQUAL(NULL, hashtable);
|
||||
|
||||
/* test invalid size */
|
||||
POINTERS_EQUAL(NULL,
|
||||
hashtable_new (-1,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL));
|
||||
|
||||
/* test invalid type for keys/values */
|
||||
POINTERS_EQUAL(NULL,
|
||||
hashtable_new (32,
|
||||
"xxxxx", /* invalid */
|
||||
"yyyyy", /* invalid */
|
||||
NULL, NULL));
|
||||
|
||||
/* valid hashtable */
|
||||
hashtable = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_INTEGER,
|
||||
&test_hashtable_hash_key_cb,
|
||||
&test_hashtable_keycmp_cb);
|
||||
CHECK(hashtable);
|
||||
LONGS_EQUAL(32, hashtable->size);
|
||||
CHECK(hashtable->htable);
|
||||
LONGS_EQUAL(0, hashtable->items_count);
|
||||
LONGS_EQUAL(HASHTABLE_STRING, hashtable->type_keys);
|
||||
LONGS_EQUAL(HASHTABLE_INTEGER, hashtable->type_values);
|
||||
POINTERS_EQUAL(&test_hashtable_hash_key_cb, hashtable->callback_hash_key);
|
||||
POINTERS_EQUAL(&test_hashtable_keycmp_cb, hashtable->callback_keycmp);
|
||||
POINTERS_EQUAL(NULL, hashtable->callback_free_key);
|
||||
POINTERS_EQUAL(NULL, hashtable->callback_free_value);
|
||||
hashtable_free (hashtable);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -42,13 +42,29 @@ extern "C"
|
||||
string_has_highlight_regex (__str, __regex)); \
|
||||
LONGS_EQUAL(__result_regex, \
|
||||
string_regcomp (®ex, __regex, REG_ICASE)); \
|
||||
LONGS_EQUAL(__result_hl, \
|
||||
string_has_highlight_regex_compiled (__str, \
|
||||
®ex)); \
|
||||
if (__result_regex == 0) \
|
||||
regfree(®ex);
|
||||
|
||||
#define WEE_REPLACE_REGEX(__result_regex, __result_replace, __str, \
|
||||
__regex, __replace, __ref_char, __callback) \
|
||||
LONGS_EQUAL(__result_regex, \
|
||||
string_regcomp (®ex, __regex, \
|
||||
REG_EXTENDED | REG_ICASE)); \
|
||||
result = string_replace_regex (__str, ®ex, __replace, \
|
||||
__ref_char, __callback, NULL); \
|
||||
if (__result_replace == NULL) \
|
||||
{ \
|
||||
LONGS_EQUAL(__result_hl, \
|
||||
string_has_highlight_regex_compiled (__str, \
|
||||
®ex)); \
|
||||
regfree(®ex); \
|
||||
}
|
||||
POINTERS_EQUAL(NULL, result); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
STRCMP_EQUAL(__result_replace, result); \
|
||||
} \
|
||||
if (__result_regex == 0) \
|
||||
regfree(®ex);
|
||||
|
||||
#define WEE_FORMAT_SIZE(__result, __size) \
|
||||
str = string_format_size (__size); \
|
||||
@@ -516,6 +532,10 @@ TEST(String, Highlight)
|
||||
|
||||
TEST(String, Replace)
|
||||
{
|
||||
regex_t regex;
|
||||
char *result;
|
||||
|
||||
/* basic replace */
|
||||
POINTERS_EQUAL(NULL, string_replace (NULL, NULL, NULL));
|
||||
POINTERS_EQUAL(NULL, string_replace ("string", NULL, NULL));
|
||||
POINTERS_EQUAL(NULL, string_replace (NULL, "search", NULL));
|
||||
@@ -528,6 +548,19 @@ TEST(String, Replace)
|
||||
STRCMP_EQUAL("test xxx def", string_replace("test abc def", "abc", "xxx"));
|
||||
STRCMP_EQUAL("xxx test xxx def xxx",
|
||||
string_replace("abc test abc def abc", "abc", "xxx"));
|
||||
|
||||
/* replace with regex */
|
||||
WEE_REPLACE_REGEX(-1, NULL, NULL, NULL, NULL, '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, NULL, NULL, "", NULL, '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "string", "string", "", NULL, '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "test abc def", "test abc def", "xyz", "xxx", '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "test xxx def", "test abc def", "abc", "xxx", '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "foo", "test foo", "^(test +)(.*)", "$2", '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "test / ***", "test foo", "^(test +)(.*)", "$1/ $.*2", '$', NULL);
|
||||
WEE_REPLACE_REGEX(0, "%%%", "test foo", "^(test +)(.*)", "$.%+", '$', NULL);
|
||||
|
||||
/* replace with a callback */
|
||||
/* TODO: write tests for string_replace_with_callback */
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user