This manual documents WeeChat chat client, it is part of WeeChat.

Latest version of this document can be found on this page:

1. Introduction

WeeChat (Wee Enhanced Environment for Chat) is a free chat client, fast and light, designed for many operating systems.

This manual documents WeeChat internals:

  • repositories

  • coding rules

  • core internals

  • plugin internals

  • how to contribute to WeeChat.

2. Repositories

WeeChat repositories are on GitHub organization "weechat":

List of repositories:


core repository with source code and documentation


the official scripts submitted on

source of WeeChat website:


IRC testing server


Qt remote GUI for WeeChat.

This manual documents only weechat repository.

2.1. Overview

The main WeeChat directories are:

Directory Description


Root of sources.


Core functions: entry point, internal structures.


Hook functions.


Functions for buffers, windows, …​ (used by all interfaces).


Curses interface.


Headless mode (no interface).


Curses interface.


Plugin and scripting API.


Alias plugin.


Buflist plugin.


Charset plugin.


Exec plugin.


Fifo plugin (FIFO pipe used to remotely send commands to WeeChat).


Fset (Fast Set) plugin.


Guile (scheme) scripting API.


IRC (Internet Relay Chat) plugin.


JavaScript scripting API.


Logger plugin (write messages displayed to files).


Lua scripting API.


Perl scripting API.


PHP scripting API.


Python scripting API.


Relay plugin (irc proxy + relay for remote interfaces).


Ruby scripting API.


Script manager.


Spell plugin.


Tcl scripting API.


Trigger plugin.


Typing plugin.


Xfer plugin (IRC DCC file/chat).




Scripting API tests.


Python scripts to generate and run the scripting API tests.


Unit tests.


Unit tests for core functions.


Unit tests for interfaces functions.


Unit tests for plugins.


Unit tests for IRC plugin.


Unit tests for trigger plugin.




Translations files (gettext).


Debian packaging.

2.2. Sources

2.2.1. Core

WeeChat "core" is located in following directories:

  • src/core/: core functions (for data manipulation)

  • src/gui/: functions about interface (buffers, windows, …​)

Path/file Description


Core functions: entry point, internal structures.


Array lists.


Display a backtrace after a crash.


Calculate result of expressions.


WeeChat core commands.


Default completions.


Configuration file management.


Configuration options for WeeChat core (file weechat.conf).


Cryptographic functions.


Some debug functions.


Directory/file functions.


Evaluation of expressions with references to internal vars.




Hdata (direct access to data using hashtables).




Infolists (lists with objects data).


Input of commands/text.


Sorted lists.


Write to WeeChat log file (weechat.log).


Network functions (connection to servers/proxies).


Proxy management.


Secured data functions.


Secured data buffer.


Secured data options (file sec.conf).


Signal functions.


Functions on strings.


Internal upgrade system.


Upgrade for WeeChat core (buffers, lines, history, …​).


URL transfer (using libcurl).


UTF-8 functions.


Some other functions.


Functions for WeeChat version.


Main functions: command line options, startup.


Hook functions.


Hook "command_run".


Hook "command".


Hook "completion".


Hook "config".


Hook "connect".


Hook "fd".


Hook "focus".


Hook "hdata".


Hook "hsignal".


Hook "info_hashtable".


Hook "info".


Hook "infolist".


Hook "line".


Hook "modifier".


Hook "print".


Hook "process".


Hook "signal".


Hook "timer".


Functions for buffers, windows, …​ (used by all interfaces).


Bar items.


Bar windows.






Chat functions (display message, …​).


Color functions.


Completion on command line.


Cursor mode (free movement of cursor).




Functions about focus (for cursor mode and mouse).


Commands/text saved in buffers.


Hotlist management (list of buffers with activity).


Input functions (input bar).


Keyboard functions.




Lines in buffers.




Nick functions.


Nicklist in buffers.




Curses interface.


Display in bar windows.


Display in chat area (messages).


Color functions.


Keyboard functions (default keys, read of input).


WeeChat main loop (waiting for keyboard/network events).




Functions about terminal.




Headless mode (no interface).


Entry point for headless mode.


Fake ncurses library.


Curses interface.


Entry point for Curses interface.

