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

Latest version of this document can be found on this page: http://weechat.org/doc

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:

  • repository (sources, doc, …)

  • coding rules

  • core internals

  • plugin internals

  • how to contribute to WeeChat.

2. Repository

WeeChat has two main repositories:

This manual documents only core repository.

2.1. Overview

The main WeeChat directories are:

Directory Description
src/

Root of sources

core/

Core functions: entry point, internal structures

gui/

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

curses/

Curses interface

plugins/

Plugin and scripting API

alias/

Alias plugin

aspell/

Aspell plugin

charset/

Charset plugin

exec/

Exec plugin

fifo/

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

irc/

IRC (Internet Relay Chat) plugin

logger/

Logger plugin (write messages displayed to files)

relay/

Relay plugin (irc proxy + relay for remote interfaces)

script/

Scripts manager

python/

Python scripting API

perl/

Perl scripting API

ruby/

Ruby scripting API

lua/

Lua scripting API

tcl/

Tcl scripting API

guile/

Guile (scheme) scripting API

trigger/

Trigger plugin

xfer/

Xfer plugin (IRC DCC file/chat)

tests/

Tests

unit/

Unit tests

core/

Unit tests for core functions

doc/

Documentation

po/

Translations files (gettext)

debian/

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/

Core functions: entry point, internal structures

weechat.c

Main functions: command line options, startup

wee-backtrace.c

Display a backtrace after a crash

wee-command.c

WeeChat core commands

wee-completion.c

Default completions

wee-config-file.c

Configuration file management

wee-config.c

Configuration options for WeeChat core (file weechat.conf)

wee-debug.c

Some debug functions

wee-eval.c

Evaluation of expressions with references to internal vars

wee-hashtable.c

Hashtables

wee-hdata.c

Hdata (direct access to data using hashtables)

wee-hook.c

Hooks

wee-infolist.c

Infolists (lists with objects data)

wee-input.c

Input of commands/text

wee-list.c

Sorted lists

wee-log.c

Write to WeeChat log file (weechat.log)

wee-network.c

Network functions (connection to servers/proxies)

wee-proxy.c

Proxy management

wee-secure.c

Secured data options (file sec.conf)

wee-string.c

Functions on strings

wee-upgrade-file.c

Internal upgrade system

wee-upgrade.c

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

wee-url.c

URL transfer (using libcurl)

wee-utf8.c

UTF-8 functions

wee-util.c

Some other functions

wee-version.c

Functions for WeeChat version

gui/

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

gui-bar-item.c

Bar items

gui-bar-window.c

Bar windows

gui-bar.c

Bars

gui-buffer.c

Buffers

gui-chat.c

Chat functions (display message, …)

gui-color.c

Color functions

gui-completion.c

Completion on command line

gui-cursor.c

Cursor mode (free movement of cursor)

gui-filter.c

Filters

gui-focus.c

Functions about focus (for cursor mode and mouse)

gui-history.c

Commands/text saved in buffers

gui-hotlist.c

Hotlist management (list of buffers with activity)

gui-input.c

Input functions (input bar)

gui-key.c

Keyboard functions

gui-layout.c

Layout

gui-line.c

Lines in buffers

gui-mouse.c

Mouse

gui-nicklist.c

Nicklist in buffers

gui-window.c

Windows

curses/

Curses interface

gui-curses-bar-window.c

Display in bar windows

gui-curses-chat.c

Display in chat area (messages)

gui-curses-color.c

Color functions

gui-curses-key.c

Keyboard functions (default keys, read of input)

gui-curses-main.c

WeeChat main loop (waiting for keyboard/network events)

gui-curses-mouse.c

Mouse

gui-curses-term.c

Functions about terminal

gui-curses-window.c

Windows

main.c

Entry point

2.2.2. Plugins

Path/file Description
plugins/

Root of plugins

plugin.c

Plugins management (load/unload dynamic C libraries)

plugin-api.c

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

plugin-config.c

Plugin configuration options (file plugins.conf)

plugin-script.c

Common functions used by script plugins

plugin-script-api.c

Script API functions: wrappers around some plugin API functions

plugin-script-callback.c

Callback management for scripts

weechat-plugin.h

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

alias/

Alias plugin

alias.c

Main alias functions

alias-config.c

Alias config options (file alias.conf)

alias-info.c

Alias info/infolists/hdata

aspell/

Aspell plugin

weechat-aspell.c

Main aspell functions

weechat-aspell-bar-item.c

Aspell bar items

weechat-aspell-command.c

Aspell commands

weechat-aspell-completion.c

Aspell completions

weechat-aspell-config.c

Aspell config options (file aspell.conf)

weechat-aspell-info.c

Aspell info/infolists/hdata

weechat-aspell-speller.c

Spellers management

charset/

Charset plugin

charset.c

Charset functions

exec/

Exec plugin

exec.c

Main exec functions

exec-buffer.c

Exec buffer

exec-command.c

Exec commands

exec-completion.c

Exec completions

exec-config.c

Exec config options (file exec.conf)

fifo/

Fifo plugin

fifo.c

Main fifo functions

fifo-info.c

Fifo info/infolists/hdata

guile/

Guile (scheme) plugin

weechat-guile.c

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

weechat-guile-api.c

Guile scripting API functions

irc/

IRC (Internet Relay Chat) plugin

irc.c

Main IRC functions

irc-bar-item.c

IRC bar items

irc-buffer.c

IRC buffers

irc-channel.c

IRC channels

irc-color.c

IRC colors

irc-command.c

IRC commands

irc-completion.c