2.2.2. Plugins

Path/file Description


Root of plugins.


Plugins management (load/unload dynamic C libraries).


Extra functions for plugin API (wrapper around WeeChat core functions).


Extra info/infolist functions for plugin API.


Plugin configuration options (file plugins.conf).


Common functions used by script plugins.


Script API functions: wrappers around some plugin API functions.


Script plugin configuration options (files python.conf, perl.conf, …​).


Header designed to be distributed with WeeChat plugins, in order to compile them.


Alias plugin.


Main alias functions.


Alias commands.


Alias completions.


Alias config options (file alias.conf).


Alias info/infolists/hdata.


Spell checker plugin.


Main spell checker functions.


Spell checker bar items.


Spell checker commands.


Spell checker completions.


Spell checker config options (file spell.conf).


Spell checker info/infolists/hdata.


Spellers management.


Buflist plugin.


Main buflist functions.


Buflist bar items.


Buflist commands.


Buflist config options (file buflist.conf).


Buflist info/infolists/hdata.


Buflist mouse actions.


Charset plugin.


Charset functions.


Exec plugin.


Main exec functions.


Exec buffer.


Exec commands.


Exec completions.


Exec config options (file exec.conf).


Fifo plugin.


Main fifo functions.


Fifo commands.


Fifo config options (file fifo.conf).


Fifo info/infolists/hdata.


Fset plugin.


Main fset functions.


Fset bar items.


Fset buffer.


Fset commands.


Fset completions.


Fset config options (file fset.conf).


Fset info/infolists/hdata.


Fset mouse actions.


Fset options management.


Guile (scheme) plugin.


Main guile functions (load/unload scripts, execute guile code).


Guile scripting API functions.


IRC (Internet Relay Chat) plugin.


Main IRC functions.


IRC bar items.


IRC buffers.


IRC channels.


IRC colors.


IRC commands.


IRC completions.


IRC config options (file irc.conf).




IRC debug functions.


IRC Ignore.


IRC info/infolists/hdata.


Input of commands/text.


Functions to manipulate IRC messages.


Functions about channel/nick modes.


IRC channel mode lists (+b, +e, +I, …​).


Target buffer for IRC messages.


IRC nicks.


IRC notify lists.


IRC protocol (RFCs 1459/2810/2811/2812/2813).


IRC raw buffer.


Redirection of IRC command output.


SASL authentication with IRC server.


I/O communication with IRC server.


Functions to manipulate IRC message tags.


Save/restore of IRC data when upgrading WeeChat.


JavaScript plugin.


Main JavaScript functions (load/unload scripts, execute JavaScript code).


JavaScript scripting API functions.


JavaScript v8 functions.


Logger plugin.


Main logger functions.


Logger backlog functions.


Logger buffer list management.


Logger commands.


Logger config options (file logger.conf).


Logger info/infolists/hdata.


Functions to get last lines of a file.


Lua plugin.


Main lua functions (load/unload scripts, execute lua code).


Lua scripting API functions.


Perl plugin.


Main perl functions (load/unload scripts, execute perl code).


Perl scripting API functions.


PHP plugin.


Main PHP functions (load/unload scripts, execute PHP code).


PHP scripting API functions.


Python plugin.


Main python functions (load/unload scripts, execute python code).


Python scripting API functions.


Relay plugin (IRC proxy and relay for remote interfaces).


Main relay functions.


Clients authentication.


Relay buffer.


Clients of relay.


Relay commands.


Relay completions.


Relay config options (file relay.conf).


Relay info/infolists/hdata.


Network functions for relay.


Relay raw buffer.


Relay server.


Save/restore of relay data when upgrading WeeChat.


WebSocket server functions (RFC 6455).


IRC proxy.


Main IRC proxy functions.


Relay for remote interfaces.


Relay for remote interfaces (main functions).


Send binary messages to clients.


Nicklist functions.


Read commands from clients.


Ruby plugin.


Main ruby functions (load/unload scripts, execute ruby code).


Ruby scripting API functions.


Script manager.


Main functions for script manager.


Actions on scripts (load/unload, install/remove, …​).


Buffer for script manager.


Commands for script manager.


Completions for script manager.


Config options for script manager (file script.conf).


Script manager info/infolists/hdata.


Script mouse actions.


Download and read repository file.


Tcl plugin.


Main tcl functions (load/unload scripts, execute tcl code).


Tcl scripting API functions.


Trigger plugin.


Main trigger functions.


Trigger buffer.


Trigger callbacks.


Trigger commands.


Trigger completions.


Trigger config options (file trigger.conf).


Typing plugin.


Main typing functions.


Typing bar items.


Typing config options (file typing.conf).


Messages typing status on buffers.


Xfer plugin (IRC DCC file/chat).


Main xfer functions.


Xfer buffer.


DCC chat.


Xfer commands.


Xfer completions.


Xfer config options (file xfer.conf).


DCC file transfer.


File functions for xfer.


Xfer info/infolists/hdata.


Network functions for xfer.


Save/restore of xfer data when upgrading WeeChat.

2.2.3. Tests

Path/file Description


Root of tests.


Program used to run all tests.


Root of scripting API tests.


Program used to run the scripting API tests.


Python scripts to generate and run the scripting API tests.

Python script generating scripts in all languages to test the scripting API.

Python script with scripting API tests, used by script

Convert Python code to other languages, used by script


Root of unit tests.


Tests: plugins.


Root of unit tests for core.


Tests: arraylists.


Tests: calculation of expressions.


Tests: configuration files.


Tests: cryptographic functions.


Tests: directory/file functions.


Tests: evaluation of expressions.


Tests: hashtables.


Tests: hdata.


Tests: hooks.


Tests: infolists.


Tests: lists.


Tests: network functions.


Tests: secured data.


Tests: signals.


Tests: strings.


Tests: URLs.


Tests: UTF-8.


Tests: utility functions.


Root of unit tests for interfaces.


Tests: colors.


Tests: lines.


Tests: nicks.


Root of unit tests for plugins.


Root of unit tests for IRC plugin.


Tests: IRC buffers.


Tests: IRC channels.


Tests: IRC colors.


Tests: IRC configuration.


Tests: IRC ignores.


Tests: IRC messages.


Tests: IRC modes.


Tests: IRC nicks.


Tests: IRC protocol.


Tests: SASL authentication with IRC protocol.


Tests: IRC server.


Root of unit tests for trigger plugin.


Tests: triggers.


Tests: trigger configuration.


Root of unit tests for typing plugin.


Tests: typing.


Tests: typing status.


Root of unit tests for Relay plugin.


Tests: clients authentication.

2.3. Documentation / translations

Documentation files:

Path/file Description




Asciidoctor style.

Python script to build auto-generated files in includes/ directory (see below).


Documentation for language XX (languages: en, fr, de, it, …​).


Man page (man weechat).


Developer’s guide (this document).




Plugin API reference.


Quickstart guide.


Relay protocol (for remote interfaces).


Scripting guide.


User’s guide.


Files included in documentation.


Auto-generated file for Plugin API reference: completions (do NEVER update manually!).


Auto-generated file for Plugin API reference: hdata (do NEVER update manually!).


Auto-generated file for Plugin API reference: infolists (do NEVER update manually!).


Auto-generated file for Plugin API reference: infos (do NEVER update manually!).


Auto-generated file for Plugin API reference: infos hashtable (do NEVER update manually!).


Auto-generated file for Plugin API reference: plugins priority (do NEVER update manually!).


Auto-generated file for Plugin API reference: URL options (do NEVER update manually!).


Auto-generated file for User’s guide: commands (do NEVER update manually!).


Auto-generated file for User’s guide: default aliases (do NEVER update manually!).


Auto-generated file for User’s guide: IRC colors (do NEVER update manually!).


Auto-generated file for User’s guide: configuration options (do NEVER update manually!).


Command-line options (file included in man pages and user’s guide).


Part of man pages: plugin options, files and copyright.

Translations for WeeChat and plugins are done with gettext, files are in po/ directory:

Path/file Description


Translation files (gettext).


Translations for language XX (fr, de, it, …​), base language is English.


Template for translations (auto-built).

3. Coding rules

3.1. General rules

  • In source code, your comments, variable names, .. must be written in English only (no other language is allowed).

  • Use a copyright header in each new source file with:

    • short description of file (one line),

    • date,

    • name,

    • e-mail,

    • license.

Example in C:

 * weechat.c - core functions for WeeChat
 * Copyright (C) 2022 Your Name <>
 * This file is part of WeeChat, the extensible chat client.
 * WeeChat is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * WeeChat is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with WeeChat.  If not, see <>.

3.2. C style

Some basic rules you must follow when you write C code:

  • Use 4 spaces for indentation. Don’t use tabs, they are evil.

  • Try to not exceed 80 chars by line, except if this is needed to increase readability.

  • Use comments /* comment */ (not C99-style comments like // comment).

  • Add a comment before any function, to explain what it does (always use a multi-line comment, even if description is very short).


 * Checks if a string with boolean value is valid.
 * Returns:
 *   1: boolean value is valid
 *   0: boolean value is NOT valid

foo ()
    int i;

    /* one line comment */
    i = 1;

     * multi-line comment: this is a very long description about next block
     * of code
    i = 2;
    printf ("%d\n", i);
  • Use explicit variable names, for example "nicks_count" instead of "n" or "nc". Exception: in for loops, where variables like "i" or "n" are OK.

  • Initialize local variables after declaration, in body of function, example:

foo ()
    int nick_count, buffer_count;

    nick_count = 0;
    buffer_count = 1;
    /* ... */
  • Use parentheses to explicitly show how expression is evaluated, even if they are not required, for example: write x + (y * z) instead of x + y * z.

  • Place curly brackets { } alone on lines, and indent them with number of spaces used for line above opening curly bracket (the if in example):

if (nicks_count == 1)
    /* something */
  • Use empty lines to separate many different blocks inside functions, and if possible add a comment for each one, like this:

 * Sends a message from out queue.

irc_server_outqueue_send (struct t_irc_server *server)
    /* ... */

    /* send signal with command that will be sent to server */
    irc_server_send_signal (server, "irc_out",
    tags_to_send = irc_server_get_tags_to_send (server->outqueue[priority]->tags);
    irc_server_send_signal (server, "irc_outtags",
                            (tags_to_send) ? tags_to_send : "");
    if (tags_to_send)
        free (tags_to_send);

    /* send command */
    irc_server_send (server, server->outqueue[priority]->message_after_mod,
                     strlen (server->outqueue[priority]->message_after_mod));
    server->last_user_message = time_now;

    /* start redirection if redirect is set */
    if (server->outqueue[priority]->redirect)
        irc_redirect_init_command (server->outqueue[priority]->redirect,

    /* ... */
  • Indent the if conditions, and use parentheses around conditions with an operator (not needed for single boolean), like this:

if (something)
    /* something */
    /* something else */

if (my_boolean1 && my_boolean2 && (i == 10)
    && ((buffer1 != buffer2) || (window1 != window2)))
    /* something */
    /* something else */
  • Indent the switch statements like this:

switch (string[0])
    case 'A':  /* first case */
        foo ("abc", "def");
    case 'B':  /* second case */
        bar (1, 2, 3);
    default:  /* other cases */
        baz ();
  • Use typedef for function prototypes but not for structures:

typedef int (t_hook_callback_fd)(void *data, int fd);

struct t_hook_fd
    t_hook_callback_fd *callback;      /* fd callback                       */
    int fd;                            /* socket or file descriptor         */
    int flags;                         /* fd flags (read,write,..)          */
    int error;                         /* contains errno if error occurred  */
                                       /* with fd                           */

/* ... */

struct t_hook_fd *new_hook_fd;

new_hook_fd = malloc (sizeof (*new_hook_fd));
  • This Lisp code can be used in your ~/.emacs.el to indent properly if you are using Emacs as text editor:

(add-hook 'c-mode-common-hook
          '(lambda ()
             (c-toggle-hungry-state t)
             (c-set-style "k&r")
             (setq c-basic-offset 4)
             (c-tab-always-indent t)
             (c-set-offset 'case-label '+)))

4. Core internals

4.1. Naming convention

4.1.1. Files

File names are composed by letters and hyphens, with format: xxx-yyyyy.[ch], where xxx is directory/component (can be abbreviation) and yyyyy a name for the file.

The main file of a directory may have same name as directory, for example irc.c in irc plugin.


Directory Files


weechat.c, wee-backtrace.c, wee-command.c, …​


gui-bar.c, gui-bar-item.c, gui-bar-window.c, …​


gui-curses-bar.c, gui-curses-bar-window.c, gui-curses-chat.c, …​


plugin.c, plugin-api.c, plugin-api-info.c, plugin-config.c, plugin-script.c, …​


irc.c, irc-bar-item.c, irc-buffer.c, …​


weechat-python.c, weechat-python-api.c, …​

The headers of C files have same name as file, for example wee-command.h for file wee-command.c.

4.1.2. Structures

Structures have name t_X_Y or t_X_Y_Z:

  • X: directory/component (can be abbreviation)

  • Y: end of file name

  • Z: name for structure (optional)

Example: an IRC nick (from src/plugins/irc/irc-nick.h):

struct t_irc_nick
    char *name;                     /* nickname                              */
    char *host;                     /* full hostname                         */
    char *prefixes;                 /* string with prefixes enabled for nick */
    char prefix[2];                 /* current prefix (higher prefix set in  */
                                    /* prefixes)                             */
    int away;                       /* 1 if nick is away                     */
    char *color;                    /* color for nickname in chat window     */
    struct t_irc_nick *prev_nick;   /* link to previous nick on channel      */
    struct t_irc_nick *next_nick;   /* link to next nick on channel          */

4.1.3. Variables

Global variables (outside functions) have name X_Y_Z:

  • X: directory/component (can be abbreviation)

  • Y: end of file name

  • Z: name for variable

Exception are variables for "last" node of a list, name is last_X (where X is name of variable, using singular form).

Example: windows (from src/gui/gui-window.c):

struct t_gui_window *gui_windows = NULL;        /* first window             */
struct t_gui_window *last_gui_window = NULL;    /* last window              */
struct t_gui_window *gui_current_window = NULL; /* current window           */

There is no naming convention for local variables (in functions). The only recommendation is that name is explicit (not too short).
Nevertheless, pointers to structures are often named ptr_xxxx, for example a pointer on a struct t_gui_buffer * will be: *ptr_buffer.

4.1.4. Functions

Naming convention for functions is the same as variables.

Example: creation of a new window (from src/gui/gui-window.c):

 * Creates a new window.
 * Returns pointer to new window, NULL if error.

struct t_gui_window *
gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
                int x, int y, int width, int height,
                int width_pct, int height_pct)
    /* ... */

    return new_window;

4.2. Single thread

WeeChat is single threaded. That means every part of code should execute very fast, and that calls to functions like sleep are strictly forbidden (it is true for WeeChat core, but also C plugins and scripts).

If for some reasons you have to sleep a while, use hook_timer with a callback.

4.3. Doubly linked lists

Most of WeeChat lists are doubly linked lists: each node has pointer to previous and next node.

Example: list of buffers (from src/gui/gui-buffer.h):

struct t_gui_buffer
    /* data */

    /* ... */

    struct t_gui_buffer *prev_buffer;  /* link to previous buffer           */
    struct t_gui_buffer *next_buffer;  /* link to next buffer               */

Then the two list pointers, to the head and tail of list:

struct t_gui_buffer *gui_buffers = NULL;           /* first buffer          */
struct t_gui_buffer *last_gui_buffer = NULL;       /* last buffer           */

4.4. Color codes in strings

WeeChat uses own color codes in strings to display attributes (bold, underline, …​) and colors on screen.

All attributes/colors are prefixed with a char in string, which can be:

  • 0x19: color code (followed by color code(s))

  • 0x1A: set attribute (followed by raw attribute on one char)

  • 0x1B: remove attribute (followed by raw attribute on one char)

  • 0x1C: reset (nothing after)

Possible colors are:

  • standard color: optional attributes + number on 2 digits

  • extended color: @ + optional attributes + number on 5 digits

In following table, these conventions are used:

  • STD: standard color (2 digits)

  • (ATTR)STD: standard color with optional attributes (attributes + 2 digits)

  • EXT: extended color (@ + 5 digits)

  • (ATTR)EXT: extended color with optional attributes (@ + attributes + 5 digits)

  • (ATTR): one or more attribute chars:

    • *: bold

    • !: reverse

    • /: italic

    • _: underline

    • |: keep attributes

  • (a): one raw attribute char:

    • 0x01: bold

    • 0x02: reverse

    • 0x03: italic

    • 0x04: underline

All combinations are summarized in this table:

Code Example Areas Description

19 + STD

19 01

chat + bars

Set attributes and color using option, see table below.

19 + EXT

19 @00001


Set color with a ncurses pair (used only on /color buffer).

19 + F + (ATTR)STD

19 F*05

chat + bars

Set foreground (WeeChat color).

19 + F + (ATTR)EXT

19 F@00214

chat + bars

Set foreground (extended color).

19 + B + STD

19 B05

chat + bars

Set background (WeeChat color).

19 + B + EXT

19 B@00124

chat + bars

Set background (extended color).

19 + * + (ATTR)STD

19 *05

chat + bars

Set foreground (WeeChat color).

19 + * + (ATTR)EXT

19 *@00214

chat + bars

Set foreground (extended color).

19 + * + (ATTR)STD + , + STD (1)

19 *08,05

chat + bars

Set foreground/background (WeeChat colors).

19 + * + (ATTR)STD + , + EXT (1)

19 *01,@00214

chat + bars

Set foreground (WeeChat color) and background (extended color).

19 + * + (ATTR)EXT + , + STD (1)

19 *@00214,05

chat + bars

Set foreground (extended color) and background (WeeChat color).

19 + * + (ATTR)EXT + , + EXT (1)

19 *@00214,@00017

chat + bars

Set foreground/background (extended colors).

19 + * + (ATTR)STD + ~ + STD

19 *08~05

chat + bars

Set foreground/background (WeeChat colors).

19 + * + (ATTR)STD + ~ + EXT

19 *01~@00214

chat + bars

Set foreground (WeeChat color) and background (extended color).

19 + * + (ATTR)EXT + ~ + STD

19 *@00214~05

chat + bars

Set foreground (extended color) and background (WeeChat color).

19 + * + (ATTR)EXT + ~ + EXT

19 *@00214~@00017

chat + bars

Set foreground/background (extended colors).

19 + b + F

19 bF


Set bar foreground color.

19 + b + D

19 bD


Set bar delimiter color.

19 + b + B

19 bB


Set bar background color.

19 + b + _

19 b_

input bar

Start input char (used only in item "input_text").

19 + b + -

19 b-

input bar

Start input hidden char (used only in item "input_text").

19 + b + #

19 b#

input bar

Move cursor char (used only in item "input_text").

19 + b + i

19 bi


Start item.

19 + b + l (lower L)

19 bl


Start line item.

19 + E

19 E

chat + bars

Emphasize text (WeeChat ≥ 0.4.2).

19 + 1C

19 1C

chat + bars

Reset color (keep attributes).

1A + (a)

1A 01

chat + bars

Set attribute.

1B + (a)

1B 01

chat + bars

Remove attribute.



chat + bars

Reset attributes and color.

(1) The use of comma as separator was used until WeeChat 2.5.
With WeeChat ≥ 2.6, a tilde is used to separate foreground from background color. If you are developing a WeeChat relay client and want to be compatible with all WeeChat versions, you should support both separators (for example if a user with WeeChat ≤ 2.5 runs /upgrade to a version ≥ 2.6, both separators could be used at same time in buffers).

Color codes using options (see t_gui_color_enum, in file src/gui/gui-color.h):

Code Option



































(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)


(not used any more since WeeChat 0.3.4)
















weechat.color.chat_tags (WeeChat ≥ 0.3.6)


weechat.color.chat_inactive_window (WeeChat ≥ 0.3.6)


weechat.color.chat_inactive_buffer (WeeChat ≥ 0.3.6)


weechat.color.chat_prefix_buffer_inactive_buffer (WeeChat ≥ 0.3.6)


weechat.color.chat_nick_offline (WeeChat ≥ 0.3.9)


weechat.color.chat_nick_offline_highlight (WeeChat ≥ 0.3.9)


weechat.color.chat_nick_prefix (WeeChat ≥ 0.4.1)


weechat.color.chat_nick_suffix (WeeChat ≥ 0.4.1)


weechat.color.emphasized (WeeChat ≥ 0.4.2)


weechat.color.chat_day_change (WeeChat ≥ 0.4.2)


weechat.color.chat_value_null (WeeChat ≥ 1.4)

WeeChat colors are:

Code Color


Default (terminal foreground/background)




Dark gray


Dark red


Light red


Dark green


Light green






Dark blue


Light blue


Dark magenta


Light magenta


Dark cyan


Light cyan





Examples of color codes:

Code Description

19 01

Color of option "01" (chat text)

19 *08,03

Yellow on red

19 *@00214

Orange (extended color 214)

19 *@*_00214,@00017

Bold underlined orange (214) on dark blue (17)

1A _

Set underline

1B _

Remove underline


Reset attributes and color

5. Plugin internals

The file src/plugins/weechat-plugin.h defines and exports all functions available in the API.

A structure called t_weechat_plugin is used to store info about plugin (filename, name, author, description, …​) and all API functions, as pointers to WeeChat functions.

Then some macros are defined to call these functions.

For example, function hook_timer is defined in structure t_weechat_plugin like this:

struct t_hook *(*hook_timer) (struct t_weechat_plugin *plugin,
                              long interval,
                              int align_second,
                              int max_calls,
                              int (*callback)(void *data,
                                              int remaining_calls),
                              void *callback_data);

And the macro used to call this function is:

#define weechat_hook_timer(__interval, __align_second, __max_calls,     \
                           __callback, __data)                          \
    weechat_plugin->hook_timer(weechat_plugin, __interval,              \
                               __align_second, __max_calls,             \
                               __callback, __data)

So in a plugin, the call to function will be for example:

server->hook_timer_sasl = weechat_hook_timer (timeout * 1000,
                                              0, 1,

6. Contribute to WeeChat

6.1. Git repository

Git repository is at this URL:

Any patch for bug or new feature must be done on master branch, preferred way is a GitHub pull request. A patch can also be sent by e-mail (made with git diff or git format-patch).

Format of commit message is the following (with automatic close of a GitHub issue):

component: fix a problem (closes #123)

Where component is one of following:

  • WeeChat core: core (files in root directory, po/ and src/, except src/plugins/)

  • documentation files: doc (files in directory doc/)

  • name of a plugin: irc, python, relay, …​ (files in directory src/plugins/)

Some rules to follow:

  • Use only English.

  • Use infinitive form of verb.

  • If commit is related to a GitHub issue, write it in parenthesis after the message, with this format: (issue #123) or (closes #123) to close it.

Examples of commit messages:

core: add callback "nickcmp" for nick comparison in buffers
core: update Japanese translations
irc: add command /unquiet (closes #36)
python: fix crash when unloading a script without pointer to interpreter
ruby: add detection of ruby version 1.9.3 in CMake

6.2. Translations

6.2.1. Gettext

Gettext files are in directory po/.

If you want to initialize a new language, use command msginit. For example to create a file which is ready to translate to Dutch:

$ cd po
$ msginit -i weechat.pot -l nl_NL -o nl.po

Base language for WeeChat is English, so you must of course perfectly understand English in order to translate to your language.

After changes in sources, you can regenerate all translations files: run this command in the CMake "build" directory:

$ make translations && make update-po

Then you can edit .po files (if you can translate in a language).

When done, you have to check your file with script (

$ xx.po

And then you can recompile WeeChat to use the new translations.

Build auto-generated files

Files named autogen_* in directory doc/XX/includes/ are auto-generated by script doc/

You can rebuild auto-generated files directly in your WeeChat sources by running WeeChat in a temporary directory and loading the script:

weechat -t -r "/python load /path/to/weechat/doc/;/docgen;/quit"

6.2.2. Asciidoc

Asciidoc files are in directory doc/XX/ where XX is language (en, fr, de, it, …​).

First make a copy of an English asciidoc file (in directory doc/en/), then work on it.

The translations missing in files are indicated by this string:


You must translate whole file except links and special keywords for notes, warnings, …​ These words must be kept unchanged:



When there is a name after <<link_name>>, then you must translate it:

<<link_name,this text must be translated>>