IRC completions

irc-config.c

IRC config options (file irc.conf)

irc-ctcp.c

IRC CTCP

irc-debug.c

IRC debug functions

irc-ignore.c

IRC Ignore

irc-info.c

IRC info/infolists/hdata

irc-input.c

Input of commands/text

irc-message.c

Functions to manipulate IRC messages

irc-mode.c

Functions about channel/nick modes

irc-msgbuffer.c

Target buffer for IRC messages

irc-nick.c

IRC nicks

irc-notify.c

IRC notify lists

irc-protocol.c

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

irc-raw.c

IRC raw buffer

irc-redirect.c

Redirection of IRC command output

irc-sasl.c

SASL authentication with IRC server

irc-server.c

I/O communication with IRC server

irc-upgrade.c

Save/restore of IRC data when upgrading WeeChat

logger/

Logger plugin

logger.c

Main logger functions

logger-buffer.c

Logger buffer list management

logger-config.c

Logger config options (file logger.conf)

logger-info.c

Logger info/infolists/hdata

logger-tail.c

Functions to get last lines of a file

lua/

Lua plugin

weechat-lua.c

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

weechat-lua-api.c

Lua scripting API functions

perl/

Perl plugin

weechat-perl.c

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

weechat-perl-api.c

Perl scripting API functions

python/

Python plugin

weechat-python.c

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

weechat-python-api.c

Python scripting API functions

relay/

Relay plugin (IRC proxy and relay for remote interfaces)

relay.c

Main relay functions

relay-buffer.c

Relay buffer

relay-client.c

Clients of relay

relay-command.c

Relay commands

relay-completion.c

Relay completions

relay-config.c

Relay config options (file relay.conf)

relay-info.c

Relay info/infolists/hdata

relay-network.c

Network functions for relay

relay-raw.c

Relay raw buffer

relay-server.c

Relay server

relay-upgrade.c

Save/restore of relay data when upgrading WeeChat

relay-websocket.c

WebSocket server functions (RFC 6455)

irc/

IRC proxy

relay-irc.c

Main IRC proxy functions

weechat/

Relay for remote interfaces

relay-weechat.c

Relay for remote interfaces (main functions)

relay-weechat-msg.c

Send binary messages to clients

relay-weechat-nicklist.c

Nicklist functions

relay-weechat-protocol.c

Read commands from clients

ruby/

Ruby plugin

weechat-ruby.c

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

weechat-ruby-api.c

Ruby scripting API functions

script/

Scripts manager

script.c

Main functions for scripts manager

script-action.c

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

script-buffer.c

Buffer for scripts manager

script-command.c

Commands for scripts manager

script-completion.c

Completions for scripts manager

script-config.c

Config options for scripts manager (file script.conf)

script-info.c

Script manager info/infolists/hdata

script-repo.c

Download and read repository file

tcl/

Tcl plugin

weechat-tcl.c

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

weechat-tcl-api.c

Tcl scripting API functions

trigger/

Trigger plugin

trigger.c

Main trigger functions

trigger-buffer.c

Trigger buffer

trigger-callback.c

Trigger callbacks

trigger-command.c

Trigger commands

trigger-completion.c

Trigger completions

trigger-config.c

Trigger config options (file trigger.conf)

xfer/

Xfer plugin (IRC DCC file/chat)

xfer.c

Main xfer functions

xfer-buffer.c

Xfer buffer

xfer-chat.c

DCC chat

xfer-command.c

Xfer commands

xfer-completion.c

Xfer completions

xfer-config.c

Xfer config options (file xfer.conf)

xfer-dcc.c

DCC file transfer

xfer-file.c

File functions for xfer

xfer-info.c

Xfer info/infolists/hdata

xfer-network.c

Network functions for xfer

xfer-upgrade.c

Save/restore of xfer data when upgrading WeeChat

2.2.3. Tests

Path/file Description
tests/

Root of tests

tests.cpp

Program used to run tests

unit/

Root of unit tests

core/

Root of unit tests for core

test-eval.cpp

Tests: evaluation of expressions

test-hashtble.cpp

Tests: hashtables

test-hdata.cpp

Tests: hdata

test-infolist.cpp

Tests: infolists

test-list.cpp

Tests: lists

test-string.cpp

Tests: strings

test-url.cpp

Tests: URLs

test-utf8.cpp

Tests: UTF-8

test-util.cpp

Tests: util functions

2.3. Documentation / translations

Documentation files:

Path/file Description
doc/

Documentation

asciidoc.conf

Asciidoc configuration file (some macros)

asciidoc.css

Asciidoc style

docgen.py

Python script to build files in autogen/ directory (see below)

XX/

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

weechat.1.XX.asciidoc

Man page (man weechat)

weechat_quickstart.XX.asciidoc

Quickstart guide

weechat_user.XX.asciidoc

User’s guide

weechat_faq.XX.asciidoc

FAQ

weechat_plugin_api.XX.asciidoc

Plugin API reference

weechat_scripting.XX.asciidoc

Scripting guide

weechat_tester.XX.asciidoc

Tester’s guide

weechat_dev.XX.asciidoc

Developer’s guide (this document)

weechat_relay_protocol.XX.asciidoc

Relay protocol (for remote interfaces)

cmdline_options.XX.asciidoc

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

autogen/

Files auto-built with script docgen.py

user/

Files auto-built for user’s guide (do NEVER update manually!)

plugin_api/

Files auto-built for plugin API (do NEVER update manually!)

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

Path/file Description
po/

Translation files (gettext)

XX.po

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

weechat.pot

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: