mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Compare commits
297 Commits
v0.0.1
...
release-0-1-0
| Author | SHA1 | Date | |
|---|---|---|---|
| dfc1c0370d | |||
| 89d9fb641e | |||
| a55da76244 | |||
| e90e206b35 | |||
| 8ede80b2b6 | |||
| 1af0359046 | |||
| 9c67fdf3ea | |||
| 0c695733b3 | |||
| df4ed3eeba | |||
| 85bd530a88 | |||
| 8921e45815 | |||
| 74b83e5294 | |||
| 4fa9edeb56 | |||
| 4d3e76eb3e | |||
| c48ee3cd73 | |||
| 9a7b7af41c | |||
| 7debba0eca | |||
| a0255a0a3a | |||
| 159fa3d806 | |||
| 07686bf69b | |||
| f877e8be51 | |||
| 757d00ab48 | |||
| ecb6ed6707 | |||
| 9d0b6fad72 | |||
| 63d6ee1007 | |||
| 6a1230de54 | |||
| 684f43298e | |||
| 26af7b49fd | |||
| 1ee8e1edb2 | |||
| a5bbd513b7 | |||
| 88930e50dd | |||
| 555999534e | |||
| 64601fc662 | |||
| d8360af103 | |||
| 55c042d604 | |||
| 6d3c24361d | |||
| 2f5c9a8fd4 | |||
| 96fc2c9aec | |||
| aca19813ad | |||
| 7dbaec1abf | |||
| 3b05b6bafe | |||
| 82265b629b | |||
| a3e3113e4e | |||
| b2c5317e17 | |||
| 9adb547b36 | |||
| 14e833c257 | |||
| de5af8a3b1 | |||
| 37a2f80fae | |||
| 0f95a48854 | |||
| 39b5f07d6f | |||
| f4f2ec3668 | |||
| 486e55be02 | |||
| c35f841b58 | |||
| 209fe89d27 | |||
| fca4840c4a | |||
| 97ef63e2e6 | |||
| 17b409afe8 | |||
| bf4bcd3b8c | |||
| 5233063825 | |||
| 9eeece2ccb | |||
| 9e8f42c141 | |||
| 996343fc1d | |||
| ecafff21ce | |||
| cf9d394e3a | |||
| 0955167b6b | |||
| 2b96cacd51 | |||
| 45f7cdda18 | |||
| dcf0119264 | |||
| c98365803d | |||
| ebcf17c78d | |||
| 022bf4d070 | |||
| d37ec4791c | |||
| e5038b4119 | |||
| 482d327562 | |||
| cb5269404c | |||
| 76c4d4d427 | |||
| 34c6051ffc | |||
| e69afa1401 | |||
| 2a227141c4 | |||
| 7ef14b95b6 | |||
| 4e5f1698ba | |||
| 0a6945b6ed | |||
| 046452b7e0 | |||
| d79dc3233a | |||
| ce7f24ecc1 | |||
| 0f718bf2c0 | |||
| a9e05f57ee | |||
| 24508e733c | |||
| 9f5c71ca98 | |||
| 491dff4238 | |||
| 7b84ab4b71 | |||
| c656661812 | |||
| 6753591f86 | |||
| 4e8ed66a1e | |||
| 0e47caf091 | |||
| 6100af949b | |||
| 4b3d25175f | |||
| b3fd00fc23 | |||
| 1484e17ce1 | |||
| 9759d72d3d | |||
| 92eb995917 | |||
| 1425ee40f4 | |||
| c8eae742b9 | |||
| 441dd2313f | |||
| aea603b6ed | |||
| 9c6f2fcb8c | |||
| 74ee53c102 | |||
| 649fd216ed | |||
| 9278198964 | |||
| 2ff30b15f2 | |||
| c94e1204aa | |||
| 2d438492d7 | |||
| 8959ba9759 | |||
| b9e5c94032 | |||
| 4c660ad565 | |||
| ab393805fb | |||
| dea586e5f1 | |||
| e1afa31563 | |||
| 750a5cbc6d | |||
| 77fab4ae29 | |||
| 622a18fb3f | |||
| 97b34b36fc | |||
| fb21a1c7f9 | |||
| f02ba717a0 | |||
| 9e6938bdf7 | |||
| b9a40bbe21 | |||
| 062e5ea1ae | |||
| 66ff97166f | |||
| 095f296529 | |||
| 340176d635 | |||
| fed6c36d19 | |||
| 3f84a8456a | |||
| fc95f86528 | |||
| d7287a71e5 | |||
| b861403369 | |||
| d8a790e8eb | |||
| 9211a67fb4 | |||
| d0babb2896 | |||
| ad345c0bce | |||
| 3b7b459522 | |||
| a99e6f3d95 | |||
| 35d6c43f85 | |||
| db235b23fa | |||
| a4ed5069c1 | |||
| 0bd38072f2 | |||
| 81da0f41d7 | |||
| 070e1b6ec7 | |||
| 4e86ff9682 | |||
| 867b881bac | |||
| 2c31a11aeb | |||
| 1d2a83b055 | |||
| 915ea408f0 | |||
| c9a469f51b | |||
| 69cb87251e | |||
| 8bcbc3dcae | |||
| dcb3b6fc7e | |||
| 16717f8322 | |||
| dc38b59849 | |||
| 7d91cdcbb3 | |||
| 885fe7434f | |||
| 84677f2835 | |||
| c20a3fdfa4 | |||
| f97a5555ca | |||
| 59bd0b825d | |||
| 38bf163c17 | |||
| 09a36a5d8e | |||
| 10f0236ea9 | |||
| 6d7afb96c1 | |||
| 48941e3646 | |||
| 72cb070ee4 | |||
| 390a097718 | |||
| f4733b970a | |||
| b80086cfac | |||
| 984eaaf826 | |||
| 0dddf86ab7 | |||
| c057937c7b | |||
| 938cc50f5e | |||
| aac1a0a08c | |||
| b77e441dc4 | |||
| f9279df092 | |||
| d84b1fa58f | |||
| 12941227d7 | |||
| 25f79c7bba | |||
| ac3f6dfa7b | |||
| 65704c6fea | |||
| 85c32048cf | |||
| ffbc4c0b0c | |||
| 4e138f3dca | |||
| df66856a28 | |||
| 6950745079 | |||
| 3b6bf81ad6 | |||
| fd3e94070a | |||
| 0708f1a571 | |||
| 3ea696bbc0 | |||
| 57e00428ca | |||
| 555a4191d4 | |||
| a1f09df80f | |||
| c8c5ff3d68 | |||
| e2e384df49 | |||
| 507a5c17c0 | |||
| 4f23a3c621 | |||
| ba618d3276 | |||
| 2f1af3b53e | |||
| 10a170bf7d | |||
| 7a3ee901a4 | |||
| e469f0ef48 | |||
| ba65f5ec30 | |||
| 7779b2f78e | |||
| edcc01bcf0 | |||
| fe4ca01615 | |||
| 62fabde373 | |||
| 8758555b19 | |||
| d4ec2e46aa | |||
| fd9512bbbc | |||
| 176198fdc6 | |||
| 97d5c9bd0e | |||
| 13949e2ace | |||
| 1e1f2ca5b8 | |||
| 8676230eef | |||
| bde34ecd57 | |||
| f245ec3759 | |||
| 5839cc6bfd | |||
| 476054fb4f | |||
| be8b44a2d7 | |||
| 8d33ef0168 | |||
| 2b16f8c0d5 | |||
| 273f4860fe | |||
| 6af18b3dbc | |||
| c488066e33 | |||
| 9746520a24 | |||
| fb7a6efb5a | |||
| dc8368815e | |||
| a81f58f3f1 | |||
| 338e460be9 | |||
| 324077c333 | |||
| 1ba27c760b | |||
| c60a693f42 | |||
| 65c9a79603 | |||
| cafd93dcdd | |||
| 6d6eafa82a | |||
| d2d14ffb8f | |||
| f966b6a829 | |||
| b837017ba6 | |||
| ee3bb0d14f | |||
| 13716a5228 | |||
| ecd92ae24d | |||
| 836d7a139a | |||
| c67cfeaa87 | |||
| d92955a533 | |||
| b12527cf90 | |||
| 509c5738ff | |||
| 7a8edd3cea | |||
| 737b422552 | |||
| 67428a1aaf | |||
| 384b8780b0 | |||
| c6a53ea8ee | |||
| d3fc2646a7 | |||
| 2b305f378f | |||
| 64acebf3b5 | |||
| f0ddea9313 | |||
| 954f1b98bf | |||
| 641e5cd05a | |||
| 6668e362c1 | |||
| 627e0a24eb | |||
| ab6ca9a0b4 | |||
| 7e069ec3e2 | |||
| ddd798a65a | |||
| 4fde90e418 | |||
| 65c146e9c6 | |||
| d6454184e4 | |||
| 53efa7d6af | |||
| 073b1d0bd4 | |||
| 2968e61d97 | |||
| ede76f7b44 | |||
| db5ee98418 | |||
| a148073391 | |||
| 2db87e36b8 | |||
| e0fb9723a7 | |||
| 3782ef828a | |||
| cec899898a | |||
| 106bdb1d4a | |||
| ef4e6b93e0 | |||
| d0bb1e0c2a | |||
| 77e0d01d7a | |||
| b4ff775f03 | |||
| 9f1fd921f7 | |||
| 13c7cb9dd4 | |||
| a5ae266ee4 | |||
| a353a6d228 | |||
| 4ad98ebc52 | |||
| c32bc12d8e | |||
| 70cd53af86 | |||
| ac42b65177 | |||
| c3bb49501c | |||
| 625480e448 | |||
| ab6921ff85 | |||
| a7091f895d |
@@ -1,29 +1,35 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
Developer:
|
||||
---------
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Testers:
|
||||
-------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@tuxisland.org>
|
||||
Web : http://www.tuxisland.org
|
||||
IRC : nick is "xahlexx"
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2003-09-27
|
||||
WeeChat known bugs, 2005-02-12
|
||||
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(irc protocol is under dev!)
|
||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
||||
problem)
|
||||
- alias/unalias commands doesn't work
|
||||
- config is not saved (to ~/.weechat/weechatrc)
|
||||
- intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!)
|
||||
- program is stopped when bad option in config file (it should not, only display
|
||||
warning)
|
||||
- too much opened channel => display bug
|
||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => some nicks are hidden
|
||||
- when quitting WeeChat term title is not restored (if look_set_title is ON)
|
||||
- command name for /server can not contain spaces
|
||||
- wrong alias is not created and not saved when quitting WeeChat
|
||||
- when many WeeChat are launched, log file is not properly written (cleared by
|
||||
each WeeChat at startup)
|
||||
- display problems with old Konsole versions (Kde terminal) (???)
|
||||
|
||||
@@ -1,88 +1,152 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2003-09-27
|
||||
ChangeLog - 2005-02-12
|
||||
|
||||
* 2003-09-27:
|
||||
- WeeChat 0.0.1 released!
|
||||
|
||||
* 2003-09-26:
|
||||
- added completor prefix (in config: look_nick_completor)
|
||||
- fixef log_printf command (bug with year & month)
|
||||
- added "/kill" command
|
||||
- fixed /version and /ctcp commands (missing ":" before message)
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
* added away indicator in status bar
|
||||
* added lag indicator (and auto-disconnect after a delay if important lag)
|
||||
* improved completion: now completes commands arguments (IRC and internal),
|
||||
when only one completion matches, completion mechanism is stoped (to
|
||||
complete command arg for example)
|
||||
* improved /set command: empty strings are allowed, new colors, server
|
||||
options can be changed while WeeChat is running
|
||||
* added default away/part/quit messages in config file
|
||||
* new [irc] section in config file, option "look_display_away" moved to
|
||||
"irc_display_away"
|
||||
* server messages & errors are all prefixed (by 3 chars, like '-@-')
|
||||
* added new options for charset (UTF-8 support): look_charset_decode,
|
||||
look_charset_encode and look_charset_internal
|
||||
* fixed many memory leaks
|
||||
* fixed colors bug: removed "gray" color (replaced by "default"), colors are
|
||||
ok when terminal has white (or light) background
|
||||
* fixed crash when resizing terminal to small size
|
||||
* fixed crash when multiple servers and big messages received from server
|
||||
* fixed crash when closing some private buffers
|
||||
* fixed crash when unknown section with option(s) in config file
|
||||
* fixed /op, /deop, /voice, /devoice (now ok with many nicks)
|
||||
* fixed /me command (now ok without parameter)
|
||||
* fixed /away command (now ok if not away)
|
||||
* logs are now disabled by default (server/channel/private)
|
||||
|
||||
* 2003-09-25:
|
||||
- added "/kick" command
|
||||
- added IRC errors 402 to 407
|
||||
- added "/invite" command
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
* major bug fixed when socket is closed by server (100% CPU usage fixed),
|
||||
and disconnections are now ok (all channels are "closed", history is still
|
||||
visible, and buffer will be used again if reconnection to server)
|
||||
* option "look_remove_colors_from_msgs" is now working
|
||||
* fixed display of nick mode changes
|
||||
* new command "/buffer close" (close any server/channel/private buffer)
|
||||
* /notice command fixed (and display when received from server)
|
||||
* new keys: Ctrl+A (=home), Ctrl+E (=end), Ctrl+W (=Ctrl+Backspace),
|
||||
Alt-S (switch to server buffer), Alt-X (switch to first channel of next
|
||||
server)
|
||||
* added new config option: "server_command_delay" (delay in seconds after
|
||||
startup command for each server)
|
||||
|
||||
* 2003-09-24:
|
||||
- "ctcp version" received is now correctly displayed
|
||||
- "/version" command is ok
|
||||
Version 0.0.8 (2004-10-30):
|
||||
* /kick command fixed: now ok with many words as reason
|
||||
* nickserv passwords hidden (new config option: log_hide_nickserv_pwd on/off)
|
||||
* auto-rejoin channels when kicked (new config option: server_autorejoin on/off)
|
||||
* added IRC::command function for Perl scripts
|
||||
* fixed bug when adding alias with same name as other
|
||||
* /buffer command developed (buffers list, move and notify)
|
||||
* logging buffers to disk (server/channel/private according to user prefs)
|
||||
* Away now announced in channels, and config option "look_display_away" added
|
||||
to enable/disable this feature
|
||||
* Fixed crash when resizing terminal to very small size
|
||||
* "-MORE-" message is now erased when switching to another buffer
|
||||
* DCC file receive ok (Alt-D for DCC view)
|
||||
* /query command now reopens private buffer if already opened
|
||||
* added key for redrawing terminal (Ctrl-L)
|
||||
* added key for clearing hotlist (Alt-R)
|
||||
|
||||
* 2003-09-23:
|
||||
- log file (~/.weechat/weechat.log)
|
||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
||||
Version 0.0.7 (2004-08-08):
|
||||
* new "col_status_delimiters" config option
|
||||
* /buffer command added, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
* /window command added, split terminal horizontally/vertically
|
||||
* unique color for each nick (based on nickname)
|
||||
* action messages are now considered as messages, not crappy joins/parts
|
||||
* fixed display bug when nicklist is displayed at bottom of screen
|
||||
* added history limit (text buffer & commands)
|
||||
* replaced --enable-debug with --with-debug option for ./configure, which is
|
||||
now integer: 1 = compiler debug flag, 2 = same 1 with verbose debug messages
|
||||
in WeeChat (default: 0 = no debug)
|
||||
|
||||
* 2003-09-21:
|
||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
||||
unread messages (from other users), lightmagenta for windows with other
|
||||
unread data (join, part, quit, away, ...)
|
||||
- "320" IRC message management
|
||||
- "/clear" command
|
||||
Version 0.0.6 (2004-06-05):
|
||||
* improved channel highlight (priority to message vs join/part)
|
||||
* fixed bug when opened private win and remote user changes his nick
|
||||
* /query command added (starts private conversation)
|
||||
* IRC messages 476, 477 added
|
||||
* /mode command is now ok and channel flags are displayed in status bar
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* CTCP Version reply is now in english only and doesn't show host (security reason)
|
||||
|
||||
* 2003-09-19:
|
||||
- préparation des sources pour l'internationalisation avec gettext
|
||||
- "301" IRC command (away message)
|
||||
- functions renamed in rc-commands.c, irc-server.c,
|
||||
command.c and config.c (all functions are beginning with a prefix:
|
||||
irc_cmd_recv_xxx, irc_cmd_send_xxx, server_xxx, weechat_cmd_xxx and
|
||||
config_xxx). Moreover, all commands (sent and received) return a value
|
||||
(success or not)
|
||||
- "/quote" command
|
||||
- "/whois" command (and colored display of /whois result in server window)
|
||||
Version 0.0.5 (2004-02-07):
|
||||
* /set command to modify config options when WeeChat is running
|
||||
* fixed look_nicklist config option, now enables/disables nicklist
|
||||
* secured code to prevent buffer overflows and memory leaks
|
||||
* fixed QUIT IRC command: now sent to all connected servers (not only current)
|
||||
* URL command line parameter to connect to server(s)
|
||||
* new Perl script function to display message in info bar ("IRC::print_infobar")
|
||||
* info bar highlight notifications
|
||||
* info bar timestamp is added to config ("look_infobar_timestamp")
|
||||
* added info bar (optional, "look_infobar" to enable it, "on" by default)
|
||||
* fixed crash with /oper command
|
||||
* for default config file, nick is now based on un*x username (thanks to Witukind)
|
||||
* fixed crash when config file cannot be written
|
||||
* -c (or --config) command line parameter added to see config file options
|
||||
* highlight action messages
|
||||
|
||||
* 2003-09-18:
|
||||
- use of alternate nickname (and 2nd alternate) if nick is already used
|
||||
on server (changed/added in config file: options "nick1", "nick2", "nick3"
|
||||
for a server, all are mandatory)
|
||||
- "433" IRC error management (nickname already in use)
|
||||
- "mode" command received correctly for "channel flags" and
|
||||
op/deop/voice/devoice actions for a nick
|
||||
- "401" IRC error management (no such nick/channel)
|
||||
- private windows management (when received and opened, with /privmsg),
|
||||
"/privmsg" completed consequently
|
||||
Version 0.0.4 (2004-01-01):
|
||||
* Perl plugin, with auto-load
|
||||
* when private window is created (another user is talking), WeeChat does not
|
||||
switch to this window
|
||||
* highlight when our nick is written in a channel/private window
|
||||
* ctrl-C now intercepted (ignored)
|
||||
* debug messages can be enabled via ./configure --enbale-debug option
|
||||
|
||||
* 2003-09-17:
|
||||
- nickmode display ((half)op/voice) before nicks (as option, look at config
|
||||
options beginning with "look_nickmode")
|
||||
- windows history is now ok (pgup/pgdn on any window type)
|
||||
- "/me" command (and OK when received)
|
||||
- display nicks count when joining channel or with "/names" command
|
||||
(total, ops, halfops, voices et normaux)
|
||||
Version 0.0.3 (2003-11-03):
|
||||
* ./configure script to build WeeChat
|
||||
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||
* fixed problem with '353' IRC message (nicklist)
|
||||
* fixed problem when nick is truncated by server
|
||||
* fixed crash when entering text without any server connection
|
||||
* fixed crash when /set command is executed
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* french translation
|
||||
* new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time,
|
||||
/trace, /admin, /info, /servlist, /squery, /who, /whowas, /die, /summon,
|
||||
/users, /wallops, /userhost, /ison, /ctcp ping
|
||||
* code cleanup
|
||||
|
||||
* 2003-09-16:
|
||||
- added and normalized chat window colors
|
||||
(new colors in config file)
|
||||
- "/topic" command
|
||||
- nicklist can be moved on top, bottom, left or right of window
|
||||
Version 0.0.2 (2003-10-05):
|
||||
* added commands /rehash and /restart
|
||||
* command & auto-join channels when connected to server
|
||||
* new commands for alias: /alias, /unalias (new section in config file)
|
||||
* config is now saved automatically when quitting WeeChat, /save command added
|
||||
* new commands for servers: /server, /connect, /disconnect
|
||||
* added autoconnect flag for each server in config file
|
||||
* added "look_set_title" option in config file
|
||||
* term window title is modified with WeeChat name and version
|
||||
* fixed nicklist display bug
|
||||
* fixed crash when sending command which can only be received
|
||||
* CTCP version returns more info (about OS)
|
||||
|
||||
* 2003-09-15:
|
||||
- auto-resize of nicklist, according to nick max length
|
||||
- IRC multi-servers is OK
|
||||
|
||||
* 2003-09-14:
|
||||
- no hangup if "/part" command is executed on server window
|
||||
- continue if no server is declared in config file
|
||||
(empty window will be opened for executing WeeChat commands)
|
||||
- string array for strings in config file
|
||||
example: cfg_look_nicklist_position can take values "left", "right",
|
||||
"top", "bottom", which are converted to int (from 0 for "left" to 3 for
|
||||
"bottom")
|
||||
- messages are aligned under time (server window) or under time + nick
|
||||
(channel window)
|
||||
|
||||
* 2003-09-13:
|
||||
- sources exploded in many directories: ./irc, ./gui/curses, ./gui/gtk,
|
||||
./gui/qt and ./gui/text
|
||||
Version 0.0.1 (2003-09-27):
|
||||
* ncurses GUI with color output
|
||||
* multi-servers
|
||||
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||
* private windows
|
||||
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||
quote, topic, version, voice, whois
|
||||
* WeeChat commands: clear, help, set (partial)
|
||||
* many config options
|
||||
* log file (~/.weechat/weechat.log)
|
||||
* nicklist can be moved on top, bottom, left or right of window
|
||||
|
||||
@@ -1,6 +1,169 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
WeeChat FAQ, 2003-09-19
|
||||
Intended audience:
|
||||
All WeeChat users.
|
||||
|
||||
<<< TO DO ! >>>
|
||||
Before reading the following:
|
||||
the following Q/A list is *not* exhaustive.
|
||||
It is also possible that you won't find any Q/A that matches your problem.
|
||||
Please read them anyway, they may provide you help in fixing your problem
|
||||
anyway.
|
||||
And even if your problem is listed below, it is possible that the answers don't
|
||||
help you anymore to solve it. Then, please contact us, we will try to help you
|
||||
finding a solution.
|
||||
|
||||
1 - Compiling
|
||||
2 - Using WeeChat
|
||||
3 - Development
|
||||
|
||||
1.1
|
||||
================================================================================
|
||||
Q: I heard about many GUI for WeeChat. How can I compile/use them?
|
||||
|
||||
A: Curses GUI is built by default.
|
||||
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
|
||||
--enable-gtk to enable Gtk GUI
|
||||
--enable-qt to enable Qt QUI
|
||||
Type ./configure --help to see available options.
|
||||
WARNING: only Curses GUI is ok today. Other GUI are under development!
|
||||
|
||||
|
||||
1.2
|
||||
================================================================================
|
||||
Q: I can't compile WeeChat CVS.
|
||||
|
||||
A: Check that you have latest version of autoconf and automake.
|
||||
WeeChat has been developed with autoconf version 2.56 and automake
|
||||
version 1.7.
|
||||
You should have at least these versions in order to compile WeeChat CVS.
|
||||
If you can't or don't want to install these versions, you can download and
|
||||
install "devel package", a package built almost every day, based on CVS.
|
||||
Note that this package may not correspond exactly to CVS base.
|
||||
|
||||
|
||||
2.1
|
||||
================================================================================
|
||||
Q: Why using WeeChat ? X-Chat and Irssi are so good...
|
||||
|
||||
A: Because WeeChat is very light and has new features.
|
||||
Some new features:
|
||||
* many GUI (Curses, Gtk, Qt),
|
||||
* extensible with scripts (Perl, Python, Ruby),
|
||||
* developed from scratch (not based on any other IRC client)
|
||||
* multi-platform
|
||||
* 100% GPL and free
|
||||
This is the "geekest" IRC client ;)
|
||||
|
||||
|
||||
2.2
|
||||
================================================================================
|
||||
Q: I've launched WeeChat, but I'm lost, what can I do?
|
||||
|
||||
A: For help you can type /help. For help about a command, type /help command.
|
||||
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
|
||||
A: Today you can't do that. This is planed for a future version.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
A: You can use /perl command to load scripts
|
||||
(default path is ~/.weechat/perl).
|
||||
Note that scripts in ~/.weechat/perl/autoload are automatically loaded
|
||||
when WeeChat is starting up.
|
||||
WeeChat perl scripts are compatible with X-Chat, but not with Irssi,
|
||||
sorry ;)
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
|
||||
A: Today Python interface is not developed, so you can't load any Python script.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: How can I load Ruby scripts?
|
||||
|
||||
A: Today Ruby interface is not developed, so you can't load any Ruby script.
|
||||
|
||||
|
||||
3.1
|
||||
================================================================================
|
||||
Q: How should I report bugs?
|
||||
|
||||
A: There is 3 ways to report bugs:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can submit your bug at this url:
|
||||
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
|
||||
3. you can mail your problem, look at support page for developer's mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.2
|
||||
================================================================================
|
||||
Q: How should I submit patches?
|
||||
|
||||
A: There is 3 ways to submit patches:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can submit your patch at this url:
|
||||
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
|
||||
3. you can mail your patch, look at support page for developer's mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.3
|
||||
================================================================================
|
||||
Q: How should I submit new feature request?
|
||||
|
||||
A: There is 2 ways to submit your feature request:
|
||||
1. you can join us on IRC: irc.freenode.net, channel #weechat
|
||||
2. you can mail your feature request, look at support page for developer's
|
||||
mails:
|
||||
http://weechat.flashtux.org/support.php
|
||||
(you can subscribe and send to "support" mailing list)
|
||||
|
||||
|
||||
3.4
|
||||
================================================================================
|
||||
Q: Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
|
||||
|
||||
A: Yes. Future versions will be available for these OS.
|
||||
|
||||
|
||||
3.5
|
||||
================================================================================
|
||||
Q: I want to help WeeChat developers. What can I do?
|
||||
|
||||
A: There's many tasks to do (code, documentation, ...)
|
||||
Please contact us with IRC or mail, look at support page:
|
||||
http://weechat.flashtux.org/support.php
|
||||
|
||||
|
||||
3.6
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: Beer is welcome :)
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
Tous les utilisateurs de WeeChat.
|
||||
|
||||
Avant de lire la suite ceci :
|
||||
la liste suivante de questions/réponses n'est *pas* exhaustive.
|
||||
Il est donc possible que vous ne trouviez pas de question/réponse correspondant
|
||||
à votre problème.
|
||||
Lisez les quand même SVP, elles peuvent vous aider à corriger votre problème.
|
||||
Et même si votre problème est mentionné ci-dessous, il est possible que la
|
||||
réponse ne vous aide pas à corriger le problème. Dans ce cas, contactez-nous,
|
||||
nous essaierons de vous aider Ă trouver une solution.
|
||||
|
||||
1 - Compilation
|
||||
2 - Utilisation de WeeChat
|
||||
3 - Développement
|
||||
|
||||
1.1
|
||||
================================================================================
|
||||
Q: J'ai entendu parler de plusieurs interfaces pour WeeChat.
|
||||
Comment puis-je les compiler/utiliser ?
|
||||
|
||||
R: L'interface Curses est construite par défaut.
|
||||
Pour construire l'interface Gtk ou Qt, vous devez spécifier des options
|
||||
pour le script ./configure :
|
||||
--enable-gtk pour activer l'interface Gtk
|
||||
--enable-qt pour activer l'interface Qt
|
||||
Tapez ./configure --help pour voir les options disponibles.
|
||||
ATTENTION : seule l'interface Curses est ok aujourd'hui.
|
||||
Les autres interfaces sont en développement.
|
||||
|
||||
|
||||
1.2
|
||||
================================================================================
|
||||
Q: Je ne peux pas compiler le CVS WeeChat.
|
||||
|
||||
R: Vérifiez que vous avez bien la dernière version d'autoconf et automake.
|
||||
WeeChat a été développé avec autoconf version 2.56 et automake
|
||||
version 1.7.
|
||||
Vous devez avoir au moins ces versions pour compiler le CVS WeeChat.
|
||||
Si vous n'avez pas ou ne souhaitez pas installer ces versions, vous
|
||||
pouvez télécharger et installer le paquet "devel", un paquet construit
|
||||
quasiment tous les jours, basé sur le CVS.
|
||||
Notez que ce paquet peut ne pas correspondre exactement Ă la base CVS.
|
||||
|
||||
|
||||
2.1
|
||||
================================================================================
|
||||
Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
|
||||
|
||||
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
|
||||
Quelques nouvelles fonctionnalités :
|
||||
* plusieurs interfaces (Curses, Gtk, Qt),
|
||||
* extensible par des scripts (Perl, Python, Ruby),
|
||||
* développé à partir de zéro (non basé sur un quelconque client IRC)
|
||||
* multi-platformes
|
||||
* 100% GPL et libre
|
||||
C'est le client IRC le plus "geek" ;)
|
||||
|
||||
|
||||
2.2
|
||||
================================================================================
|
||||
Q: J'ai lancé WeeChat, mais je suis perdu, que puis-je faire ?
|
||||
|
||||
R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
tapez /help commande.
|
||||
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: Comment puis-je configurer les raccourcis clavier ?
|
||||
|
||||
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
|
||||
version future.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Perl ?
|
||||
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
|
||||
|
||||
R: La commande /perl permet de charger les scripts Perl
|
||||
(le chemin par défaut est ~/.weechat/perl).
|
||||
Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement
|
||||
chargés par WeeChat lorsqu'il démarre.
|
||||
Les scripts Perl WeeChat sont compatibles avec X-Chat, mais pas Irssi,
|
||||
désolé ;)
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: Comment puis-je charger les scripts Python ?
|
||||
|
||||
R: Aujourd'hui l'interface Python n'est pas déceloppée.
|
||||
Vous ne pouvez donc charger aucun script Python.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Ruby ?
|
||||
|
||||
R: Aujourd'hui l'interface Ruby n'est pas développée.
|
||||
Vous ne pouvez donc charger aucun script Ruby.
|
||||
|
||||
|
||||
3.1
|
||||
================================================================================
|
||||
Q: Comment dois-je reporter les bugs ?
|
||||
|
||||
R: Il y a 3 manières de reporter les bugs :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
|
||||
2. vous pouvez soumettre votre bug Ă cette adresse :
|
||||
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
|
||||
3. vous pouvez envoyer votre problem par mail, consultez la page
|
||||
support pour les mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.2
|
||||
================================================================================
|
||||
Q: Comment dois-je soumettre les patches ?
|
||||
|
||||
R: Il y a 3 manières de soumettre les patches :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
|
||||
2. vous pouvez soumettre votre patch Ă cette adresse :
|
||||
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
|
||||
3. vous pouvez envoyer votre patch par mail, consultez la page
|
||||
support pour les mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.3
|
||||
================================================================================
|
||||
Q: Comment dois-je soumettre les demandes de nouvelles fonctionnalités ?
|
||||
|
||||
R: Il y a 2 manières :
|
||||
1. vous pouvez nous joindre sur IRC: irc.freenode.net, channel #weechat
|
||||
2. vous pouvez envoyer un mail, consultez la page support pour les
|
||||
mails des développeurs :
|
||||
http://weechat.flashtux.org/support.php
|
||||
(vous pouvez souscrire et envoyer Ă la liste de diffusion
|
||||
"support")
|
||||
|
||||
|
||||
3.4
|
||||
================================================================================
|
||||
Q: WeeChat sera-t-il porté sur *BSD, QNX, MacOS X, Microsoft Windows ?
|
||||
|
||||
R: Oui. Les futures versions seront disponibles pour ces OS.
|
||||
|
||||
|
||||
3.5
|
||||
================================================================================
|
||||
Q: Je souhaiterai aider les développeurs WeeChat. Que puis-je faire ?
|
||||
|
||||
R: Il y a plusieurs choses Ă faire (code, documentation, ...)
|
||||
Merci de prendre contact avec nous par IRC ou mail, consultez la page
|
||||
support :
|
||||
http://weechat.flashtux.org/support.php
|
||||
|
||||
|
||||
3.6
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: La bière est la bienvenue :)
|
||||
@@ -1,10 +1,17 @@
|
||||
WeeChat - Installation instructions
|
||||
===================================
|
||||
|
||||
1) Run 'make'
|
||||
1) Run './configure'
|
||||
options: --enable-perl : enable Perl scripts
|
||||
--disable-curses : do not build Curses interface
|
||||
--enable-gtk : build Gtk+ interface (under development!)
|
||||
--enable-qt : build Qt interface (not developed!)
|
||||
--with-debug=X : X=1 for debug compilation, 2 for debug messages
|
||||
|
||||
2) As root, run 'make install'
|
||||
2) Run 'make'
|
||||
|
||||
3) Enjoy ! :-)
|
||||
3) As root, run 'make install'
|
||||
|
||||
See AUTHORS for any support, feel free to contact us for any problem ;)
|
||||
4) Enjoy ! :-)
|
||||
|
||||
See AUTHORS for support, feel free to contact us for any problem ;)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,23 +15,14 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
SUBDIRS = po intl src
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
EXTRA_DIST = weechat-curses.1 BUGS FAQ FAQ.fr \
|
||||
debian/changelog debian/control \
|
||||
debian/copyright debian/files \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-gtk.dirs \
|
||||
debian/weechat-gtk.install
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_TEXT
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
man_MANS = weechat-curses.1
|
||||
@@ -1,6 +1,42 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
FlashCode, 2003-09-27
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
* FlashCode, 2005-01-01
|
||||
|
||||
WeeChat 0.0.9 released.
|
||||
|
||||
* FlashCode, 2004-10-30
|
||||
|
||||
WeeChat 0.0.8 released.
|
||||
|
||||
* FlashCode, 2004-08-08
|
||||
|
||||
WeeChat 0.0.7 released.
|
||||
|
||||
* FlashCode, 2004-06-05
|
||||
|
||||
WeeChat 0.0.6 released.
|
||||
|
||||
* FlashCode, 2004-02-07
|
||||
|
||||
WeeChat 0.0.5 released.
|
||||
|
||||
* FlashCode, 2004-01-01
|
||||
|
||||
WeeChat 0.0.4 released.
|
||||
|
||||
* FlashCode, 2003-11-03
|
||||
|
||||
WeeChat 0.0.3 released.
|
||||
|
||||
* FlashCode, 2003-10-05
|
||||
|
||||
WeeChat 0.0.2 released.
|
||||
|
||||
* FlashCode, 2003-09-27
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
|
||||
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
|
||||
Features
|
||||
--------
|
||||
* IRC chat client with multi-server connection
|
||||
* many GUI (curses, text, Gtk, QT) (1)
|
||||
* many GUI (curses, Gtk, Qt) (1)
|
||||
* small, fast and very light
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* compliant with RFC 1459,2810,2811,2812,2813
|
||||
* developed from scratch (not based on any other IRC client, except for look ;)
|
||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||
* 100% GPL & free
|
||||
|
||||
@@ -21,10 +22,7 @@ Features
|
||||
Copyright
|
||||
---------
|
||||
|
||||
WeeChat (c) Copyright 2003
|
||||
by: FlashCode <flashcode@flashtux.org>
|
||||
Xahlexx <xahlex@tuxisland.org>
|
||||
Bounga <bounga@altern.org>
|
||||
WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
(see AUTHORS file if you want to contact authors)
|
||||
|
||||
WeeChat is distributed under GPL licence (see COPYING file for complete license):
|
||||
@@ -45,6 +43,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
---
|
||||
(1) only curses & text interfaces are available today
|
||||
(2) plugin interfaces are not yet developed
|
||||
(1) only Curses interface is available today
|
||||
(2) only Perl interface is available today
|
||||
(3) only GNU/Linux version is available today
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2003-09-27
|
||||
TODO - 2005-02-12
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,121 +10,67 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.1:
|
||||
v0.1.1:
|
||||
------
|
||||
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
# "/quote" command: send a raw string to the server without parsing it
|
||||
# "/me" command (for user actions description)
|
||||
# "/away" command (to toggle the away status)
|
||||
# "/op", "/deop", "/voice", "/devoice" commands
|
||||
# "/invite" command
|
||||
# "/kick", "/ban", "/unban" commands
|
||||
# "/kill" command
|
||||
# "/list" command: list of channels
|
||||
# "/names" command: view who is on a given channel without being
|
||||
on it (for example /names #weechat gives all the nicks present on
|
||||
#weechat, except those who have the +i flag (server side))
|
||||
# "/oper" command: become operator on the irc network
|
||||
# "/topic" command: change the topic of a channel
|
||||
# "/version" command: give the irc client version (CTCP VERSION)
|
||||
of a given nick/channel (without parameter: gives WeeChat version)
|
||||
# "/whois" command
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
- customizable CTCP version reply
|
||||
|
||||
* WeeChat commands:
|
||||
# "/clear": to clear window content
|
||||
|
||||
* Interface:
|
||||
# "demi-highlight" when joins/quits etc
|
||||
# log messages/warning/errors to ~/.weechat/log file
|
||||
# improve editing zone (left arrow <> backspace)
|
||||
# sort nick list
|
||||
# choose nick list position (top, left, right (default), bottom)
|
||||
# auto-resize nicklist (when nick too long)
|
||||
# do pretty cutting of long lines (align on the nick or after hour for server)
|
||||
# keep history of commands and call them again with up/down arrow
|
||||
# text GUI
|
||||
# ncurses GUI:
|
||||
# one window for each channel
|
||||
# color display
|
||||
# private windows
|
||||
# redraw window when term size is modified
|
||||
# chat history (pgup/pgdn for displaying history)
|
||||
# switch to other channel window
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
# IPv4 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
# write default config file
|
||||
- connect to server with child process (background)
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* IRC protocol:
|
||||
- implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- manage "halfop" status
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||
When we come back from our away it should print it to the current window
|
||||
- "/rehash" command: tell the server to reload its config file
|
||||
- "/restart" command: tell the server to restart itself
|
||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||
nick/host connect to the given irc network
|
||||
- "/wallops" command: write the same string to all the
|
||||
persons with the flag +w enable
|
||||
|
||||
* WeeChat commands:
|
||||
- "/reload" command: reload the WeeChat's config file
|
||||
- "/highlight" command: highlight a given word when it appears on
|
||||
channels/privates
|
||||
- "/completion" command: do shortcuts (for example when we type "u"
|
||||
in the text bar it send it to the server as "you")
|
||||
- "/exec" command: execute a command as if we was in shell
|
||||
and show us the output on the current window. An option to exec
|
||||
like -o could send the output to the server, on the current
|
||||
channel/private
|
||||
- "/reload" command: reload the WeeChat's config file
|
||||
- "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colours, time
|
||||
format, etc)
|
||||
- "/highlight" command: highlight a given word when it appears on
|
||||
channels/privates
|
||||
- "/last": command to look for text in previous messages
|
||||
|
||||
* Interface:
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret ^B in messages (this means bold text)
|
||||
- internationalization (traduce WeeChat in many languages)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- log chats to file
|
||||
- forget some old lines that were displayed long time ago (now all is saved,
|
||||
if WeeChat is running for long time, a lot of memory is used!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- add clock (in status bar?)
|
||||
- Gtk GUI
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
- add missing options for config file
|
||||
- write config file
|
||||
- add an option for each server in order to run commands on join
|
||||
(example: /msg nickserv identify password)
|
||||
- channel list for auto-join (for each server)
|
||||
- do not stop program if problem with options in config file
|
||||
- load config file after GUI (so init values by default (colors, ...) before
|
||||
loading config)
|
||||
|
||||
* Plugins:
|
||||
- add Perl plugin
|
||||
- add Python plugin
|
||||
- add Ruby plugin
|
||||
- "/load" and "/unload" commands to (un)load extension scripts
|
||||
(perl, python, ruby, ...)
|
||||
- Python plugin
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
rm -f config.cache
|
||||
|
||||
### GETTEXT ###
|
||||
|
||||
echo searching for GNU gettext intl directory...
|
||||
|
||||
dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share"
|
||||
found=0
|
||||
for try in $dirs; do
|
||||
echo -n " -> $try/gettext/intl... "
|
||||
if test -d $try/gettext/intl; then
|
||||
echo found it
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
echo no
|
||||
done
|
||||
if test "$found" != 1; then
|
||||
echo ERROR: Cannot find gettext/intl directory.
|
||||
echo ERROR: Install GNU gettext in /usr or /usr/local prefix.
|
||||
exit 7
|
||||
fi;
|
||||
|
||||
echo copying gettext intl files...
|
||||
intldir="$try/gettext/intl"
|
||||
if test ! -d intl; then
|
||||
mkdir intl
|
||||
fi
|
||||
olddir=`pwd`
|
||||
cd $intldir
|
||||
for file in *; do
|
||||
if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
|
||||
rm -f $olddir/intl/$file
|
||||
cp $intldir/$file $olddir/intl/
|
||||
fi
|
||||
done
|
||||
cp -f $try/gettext/po/Makefile.in.in $olddir/po/
|
||||
cd $olddir
|
||||
if test -f intl/plural.c; then
|
||||
sleep 2
|
||||
touch intl/plural.c
|
||||
fi
|
||||
|
||||
### END GETTEXT ###
|
||||
|
||||
echo "running aclocal..."
|
||||
aclocal -I /usr/share/aclocal
|
||||
echo "running autoconf..."
|
||||
autoconf
|
||||
echo "running autoheader..."
|
||||
autoheader
|
||||
echo "running automake..."
|
||||
automake -a
|
||||
echo "autogen.sh ok, now run ./configure script"
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.0, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.0])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
enable_plugins="no"
|
||||
enable_python="no"
|
||||
PYTHON_CFLAGS=
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([ncurses library not found! Install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||
#fi
|
||||
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
fi
|
||||
|
||||
PLUGINS_LIBS=
|
||||
|
||||
if test "x$enable_perl" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `perl -MExtUtils::Embed -e ldopts`"
|
||||
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_DEFINE(PLUGIN_PERL)
|
||||
fi
|
||||
|
||||
if test "x$enable_plugins" = "xyes" ; then
|
||||
AC_DEFINE(PLUGINS)
|
||||
fi
|
||||
|
||||
AC_SUBST(PLUGINS_LIBS)
|
||||
|
||||
CFLAGS=`echo $CFLAGS | sed s/-g//g`
|
||||
if test "x$CFLAGS" = "x" ; then
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
CFLAGS="-Wall -W $CFLAGS -pipe -g"
|
||||
else
|
||||
CFLAGS="-Wall -W $CFLAGS -pipe"
|
||||
fi
|
||||
|
||||
if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/gtk/Makefile
|
||||
src/gui/qt/Makefile
|
||||
intl/Makefile
|
||||
po/Makefile.in])
|
||||
|
||||
echo
|
||||
echo $PACKAGE $VERSION
|
||||
|
||||
listgui=
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
listgui="$listgui ncurses"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
fi
|
||||
if test "x$enable_qt" = "xyes" ; then
|
||||
listgui="$listgui Qt"
|
||||
fi
|
||||
|
||||
if test "x$listgui" = "x" ; then
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least ncurses, Gtk or Qt.])
|
||||
fi
|
||||
|
||||
msg_debug_compiler="no"
|
||||
msg_debug_verbose="no"
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
msg_debug_compiler="yes"
|
||||
fi
|
||||
if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Interfaces.................... :$listgui
|
||||
echo
|
||||
echo Build with Plugin support..... : $enable_plugins
|
||||
echo Build with Perl support....... : $enable_perl
|
||||
echo Build with Python support..... : $enable_python
|
||||
echo Build with Ruby support....... : $enable_ruby
|
||||
echo
|
||||
echo Compile with debug info....... : $msg_debug_compiler
|
||||
echo Print debugging messages...... : $msg_debug_verbose
|
||||
echo
|
||||
eval eval echo WeeChat will be installed in $bindir.
|
||||
echo
|
||||
echo configure complete, now type \'make\' to build WeeChat
|
||||
echo
|
||||
Vendored
+55
-1
@@ -1,5 +1,59 @@
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 12 Feb 2005 12:00:00 +0200
|
||||
|
||||
weechat (0.0.9-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.9, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 01 Jan 2005 13:00:00 +0200
|
||||
|
||||
weechat (0.0.8-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.8, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 30 Oct 2004 11:40:00 +0200
|
||||
|
||||
weechat (0.0.7-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.7, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 08 Aug 2004 21:00:00 +0200
|
||||
|
||||
weechat (0.0.6-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.6, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 05 Jun 2004 11:30:00 +0200
|
||||
|
||||
weechat (0.0.5-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.5, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 07 Feb 2004 20:30:00 +0200
|
||||
|
||||
weechat (0.0.4-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.4, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Thu, 01 Jan 2004 13:00:00 +0200
|
||||
|
||||
weechat (0.0.3-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.3, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Mon, 03 Nov 2003 23:15:00 +0200
|
||||
|
||||
weechat (0.0.2-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.2, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sun, 05 Oct 2003 12:00:00 +0200
|
||||
|
||||
weechat (0.0.1-1) unstable; urgency=low
|
||||
|
||||
* First version.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Jun 2003 12:00:00 +0200
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Sep 2003 12:00:00 +0200
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
4
|
||||
Vendored
+21
-5
@@ -1,14 +1,30 @@
|
||||
Source: weechat
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0)
|
||||
Standards-Version: 3.5.8
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: weechat
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Architecture: all
|
||||
Depends: weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-curses
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
Recommends: weechat-curses | weechat-gtk
|
||||
Description: Common files for WeeChat
|
||||
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
||||
Sat, 12 Jan 2005 12:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
Upstream Author(s): FlashCode <flashcode@flashtux.org>
|
||||
Upstream Author: FlashCode <flashcode@flashtux.org>
|
||||
|
||||
Copyright:
|
||||
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
weechat_0.0.1-1_i386.deb net optional
|
||||
Vendored
+33
-49
@@ -1,15 +1,7 @@
|
||||
#!/usr/bin/make -f
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
@@ -22,8 +14,8 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -31,21 +23,14 @@ build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
|
||||
-$(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -53,45 +38,44 @@ install: build
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/weechat.
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||
dh_install --sourcedir=debian/weechat
|
||||
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||
# install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
dh_testdir -pweechat-common -pweechat
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installexamples -pweechat-common
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
dh_fixperms -pweechat-common -pweechat
|
||||
dh_installdeb -pweechat-common -pweechat
|
||||
dh_shlibdeps -pweechat-common -pweechat
|
||||
dh_gencontrol -pweechat-common -pweechat
|
||||
dh_md5sums -pweechat-common -pweechat
|
||||
dh_builddeb -pweechat-common -pweechat
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
dh_installman weechat.1
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
# dh_perl
|
||||
# dh_python
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
# dh_installchangelogs -a
|
||||
# dh_installdocs -a
|
||||
dh_installman weechat-curses.1 -pweechat-curses
|
||||
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
dh_installdeb -a
|
||||
dh_shlibdeps -a
|
||||
dh_gencontrol -a
|
||||
dh_md5sums -a
|
||||
dh_builddeb -a
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
|
||||
+1
-3
@@ -1,9 +1,7 @@
|
||||
AUTHORS
|
||||
BUGS
|
||||
ChangeLog
|
||||
COPYING
|
||||
FAQ
|
||||
INSTALL
|
||||
FAQ.fr
|
||||
NEWS
|
||||
README
|
||||
TODO
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/share/locale
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-curses
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-gtk
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
shlibs:Depends=libc6 (>= 2.3.2-1), libncurses5 (>= 5.3.20030510-1)
|
||||
@@ -0,0 +1,33 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi
|
||||
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
|
||||
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
|
||||
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
|
||||
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
|
||||
export LANG=en_EN && texi2pdf weechat_doc_en.texi
|
||||
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
|
||||
|
||||
clean:
|
||||
rm -rf weechat_doc_*.aux weechat_doc_*.cp weechat_doc_*.fn \
|
||||
weechat_doc_*.html weechat_doc_*.ky weechat_doc_*.log \
|
||||
weechat_doc_*.pdf weechat_doc_*.pg weechat_doc_*.toc \
|
||||
weechat_doc_*.tp weechat_doc_*.txt weechat_doc_*.vr
|
||||
@@ -0,0 +1,954 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename weechat_doc_en.info
|
||||
@settitle WeeChat - fast, light and extensible IRC client
|
||||
@c %**end of header
|
||||
|
||||
@c WeeChat documentation (english version)
|
||||
@c
|
||||
@c Copyright (c) 2005 by FlashCode <flashcode@flashtux.org>
|
||||
@c
|
||||
@c This manual is free software; you can redistribute it and/or modify
|
||||
@c it under the terms of the GNU General Public License as published by
|
||||
@c the Free Software Foundation; either version 2 of the License, or
|
||||
@c (at your option) any later version.
|
||||
@c
|
||||
@c This manual is distributed in the hope that it will be useful,
|
||||
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@c GNU General Public License for more details.
|
||||
@c
|
||||
@c You should have received a copy of the GNU General Public License
|
||||
@c along with this program; if not, write to the Free Software
|
||||
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@c pdf : texi2pdf weechat_doc_en.texi
|
||||
@c html: makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||
|
||||
@c tex
|
||||
@c \overfullrule=0pt
|
||||
@c end tex
|
||||
|
||||
@documentlanguage en
|
||||
|
||||
@titlepage
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.0 - February, 12 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@page
|
||||
|
||||
This manual documents WeeChat IRC client, it is part of WeeChat.@*
|
||||
@*
|
||||
Latest version of this document can be found on this page:@*
|
||||
@uref{http://weechat.flashtux.org/doc.php?lang=en}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
This document may be used under the terms the GNU General Public License
|
||||
version 2 or higher.
|
||||
|
||||
@end titlepage
|
||||
|
||||
@everyheading @thischapter @| @|
|
||||
@everyfooting @thistitle @| @| Page @thispage
|
||||
|
||||
@contents
|
||||
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@menu
|
||||
* Introduction:: What is WeeChat ?
|
||||
* Installation:: WeeChat installation
|
||||
* Usage:: WeeChat usage
|
||||
* Extensions:: WeeChat extensions
|
||||
* Authors / Support:: Contact authors and get support
|
||||
@end menu
|
||||
|
||||
|
||||
@c ******************************* Introduction *******************************
|
||||
|
||||
@node Introduction, Installation, Top, Top
|
||||
@chapter Introduction
|
||||
|
||||
@menu
|
||||
* Description::
|
||||
* Pre-requisites::
|
||||
@end menu
|
||||
|
||||
@node Description, Pre-requisites, Introduction, Introduction
|
||||
@section Description
|
||||
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a free IRC client, fast and light,
|
||||
designed for many operating systems.@*
|
||||
@*
|
||||
Main features are:
|
||||
@itemize @minus
|
||||
@item
|
||||
multi-servers connection
|
||||
@item
|
||||
many GUI (Graphical User Interface): Curses, Gtk and Qt
|
||||
@item
|
||||
small, fast and light
|
||||
@item
|
||||
customizable and extensible with scripts
|
||||
@item
|
||||
compliant with RFCs 1459, 2810, 2811, 2812, and 2813
|
||||
@item
|
||||
multi-platform (Gnu/Linux, *BSD, Windows and other)
|
||||
@item
|
||||
100% GPL, free software
|
||||
@end itemize
|
||||
|
||||
@*
|
||||
WeeChat homepage is here:@*
|
||||
@uref{http://weechat.flashtux.org}@*
|
||||
|
||||
@node Pre-requisites, , Description, Introduction
|
||||
@section Pre-requisites
|
||||
|
||||
In order to install WeeChat, you @b{need}:@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
A running Gnu/Linux system (with compiler tools for source package)
|
||||
@item
|
||||
"root" privileges (to install WeeChat)
|
||||
@item
|
||||
According to GUI, one of the following libraries:
|
||||
@itemize @minus
|
||||
@item
|
||||
Curses: ncurses library,
|
||||
@item
|
||||
Gtk: *** GUI not developed ***,
|
||||
@item
|
||||
Qt: *** GUI not developed ***,
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
|
||||
@c ******************************* Installation *******************************
|
||||
|
||||
@node Installation, Usage, Introduction, Top
|
||||
@chapter Installation
|
||||
|
||||
@menu
|
||||
* Binary package::
|
||||
* Source package::
|
||||
* CVS sources::
|
||||
@end menu
|
||||
|
||||
@node Binary package, Source package, Installation, Installation
|
||||
@section Binary package
|
||||
|
||||
Binary packages are available for these distributions:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Debian (or any Debian compatible distribution)@*
|
||||
To install: @kbd{dpkg -i /path/weechat_x.y.z-1_i386.deb}
|
||||
@item
|
||||
Mandrake/Redhat (or any RPM compatible distribution)@*
|
||||
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
To install: @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (not available!)
|
||||
@item
|
||||
Slackware (not available!)
|
||||
@item
|
||||
Windows (not available!)
|
||||
@end itemize
|
||||
|
||||
where x.y.z is the version (for example 0.0.1)
|
||||
@*
|
||||
|
||||
@node Source package, CVS sources, Binary package, Installation
|
||||
@section Source package
|
||||
|
||||
All you have to do is to run in a console or a terminal:@*
|
||||
@kbd{./configure}@*
|
||||
@kbd{make}@*
|
||||
Nota: to build only some interfaces, you can give parameters
|
||||
to ./configure, type @kbd{./configure --help} for help about options.@*
|
||||
|
||||
Then get root privileges and install WeeChat:@*
|
||||
@kbd{su}@*
|
||||
(enter root password)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@node CVS sources, , Source package, Installation
|
||||
@section CVS sources
|
||||
|
||||
Warning: CVS sources are for advanced users: it may not compile or not be stable.
|
||||
You're warned!@*
|
||||
|
||||
To get CVS sources, issue these commands:@*
|
||||
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||
(when prompted for a password, just press Enter key)@*
|
||||
|
||||
Execute this script:@*
|
||||
@kbd{./autogen.sh}@*
|
||||
|
||||
Then follow instructions for source package - @xref{Source package}.
|
||||
|
||||
|
||||
@c ********************************** Usage ***********************************
|
||||
|
||||
@node Usage, Extensions, Installation, Top
|
||||
@chapter Usage
|
||||
|
||||
@menu
|
||||
* Run WeeChat::
|
||||
* Config file::
|
||||
* Key bindings::
|
||||
* WeeChat commands::
|
||||
@end menu
|
||||
|
||||
@node Run WeeChat, Config file, Usage, Usage
|
||||
@section Run WeeChat
|
||||
|
||||
@subsection Command line parameters
|
||||
|
||||
@table @code
|
||||
@item -c, --config
|
||||
Display config file help (list of options)@*
|
||||
@item -h, --help
|
||||
Display help screen@*
|
||||
@item -l, --license
|
||||
Display WeeChat license@*
|
||||
@item -v, --version
|
||||
Display WeeChat version@*
|
||||
@end table
|
||||
|
||||
@subsection Run WeeChat
|
||||
|
||||
Just issue this command to run WeeChat:@*
|
||||
@kbd{weechat-curses} (for Curses front-end)@*
|
||||
or @kbd{weechat-gtk} (for Gtk front-end)@*
|
||||
or @kbd{weechat-qt} (for Qt front-end)@*
|
||||
|
||||
When you run WeeChat for the first time, a default configuration file is
|
||||
created, with default options.@*
|
||||
The default configuration file is: ~/.weechat/weechat.rc@*
|
||||
|
||||
You can edit this file at your convenience to configure WeeChat, or you can
|
||||
set parameters with @kbd{/set} command in WeeChat - @xref{WeeChat commands}.
|
||||
|
||||
@node Config file, Key bindings, Run WeeChat, Usage
|
||||
@section Config file
|
||||
|
||||
Here is a list of all options for config file:@*
|
||||
|
||||
@table @kbd
|
||||
@item look_set_title
|
||||
Set title for window (terminal for Curses GUI) with name & version@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_startup_logo
|
||||
Display WeeChat logo at startup@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_startup_version
|
||||
Display WeeChat version at startup@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
WeeChat slogan (if empty, slogan is not used)@*
|
||||
Type: string (any string), default value: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_charset_encode
|
||||
Charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_color_actions
|
||||
Display actions with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_remove_colors_from_msgs
|
||||
Remove colors from incoming messages@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_nicklist
|
||||
Display nicklist window (for channel windows)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_nicklist_position
|
||||
Nicklist position (top, left, right (default), bottom)@*
|
||||
Type: string (values: 'left', 'right', 'top', 'bottom'), default value: 'right'@*
|
||||
@item look_nicklist_min_size
|
||||
Min size for nicklist (width or height, depending on look_nicklist_position (0 = no min size))@*
|
||||
Type: integer (values: between 0 and 100), default value: 0@*
|
||||
@item look_nicklist_max_size
|
||||
Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min == max and > 0, then size is fixed))@*
|
||||
Type: integer (values: between 0 and 100), default value: 0@*
|
||||
@item look_no_nickname
|
||||
Text to display instead of nick when not connected@*
|
||||
Type: string (any string), default value: '-cmd-'@*
|
||||
@item look_nickmode
|
||||
Display nick mode ((half)op/voice) before each nick@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_nickmode_empty
|
||||
Display space if nick mode is not (half)op/voice@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_nick_completor
|
||||
The string inserted after nick completion@*
|
||||
Type: string (any string), default value: ':'@*
|
||||
@item look_infobar
|
||||
Enable info bar@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Timestamp for time in infobar@*
|
||||
Type: string (any string), default value: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
Delay (in seconds) for highlight messages in infobar (0 = disable highlight notifications in infobar)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 7@*
|
||||
@item col_title
|
||||
Color for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_title_bg
|
||||
Background for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'blue'@*
|
||||
@item col_chat
|
||||
Color for chat text@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time
|
||||
Color for time in chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Color for time separator (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'brown'@*
|
||||
@item col_chat_prefix1
|
||||
Color for 1st and 3rd char of prefix@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
|
||||
@item col_chat_prefix2
|
||||
Color for middle char of prefix@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_chat_nick
|
||||
Color for nicks in actions (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
|
||||
@item col_chat_host
|
||||
Color for hostnames (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_chat_channel
|
||||
Color for channel names in actions (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_chat_dark
|
||||
Color for dark separators (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'green'@*
|
||||
@item col_chat_highlight
|
||||
Color for highlighted nick (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_chat_bg
|
||||
Background for chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status
|
||||
Color for status bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Color for status bar delimiters@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_status_data_msg
|
||||
Color for window with new messages (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_status_highlight
|
||||
Color for window with highlight (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Color for window with new data (not messages) (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_more
|
||||
Color for window with new data (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_status_bg
|
||||
Background for status window@*
|
||||
Type: color (Curses or Gtk color), default value: 'blue'@*
|
||||
@item col_infobar
|
||||
Color for info bar text@*
|
||||
Type: color (Curses or Gtk color), default value: 'black'@*
|
||||
@item col_infobar_highlight
|
||||
Color for info bar highlight notification@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_infobar_bg
|
||||
Background for info bar window@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_input
|
||||
Color for input text@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_input_channel
|
||||
Color for input text (channel name)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_input_nick
|
||||
Color for input text (nick name)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_input_bg
|
||||
Background for input window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick
|
||||
Color for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_away
|
||||
Color for away nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Color for operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_nick_halfop
|
||||
Color for half-operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@item col_nick_voice
|
||||
Color for voice symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_nick_sep
|
||||
Color for nick separator@*
|
||||
Type: color (Curses or Gtk color), default value: 'blue'@*
|
||||
@item col_nick_self
|
||||
Color for local nick@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_nick_private
|
||||
Color for other nick in private window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_bg
|
||||
Background for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_dcc_selected
|
||||
Color for selected DCC (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Color for "waiting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_dcc_connecting
|
||||
Color for "connecting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_dcc_active
|
||||
Color for "active" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightblue'@*
|
||||
@item col_dcc_done
|
||||
Color for "done" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_dcc_failed
|
||||
Color for "failed" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightred'@*
|
||||
@item col_dcc_aborted
|
||||
Color for "aborted" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightred'@*
|
||||
@item history_max_lines
|
||||
Maximum number of lines in history for one server/channel/private window (0 = unlimited)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 4096@*
|
||||
@item history_max_commands
|
||||
Maximum number of user commands in history (0 = unlimited)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 100@*
|
||||
@item log_auto_server
|
||||
Automatically log server messages@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_channel
|
||||
Automatically log channel chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_private
|
||||
Automatically log private chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_path
|
||||
Path for WeeChat log files@*
|
||||
Type: string (any string), default value: '~/.weechat/logs/'@*
|
||||
@item log_timestamp
|
||||
Timestamp for log (see man strftime for date/time specifiers)@*
|
||||
Type: string (any string), default value: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Hide password displayed by nickserv@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_display_away
|
||||
Display message to all channels when (un)marking as away@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Default message when away@*
|
||||
Type: string (any string), default value: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Default part message (leaving channel)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Default quit message ('%v' will be replaced by WeeChat version in string)@*
|
||||
Type: string (any string), default value: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Interval between two checks for away (in minutes, 0 = never check)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_check
|
||||
Interval between two checks for lag (in seconds)@*
|
||||
Type: integer (values: between 30 and 2147483647), default value: 60@*
|
||||
@item irc_lag_min_show
|
||||
Minimum lag to show (in seconds)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_disconnect
|
||||
Disconnect after important lag (in minutes, 0 = never disconnect)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Automatically accept incoming dcc files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Automatically accept dcc chats (use carefully!)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item dcc_timeout
|
||||
Timeout for dcc request (in seconds)@*
|
||||
Type: integer (values: between 1 and 2147483647), default value: 300@*
|
||||
@item dcc_blocksize
|
||||
Block size for dcc packets in bytes (default: 1024)@*
|
||||
Type: integer (values: between 1024 and 102400), default value: 1024@*
|
||||
@item dcc_download_path
|
||||
Path for writing incoming files with dcc (default: user home)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_upload_path
|
||||
Path for reading files when sending thru dcc (when no path is specified)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_auto_rename
|
||||
Rename incoming files if already exists (add '.1', '.2', ...)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item dcc_auto_resume
|
||||
Automatically resume dcc transfer if connection with remote host is loosed@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item proxy_use
|
||||
Use a proxy server to connect to irc server@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item proxy_address
|
||||
Proxy server address (IP or hostname)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item proxy_port
|
||||
Port for connecting to proxy server@*
|
||||
Type: integer (values: between 0 and 65535), default value: 1080@*
|
||||
@item proxy_password
|
||||
Password for proxy server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_name
|
||||
Name associated to IRC server (for display only)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_autoconnect
|
||||
Automatically connect to server when WeeChat is starting@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_autoreconnect
|
||||
Automatically reconnect to server when disconnected@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_autoreconnect_delay
|
||||
Delay (in deconds) before trying again to reconnect to server@*
|
||||
Type: integer (values: between 0 and 65535), default value: 30@*
|
||||
@item server_address
|
||||
IP address or hostname of IRC server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_port
|
||||
Port for connecting to server@*
|
||||
Type: integer (values: between 0 and 65535), default value: 6667@*
|
||||
@item server_password
|
||||
Password for IRC server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_nick1
|
||||
Nickname to use on IRC server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_nick2
|
||||
Alternate nickname to use on IRC server (if nickname is already used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_nick3
|
||||
2nd alternate nickname to use on IRC server (if alternate nickname is already used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_username
|
||||
User name to use on IRC server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_realname
|
||||
Real name to use on IRC server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_command
|
||||
First command to run when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_command_delay
|
||||
Delay (in seconds) after command was executed (example: give some time for authentication)@*
|
||||
Type: integer (values: between 0 and 5), default value: 0@*
|
||||
@item server_autojoin
|
||||
Comma separated list of channels to join when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_autorejoin
|
||||
Automatically rejoin channels when kicked@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@itemize @minus
|
||||
@item
|
||||
@kbd{default}: default color (transparent for background)
|
||||
@item
|
||||
@kbd{black}: black
|
||||
@item
|
||||
@kbd{red}: dark red
|
||||
@item
|
||||
@kbd{lightred}: light red
|
||||
@item
|
||||
@kbd{green}: dark green
|
||||
@item
|
||||
@kbd{lightgreen}: light green
|
||||
@item
|
||||
@kbd{brown}: brown
|
||||
@item
|
||||
@kbd{yellow}: yellow
|
||||
@item
|
||||
@kbd{blue}: dark blue
|
||||
@item
|
||||
@kbd{lightblue}: light blue
|
||||
@item
|
||||
@kbd{magenta}: dark magenta
|
||||
@item
|
||||
@kbd{lightmagenta}: light magenta
|
||||
@item
|
||||
@kbd{cyan}: dark cyan
|
||||
@item
|
||||
@kbd{lightcyan}: light cyan
|
||||
@item
|
||||
@kbd{white}: white
|
||||
@end itemize
|
||||
|
||||
@node Key bindings, WeeChat commands, Config file, Usage
|
||||
@section Key bindings
|
||||
|
||||
@table @kbd
|
||||
@item Left arrow / Right arrow
|
||||
Go to previous / next char in command line@*
|
||||
@*
|
||||
@item Ctrl + left arrow / Ctrl + right arrow
|
||||
Go to previous / next word in command line@*
|
||||
@*
|
||||
@item Home / Ctrl + A
|
||||
Go to the beginning of command line@*
|
||||
@*
|
||||
@item End / Ctrl + E
|
||||
Go to the end of command line@*
|
||||
@*
|
||||
@item Backspace / Delete
|
||||
Erase previous / next char of command line@*
|
||||
@*
|
||||
@item Ctrl + Backspace / Ctrl + W
|
||||
Erase previous word of command line@*
|
||||
@*
|
||||
@item Tab
|
||||
Complete command or nick (@kbd{Tab} again: find next completion)@*
|
||||
@*
|
||||
@item Any char
|
||||
Insert char to cursor position in the command line@*
|
||||
@*
|
||||
@item Enter
|
||||
Execute command or send message@*
|
||||
@*
|
||||
@item Up arrow / Down arrow
|
||||
Call again last commands/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Show buffer history@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Switch to previous / next buffer@*
|
||||
@*
|
||||
@item F8
|
||||
Switch to next window@*
|
||||
@*
|
||||
@item F10
|
||||
Remove last infobar message@*
|
||||
@*
|
||||
@item Ctrl + L
|
||||
Redraw whole window@*
|
||||
@*
|
||||
@item Alt + left arrow / Alt + right arrow
|
||||
Same as F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Switch to next buffer with activity (with priority: highlight, message, other)@*
|
||||
@*
|
||||
@item Alt + D
|
||||
Display current DCC@*
|
||||
@*
|
||||
@item Alt + R
|
||||
Clear hotlist (activity notification on other buffers)@*
|
||||
@*
|
||||
@item Alt + S
|
||||
Switch to server buffer@*
|
||||
@*
|
||||
@item Alt + X
|
||||
Switch to first channel of next server (or server buffer if no channel is opened)@*
|
||||
@*
|
||||
@item Alt + digit (1-9)
|
||||
Switch to buffer by number@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node WeeChat commands, , Key bindings, Usage
|
||||
@section WeeChat commands
|
||||
|
||||
NOT WRITTEN!
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
|
||||
@node Extensions, Authors / Support, Usage, Top
|
||||
@chapter Extensions
|
||||
|
||||
@menu
|
||||
* Perl scripts::
|
||||
* Python scripts::
|
||||
* Ruby scripts::
|
||||
@end menu
|
||||
|
||||
@node Perl scripts, Python scripts, Extensions, Extensions
|
||||
@section Perl scripts
|
||||
|
||||
@subsection Load/unload Perl scripts
|
||||
|
||||
Perl scripts are loaded and unloaded with @command{/perl} command.
|
||||
(type @kbd{/help perl} within WeeChat to get help about command).@*
|
||||
|
||||
@emph{Examples:}@*
|
||||
@itemize @bullet
|
||||
@item
|
||||
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
|
||||
@item
|
||||
Unload all Perl scripts: @kbd{/perl unload}@*
|
||||
@item
|
||||
List all Perl scripts: @kbd{/perl}@*
|
||||
@end itemize
|
||||
|
||||
@subsection WeeChat / Perl API
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@command{IRC::register ( name, version, shutdown_function, description );}@*
|
||||
@*
|
||||
This is first function to call in Perl script.@*
|
||||
All Perl scripts for WeeChat should call this function.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{name}: unique name to identify script (each script must have
|
||||
unique name)
|
||||
@item @option{version}: script's version
|
||||
@item @option{shutdown_function}: Perl function called when script is
|
||||
unloaded (optional parameter, empty string means nothing is called at the end)
|
||||
@item @option{description}: short description of script.
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Example:}@*
|
||||
@code{IRC::register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print ( message );}@*
|
||||
@*
|
||||
Print message in current window (channel or server).@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{message}: message to display
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Example:}@*
|
||||
@code{IRC::print ("message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_with_channel ( channel, [server,] message );}@*
|
||||
@*
|
||||
Print message in a channel.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{channel}: name of channel
|
||||
@item @option{server}: internal name of server
|
||||
@item @option{message}: message to display
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Examples:}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_infobar ( delay, message );}@*
|
||||
@*
|
||||
Print message in infobar.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{delay}: after this delay (in seconds), message will be erased
|
||||
(if 0, message will not be erased).
|
||||
@item @option{message}: message to display
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Example:}@*
|
||||
@code{IRC::print_infobar (5, "message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_message_handler ( name, function );}@*
|
||||
@*
|
||||
Attach a Perl function to an IRC message.@*
|
||||
Function will be called each time IRC message will be received.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{name}: name of IRC message@*
|
||||
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
|
||||
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||
@item @option{function}: Perl function called when message is received
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Example:}@*
|
||||
@code{IRC::add_message_handler ("privmsg", my_function);}@*
|
||||
@code{sub my_function}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ IRC::print ("server=$_[0]\n");}@*
|
||||
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@*
|
||||
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||
@code{@ @ @ @ IRC::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_command_handler ( name, function );}@*
|
||||
@*
|
||||
Create new WeeChat command, linked with Perl function.@*
|
||||
Function will be called when user will launch command with @kbd{/name}.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{name}: name of new command@*
|
||||
This name may be existing command, so that the command is overrided by
|
||||
Perl function. Be careful when overriding WeeChat commands, they'll not be
|
||||
available until your Perl script will be unloaded.
|
||||
@item @option{function}: Perl function linked with command
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Example:}@*
|
||||
@code{IRC::add_command_handler ("command", my_command);}@*
|
||||
@code{sub my_command}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ IRC::print("Server: $_[0], arguments: $_[1]\n");}@*
|
||||
@code{@ @ @ @ return 0;}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::get_info ( [server,] name );}@*
|
||||
@*
|
||||
Get various info about WeeChat, server or user.@*
|
||||
|
||||
@emph{Arguments:}
|
||||
@itemize @minus
|
||||
@item @option{server}: internal name of server
|
||||
@item @option{name}: name of info to retrieve:
|
||||
@itemize @minus
|
||||
@item @option{0 or version}: get WeeChat version
|
||||
@item @option{1 or nick}: get nickname
|
||||
@item @option{2 or channel}: get channel name
|
||||
@item @option{3 or server}: get server name
|
||||
@item @option{4 or weechatdir}: get WeeChat home directory
|
||||
@item @option{5 or away}: get away flag for server
|
||||
@end itemize
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Examples:}@*
|
||||
@code{$version = get_info("version");}@*
|
||||
@code{$nick = get_info("freenode", "nick");}@*
|
||||
@*
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Python scripts, Ruby scripts, Perl scripts, Extensions
|
||||
@section Python scripts
|
||||
|
||||
Not developed!
|
||||
|
||||
@node Ruby scripts, , Python scripts, Extensions
|
||||
@section Ruby scripts
|
||||
|
||||
Not developed!
|
||||
|
||||
|
||||
@c **************************** Authors / Support *****************************
|
||||
|
||||
@node Authors / Support, , Extensions, Top
|
||||
@chapter Authors / Support
|
||||
|
||||
@ifhtml
|
||||
@menu
|
||||
* Authors::
|
||||
* Get support::
|
||||
* Copyright::
|
||||
@end menu
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Authors::
|
||||
* Get support::
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@node Authors, Get support, Authors / Support, Authors / Support
|
||||
@section Authors
|
||||
|
||||
WeeChat is developed by:@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Get support, Copyright, Authors, Authors / Support
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@node Get support, , Authors, Authors / Support
|
||||
@end ifnothtml
|
||||
@section Get support
|
||||
|
||||
Before asking for support, be sure you've read documentation and FAQ provided
|
||||
with WeeChat.@*
|
||||
(documentation is this document, if you don't read all lines until this sentence,
|
||||
you can start again!)@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Support with IRC:@*
|
||||
- server: @b{irc.freenode.net}@*
|
||||
- channel: @b{#weechat}@*@*
|
||||
@item
|
||||
WeeChat forum: @uref{http://forums.flashtux.org}@*@*
|
||||
@item
|
||||
Support with mailing list:@*
|
||||
- to subscribe/unsubscribe:@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||
- to send mail to all mailing list subscribers, send your mail to@*@email{weechat-support@@nongnu.org}.@*
|
||||
|
||||
Mailing archives are available here:@*
|
||||
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||
@item
|
||||
Look for WeeChat support page for detail:@*
|
||||
@uref{http://weechat.flashtux.org/support.php?lang=en}
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Copyright, , Get support, Authors / Support
|
||||
@section Copyright
|
||||
|
||||
This manual documents WeeChat IRC client, it is part of WeeChat.@*
|
||||
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
This document may be used under the terms the GNU General Public License
|
||||
version 2 or higher.
|
||||
@end ifhtml
|
||||
|
||||
@bye
|
||||
@@ -0,0 +1,954 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename weechat_doc_fr.info
|
||||
@settitle WeeChat - Client IRC rapide, leger et extensible
|
||||
@c %**end of header
|
||||
|
||||
@c WeeChat documentation (french version)
|
||||
@c
|
||||
@c Copyright (c) 2005 by FlashCode <flashcode@flashtux.org>
|
||||
@c
|
||||
@c This manual is free software; you can redistribute it and/or modify
|
||||
@c it under the terms of the GNU General Public License as published by
|
||||
@c the Free Software Foundation; either version 2 of the License, or
|
||||
@c (at your option) any later version.
|
||||
@c
|
||||
@c This manual is distributed in the hope that it will be useful,
|
||||
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@c GNU General Public License for more details.
|
||||
@c
|
||||
@c You should have received a copy of the GNU General Public License
|
||||
@c along with this program; if not, write to the Free Software
|
||||
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@c pdf : texi2pdf weechat_doc_fr.texi
|
||||
@c html: makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||
|
||||
@c tex
|
||||
@c \overfullrule=0pt
|
||||
@c end tex
|
||||
|
||||
@documentlanguage fr
|
||||
|
||||
@titlepage
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.0 - 12 F@'evrier 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@page
|
||||
|
||||
Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
|
||||
@*
|
||||
La derni@`ere version de ce document peut @^etre t@'el@'echarg@'ee sur cette page :@*
|
||||
@uref{http://weechat.flashtux.org/doc.php}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
|
||||
License version 2 ou plus.
|
||||
|
||||
@end titlepage
|
||||
|
||||
@everyheading @thischapter @| @|
|
||||
@everyfooting @thistitle @| @| Page @thispage
|
||||
|
||||
@contents
|
||||
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@menu
|
||||
* Introduction:: Description de WeeChat
|
||||
* Installation:: Installation de WeeChat
|
||||
* Utilisation:: Utilisation de WeeChat
|
||||
* Extensions:: Extensions de WeeChat
|
||||
* Auteurs / Support:: Contacter les auteurs et obtenir du support
|
||||
@end menu
|
||||
|
||||
|
||||
@c ******************************* Introduction *******************************
|
||||
|
||||
@node Introduction, Installation, Top, Top
|
||||
@chapter Introduction
|
||||
@menu
|
||||
* Description::
|
||||
* Pre-requis::
|
||||
@end menu
|
||||
|
||||
@node Description, Pre-requis, Introduction, Introduction
|
||||
@section Description
|
||||
|
||||
WeeChat (Wee Enhanced Environment for Chat) est un client IRC libre, rapide et l@'eger,
|
||||
concu pour diff@'erents syst@`emes d'exploitation.@*
|
||||
@*
|
||||
Ses principales caract@'eristiques sont les suivantes :
|
||||
@itemize @minus
|
||||
@item
|
||||
connexion multi-serveurs
|
||||
@item
|
||||
plusieurs interfaces : Curses, Gtk et Qt
|
||||
@item
|
||||
petit, rapide et l@'eger
|
||||
@item
|
||||
param@'etrable et extensible avec des scripts
|
||||
@item
|
||||
conforme aux RFCs 1459, 2810, 2811, 2812, et 2813
|
||||
@item
|
||||
multi-plateformes (Gnu/Linux, *BSD, Windows et d'autres syst@`emes)
|
||||
@item
|
||||
100% GPL, logiciel libre
|
||||
@end itemize
|
||||
|
||||
@*
|
||||
La page d'accueil de WeeChat est ici :@*
|
||||
@uref{http://weechat.flashtux.org}@*
|
||||
|
||||
@node Pre-requis, , Description, Introduction
|
||||
@section Pr@'e-requis
|
||||
|
||||
Pour installer WeeChat, vous @b{devez} avoir :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Un syst@`eme Gnu/Linux (avec le compilateur et les outils associ@'es pour le paquet des sources)
|
||||
@item
|
||||
Droits "root" (pour installer WeeChat)
|
||||
@item
|
||||
Selon l'interface, une des biblioth@`eques suivantes :
|
||||
@itemize @minus
|
||||
@item
|
||||
Curses: la librairie ncurses,
|
||||
@item
|
||||
Gtk: *** interface non d@'evelopp@'ee ***,
|
||||
@item
|
||||
Qt: *** interface non d@'evelopp@'ee ***,
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
|
||||
@c ******************************* Installation *******************************
|
||||
|
||||
@node Installation, Utilisation, Introduction, Top
|
||||
@chapter Installation
|
||||
|
||||
@menu
|
||||
* Paquet binaire::
|
||||
* Paquet source::
|
||||
* Sources CVS::
|
||||
@end menu
|
||||
|
||||
@node Paquet binaire, Paquet source, Installation, Installation
|
||||
@section Paquet binaire
|
||||
|
||||
Les paquets binaires sont disponibles pour les distributions suivantes :
|
||||
@itemize @bullet
|
||||
@item
|
||||
Debian (ou toute distribution compatible Debian)@*
|
||||
Pour installer : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
|
||||
@item
|
||||
Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
|
||||
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Pour installer : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
Slackware (non disponible !)
|
||||
@item
|
||||
Windows (non disponible !)
|
||||
@end itemize
|
||||
|
||||
o@`u x.y.z est la version (par exemple 0.0.1)
|
||||
@*
|
||||
|
||||
@node Paquet source, Sources CVS, Paquet binaire, Installation
|
||||
@section Paquet source
|
||||
|
||||
Tapez simplement dans une console ou un terminal :@*
|
||||
@kbd{./configure}@*
|
||||
@kbd{make}@*
|
||||
Note: pour ne construire que certaines interfaces, vous pouvez passer des param@`etres
|
||||
@`a ./configure, tapez @kbd{./configure --help} pour de l'aide sur ces options.@*
|
||||
|
||||
Obtenez les droits root et installez WeeChat :@*
|
||||
@kbd{su}@*
|
||||
(entrez le mot de passe de root)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@node Sources CVS, , Paquet source, Installation
|
||||
@section Sources CVS
|
||||
|
||||
Attention: les sources CVS sont r@'eserv@'es aux utilisateurs avanc@'es : il se peut
|
||||
que WeeChat ne compile pas et qu'il soit tr@`s instable.
|
||||
Vous @^etes pr@'evenus !@*
|
||||
|
||||
Pour r@'ecup@'erer les sources CVS, tapez ces commandes :@*
|
||||
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||
(lorsqu'un mot de passe est demand@'e, tapez simplement sur Entr@'ee)@*
|
||||
|
||||
Ex@'ecutez ce script :@*
|
||||
@kbd{./autogen.sh}@*
|
||||
|
||||
Suivez alors les instructions du paquet sources - @xref{Paquet source}.
|
||||
|
||||
|
||||
@c ******************************* Utilisation ********************************
|
||||
|
||||
@node Utilisation, Extensions, Installation, Top
|
||||
@chapter Utilisation
|
||||
|
||||
@menu
|
||||
* Lancer WeeChat::
|
||||
* Fichier de configuration::
|
||||
* Raccourcis clavier::
|
||||
* Commandes WeeChat::
|
||||
@end menu
|
||||
|
||||
@node Lancer WeeChat, Fichier de configuration, Utilisation, Utilisation
|
||||
@section Lancer WeeChat
|
||||
|
||||
@subsection Param@`etres de ligne de commande
|
||||
|
||||
@table @code
|
||||
@item -c, --config
|
||||
Afficher l'aide sur le fichier de config (liste des options)@*
|
||||
@item -h, --help
|
||||
Afficher l'aide@*
|
||||
@item -l, --license
|
||||
Afficher la licence de WeeChat@*
|
||||
@item -v, --version
|
||||
Afficher la version de WeeChat@*
|
||||
@end table
|
||||
|
||||
@subsection Lancer WeeChat
|
||||
|
||||
Tapez simplement cette commande pour lancer WeeChat :@*
|
||||
@kbd{weechat-curses} (pour l'interface Curses)@*
|
||||
ou @kbd{weechat-gtk} (pour l'interface Gtk)@*
|
||||
ou @kbd{weechat-qt} (pour l'interface Qt)@*
|
||||
|
||||
Lorsque vous lancez WeeChat pour la premi@`ere fois, un fichier de configuration
|
||||
par d@'efaut est cr@'e@'e, avec les options par d@'efaut.@*
|
||||
Le fichier de configuration par d@'efaut est : ~/.weechat/weechat.rc@*
|
||||
|
||||
Vous pouvez @'editer ce fichier pour configurer WeeChat @`a votre convenance, ou
|
||||
vous pouvez modifier les param@`etres dans WeeChat avec la commande @kbd{/set} - @xref{Commandes WeeChat}.
|
||||
|
||||
@node Fichier de configuration, Raccourcis clavier, Lancer WeeChat, Utilisation
|
||||
@section Fichier de configuration
|
||||
|
||||
Liste des options du fichier de configuration :@*
|
||||
|
||||
@table @kbd
|
||||
@item look_set_title
|
||||
D@'efinit le titre de la fen@^etre (terminal pour l'interface Curses) avec le nom et la version@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_startup_logo
|
||||
Afficher le logo WeeChat au d@'emarrage@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_startup_version
|
||||
Afficher la version de WeeChat au d@'emarrage@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Jeu de caract@`eres pour d@'ecoder les messages du serveur, exemples: UTF-8, ISO-8859-1 (si non renseign@'e, les messages ne sont pas convertis)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_charset_encode
|
||||
Jeu de caract@`eres pour encoder les messages envoy@'es au serveur, exemples: UFT-8, ISO-8859-1 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_color_actions
|
||||
Afficher les actions avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_remove_colors_from_msgs
|
||||
Supprimer les couleurs dans les messages entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_nicklist
|
||||
Afficher la fen@^etre des utilisateurs (pour les fen@^etres de canaux)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_nicklist_position
|
||||
Position de la fen@^etre d'utilisateurs (haut (top), gauche (left), droite (right, par d@'efaut), bas (bottom))@*
|
||||
Type: cha@^ine (valeurs: 'left', 'right', 'top', 'bottom'), valeur par d@'efaut: 'right'@*
|
||||
@item look_nicklist_min_size
|
||||
Taille minimum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille minimum))@*
|
||||
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
|
||||
@item look_nicklist_max_size
|
||||
Taille maximum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min == max et > 0, alors la taille est fixe))@*
|
||||
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
|
||||
@item look_no_nickname
|
||||
Texte @`a afficher en lieu et place du nom d'utilisateur lorsque la connexion n'est pas active@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '-cmd-'@*
|
||||
@item look_nickmode
|
||||
Afficher le mode de l'utilisateur ((half)op/voice) devant chaque utilisateur@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_nickmode_empty
|
||||
Afficher un espace si le mode utilisateur n'est pas (half)op/voice@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item look_nick_completor
|
||||
La cha@^ine affich@'ee apr@`es la compl@'etion des utilisateurs@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ':'@*
|
||||
@item look_infobar
|
||||
Active la barre d'infos@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Horodatage pour les conversations sauvegard@'ees@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
D@'elai (en secondes) pour la notification des messages dans la barre d'infos (0 = d@'esactiver les notifications dans la barre d'infos)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 7@*
|
||||
@item col_title
|
||||
Couleur pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_title_bg
|
||||
Couleur de fond pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
|
||||
@item col_chat
|
||||
Couleur pour le texte de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time
|
||||
Couleur pour l'heure dans la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Couleur pour la s@'eparation de l'heure (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'brown'@*
|
||||
@item col_chat_prefix1
|
||||
Couleur pour le 1er et le 3@`eme caract@`ere du pr@'efixe@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
|
||||
@item col_chat_prefix2
|
||||
Couleur pour le caract@`ere du milieu du pr@'efixe@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_chat_nick
|
||||
Couleur pour les noms d'utilisateurs dans les actions (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
|
||||
@item col_chat_host
|
||||
Couleur pour les noms de machines (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_chat_channel
|
||||
Couleur pour les canaux dans les actions (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_chat_dark
|
||||
Couleur pour les s@'eparateurs sombres (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'green'@*
|
||||
@item col_chat_highlight
|
||||
Couleur pour le pseudo surlign@'e (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_chat_bg
|
||||
Couleur de fond pour la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status
|
||||
Couleur pour la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Couleur pour les d@'elimiteurs de la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_status_data_msg
|
||||
Couleur pour une fen@^etre avec de nouvelles infos (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_status_highlight
|
||||
Couleur pour une fen@^etre avec un highlight (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_more
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_status_bg
|
||||
Couleur de fond pour la fen@^etre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
|
||||
@item col_infobar
|
||||
Couleur pour la barre d'infos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'black'@*
|
||||
@item col_infobar_highlight
|
||||
Couleur pour la notification dans la barre d'infos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_infobar_bg
|
||||
Couleur de fond pour la fen@^etre de barre d'infos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_input
|
||||
Couleur pour le texte saisi@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_input_channel
|
||||
Couleur pour le texte saisi (nom du canal)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_input_nick
|
||||
Couleur pour le texte saisi (pseudo)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_input_bg
|
||||
Couleur de fond pour la fen@^etre de saisie@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick
|
||||
Couleur pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_away
|
||||
Couleur pour les pseudos absents@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Couleur pour le symbole op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_nick_halfop
|
||||
Couleur pour le symbole demi-op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@item col_nick_voice
|
||||
Couleur pour le symbole voix@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_nick_sep
|
||||
Couleur pour le s@'eparateur de pseudo@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
|
||||
@item col_nick_self
|
||||
Couleur pour le pseudo local@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_nick_private
|
||||
Couleur pour l'autre pseudo dans la fen@^etre priv@'ee@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_bg
|
||||
Couleur de fond pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_dcc_selected
|
||||
Couleur pour le DCC s@'electionn@'e (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Couleur pour le statut dcc "attente"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_dcc_connecting
|
||||
Couleur pour le statut dcc "connexion"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_dcc_active
|
||||
Couleur pour le statut dcc "actif"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightblue'@*
|
||||
@item col_dcc_done
|
||||
Couleur pour le statut dcc "termin@'e"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_dcc_failed
|
||||
Couleur pour le statut dcc "@'echou@'e"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
|
||||
@item col_dcc_aborted
|
||||
Couleur pour le statut dcc "interrompu"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
|
||||
@item history_max_lines
|
||||
Nombre maximum de lignes dans l'historique pour un serveur/fen@^etre/fen@^etre priv@'ee (0 = sans limite)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 4096@*
|
||||
@item history_max_commands
|
||||
Nombre maximum de commandes utilisateur dans l'historique (0 = sans limite)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 100@*
|
||||
@item log_auto_server
|
||||
Enregistrer automatiquement les messages du serveur@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_channel
|
||||
Enregistrer automatiquement les conversations des canaux@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_private
|
||||
Enregistrer automatiquement les conversations priv@'ees@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_path
|
||||
Chemin pour les conversations sauvegard@'ees par WeeChat@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
|
||||
@item log_timestamp
|
||||
Horodatage pour les conversations sauvegard@'ees (voir man strftime pour le format de date/heure)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Masquer le mot de passe affich@'e par nickserv@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_display_away
|
||||
Affiche un message sur tous les canaux pour l'absence/le retour@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Message par d@'efaut pour l'absence@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Message par d@'efaut pour le part (quitte un canal)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Message de fin par d@'efaut ('%v' sera remplac@'e par la version de WeeChat dans la cha@^ine)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Intervalle entre deux v@'erifications des absences (en minutes, 0 = ne jemais v@'erifier)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_check
|
||||
Intervalle entre deux mesures de lag (en secondes)@*
|
||||
Type: entier (valeurs: entre 30 et 2147483647), valeur par d@'efaut: 60@*
|
||||
@item irc_lag_min_show
|
||||
Lag minimum @`a afficher (en secondes)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_disconnect
|
||||
D@'econnexion apr@`es un lag important (en minutes, 0 = ne jamais se d@'econnecter)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Accepte automatiquement les fichiers dcc entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Accepte automatiquement les demandes de discussion dcc (@`a utiliser avec pr@'ecaution !)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item dcc_timeout
|
||||
D@'elai d'attente pour les requ@^etes dcc (en secondes)@*
|
||||
Type: entier (valeurs: entre 1 et 2147483647), valeur par d@'efaut: 300@*
|
||||
@item dcc_blocksize
|
||||
Taille de bloc pour les paquets dcc en octets (d@'efaut: 1024)@*
|
||||
Type: entier (valeurs: entre 1024 et 102400), valeur par d@'efaut: 1024@*
|
||||
@item dcc_download_path
|
||||
Chemin pour @'ecrire les fichiers re@,{c}us par dcc (par d@'efaut: r@'epertoire de l'utilisateur)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_upload_path
|
||||
Chemin pour lire les fichiers lorsqu'ils sont envoy@'es par dcc (quand aucun chemin n'est sp@'ecifi@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_auto_rename
|
||||
Renommer les fichiers re@,{c}us s'ils existent d@'ej@`a (ajoute '.1', '.2', ...)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item dcc_auto_resume
|
||||
Continuer automatiquement les transferts dcc si la connexion avec la machine distante a @'et@'e perdue@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item proxy_use
|
||||
Utiliser un proxy pour se connecter au serveur irc@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item proxy_address
|
||||
Adresse du serveur proxy (IP ou nom)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item proxy_port
|
||||
Port pour se connecter au serveur proxy@*
|
||||
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 1080@*
|
||||
@item proxy_password
|
||||
Mot de passe pour le serveur proxy@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_name
|
||||
Nom associ@'e au serveur IRC (pour affichage seulement)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_autoconnect
|
||||
Connexion automatique au serveur quand WeeChat d@'emarre@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item server_autoreconnect
|
||||
Reconnexion automatique au serveur apr@`es une d@'econnexion@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item server_autoreconnect_delay
|
||||
D@'elai (en secondes) avant de tenter une reconnexion au serveur@*
|
||||
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 30@*
|
||||
@item server_address
|
||||
Adresse IP ou nom du serveur IRC@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_port
|
||||
Port pour se connecter au serveur@*
|
||||
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 6667@*
|
||||
@item server_password
|
||||
Mot de passe pour le serveur IRC@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_nick1
|
||||
Pseudo @`a utiliser sur le serveur IRC@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_nick2
|
||||
Pseudo alternatif pour le serveur IRC (si le pseudo est d@'ej@`a utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_nick3
|
||||
2nd pseudo alternatif pour le serveur IRC (si le pseudo alternatif est d@'ej@`a utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_username
|
||||
Nom d'utilisateur pour le serveur IRC@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_realname
|
||||
Nom r@'eel pour le serveur IRC@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_command
|
||||
Commande @`a ex@'ecuter en premier lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_command_delay
|
||||
D@'elai (en secondes) apr@`es ex@'ecution de la commande (exemple: donner du temps pour l'authentification)@*
|
||||
Type: entier (valeurs: entre 0 et 5), valeur par d@'efaut: 0@*
|
||||
@item server_autojoin
|
||||
Liste des canaux (s@'epar@'es par des virgules) @`a rejoindre lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_autorejoin
|
||||
Rejoindre automatiquement les canaux quand mis dehors@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@end table
|
||||
|
||||
Les couleurs pour l'interface Curses sont :@*
|
||||
@itemize @minus
|
||||
@item
|
||||
@kbd{default}: couleur par d@'efaut (transparent pour le fond)
|
||||
@item
|
||||
@kbd{black}: noir
|
||||
@item
|
||||
@kbd{red}: rouge fonc@'e
|
||||
@item
|
||||
@kbd{lightred}: rouge clair
|
||||
@item
|
||||
@kbd{green}: vert fonc@'e
|
||||
@item
|
||||
@kbd{lightgreen}: vert clair
|
||||
@item
|
||||
@kbd{brown}: marron
|
||||
@item
|
||||
@kbd{yellow}: jaune
|
||||
@item
|
||||
@kbd{blue}: bleu fonc@'e
|
||||
@item
|
||||
@kbd{lightblue}: bleu clair
|
||||
@item
|
||||
@kbd{magenta}: violet fonc@'e
|
||||
@item
|
||||
@kbd{lightmagenta}: violet clair
|
||||
@item
|
||||
@kbd{cyan}: cyan fonc@'e
|
||||
@item
|
||||
@kbd{lightcyan}: cyan clair
|
||||
@item
|
||||
@kbd{white}: blanc
|
||||
@end itemize
|
||||
|
||||
@node Raccourcis clavier, Commandes WeeChat, Fichier de configuration, Utilisation
|
||||
@section Raccourcis clavier
|
||||
|
||||
@table @kbd
|
||||
@item Fl@`eche gauche / Fl@`eche droite
|
||||
Aller au caract@`ere pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||
@*
|
||||
@item Ctrl + fl@`eche gauche / Ctrl + fl@`eche droite
|
||||
Aller au mot pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||
@*
|
||||
@item Home / Ctrl + A
|
||||
Aller au d@'ebut de la ligne de commande@*
|
||||
@*
|
||||
@item End / Ctrl + E
|
||||
Aller @`a la fin de la ligne de commande@*
|
||||
@*
|
||||
@item Backspace / Delete
|
||||
Effacer le mot pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||
@*
|
||||
@item Ctrl + Backspace / Ctrl + W
|
||||
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
|
||||
@*
|
||||
@item Tab
|
||||
Compl@'eter la commande ou le pseudo (@kbd{Tab} @`a nouveau : trouver la compl@'etion suivante)@*
|
||||
@*
|
||||
@item Tout caract@`ere
|
||||
Ins@'erer le caract@`ere @`a la position du curseur sur la ligne de commande@*
|
||||
@*
|
||||
@item Entr@'ee
|
||||
Ex@'ecuter la commande ou envoyer le message@*
|
||||
@*
|
||||
@item Fl@`eche haut / Fl@`eche bas
|
||||
Rappeler les derni@`eres commandes/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Afficher l'historique du tampon@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Aller au tampon pr@'ec@'edent@*
|
||||
@*
|
||||
@item F8
|
||||
Aller @`a la fen@^etre suivante@*
|
||||
@*
|
||||
@item F10
|
||||
Effacer le dernier message de la barre d'infos@*
|
||||
@*
|
||||
@item Ctrl + L
|
||||
R@'eaffiche toute la fen@^etre@*
|
||||
@*
|
||||
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||
Identique @`a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
|
||||
@*
|
||||
@item Alt + D
|
||||
Afficher les DCC en cours@*
|
||||
@*
|
||||
@item Alt + R
|
||||
Vide la hotlist (notification d'activité sur les autres tampons)@*
|
||||
@*
|
||||
@item Alt + S
|
||||
Sauter au tampon du serveur@*
|
||||
@*
|
||||
@item Alt + X
|
||||
Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal ouvert)@*
|
||||
@*
|
||||
@item Alt + chiffre (1-9)
|
||||
Sauter au tampon avec ce num@'ero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
|
||||
@section Commandes WeeChat
|
||||
|
||||
NON ECRIT !
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
|
||||
@node Extensions, Auteurs / Support, Utilisation, Top
|
||||
@chapter Extensions
|
||||
|
||||
@menu
|
||||
* Scripts Perl::
|
||||
* Scripts Python::
|
||||
* Scripts Ruby::
|
||||
@end menu
|
||||
|
||||
@node Scripts Perl, Scripts Python, Extensions, Extensions
|
||||
@section Scripts Perl
|
||||
|
||||
@subsection Charger/d@'echarger des scripts Perl
|
||||
|
||||
Les scripts Perl sont charg@'es et d@'echarg@'es avec la commande @command{/perl}
|
||||
(tapez @kbd{/help perl} dans WeeChat pour obtenir de l'aide sur la commande).@*
|
||||
|
||||
@emph{Exemples :}@*
|
||||
@itemize @bullet
|
||||
@item
|
||||
Charger un script Perl : @kbd{/perl load /tmp/essai.pl}@*
|
||||
@item D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
|
||||
@item
|
||||
Lister les scripts Perl charg@'es : @kbd{/perl}@*
|
||||
@end itemize
|
||||
|
||||
@subsection Interface WeeChat / Perl
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@command{IRC::register ( nom, version, fonction_de_fin, description );}@*
|
||||
@*
|
||||
C'est la premi@`ere fonction @`a appeler dans le script Perl.@*
|
||||
Tout script Perl pour WeeChat doit appeler cette fonction.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{nom}: nom unique pour identifier le script (chaque script doit
|
||||
avoir un nom diff@'erent)
|
||||
@item @option{version}: version du script
|
||||
@item @option{fonction_de_fin}: fonction Perl appel@'ee quand le script est
|
||||
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
|
||||
de fonction @`a appeler)
|
||||
@item @option{description}: description br@`eve du script.
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemple :}@*
|
||||
@code{IRC::register ("essai", "1.0", "fin_essai", "Script d'essai !");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print ( message );}@*
|
||||
@*
|
||||
Affiche un message dans la fen@^etre courante (canal ou serveur).@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{message}: message @`a afficher
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemple :}@*
|
||||
@code{IRC::print ("message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_with_channel ( canal, [serveur,] message );}@*
|
||||
@*
|
||||
Affiche un message dans un canal.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{canal}: nom du canal
|
||||
@item @option{serveur}: nom interne du serveur
|
||||
@item @option{message}: message @`a afficher
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemples :}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_infobar ( d@'elai, message );}@*
|
||||
@*
|
||||
Affiche un message dans la barre d'infos.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{d@'elai}: d@'elai (en secondes) pendant lequel le message est affich@'e
|
||||
(si 0, le message ne sera pas effac@'e).
|
||||
@item @option{message}: message @`a afficher
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemple :}@*
|
||||
@code{IRC::print_infobar (5, "message");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_message_handler ( nom, fonction );}@*
|
||||
@*
|
||||
Attache une fonction Perl @`a un message IRC particulier.@*
|
||||
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{nom}: nom du message IRC pour lequel la fonction est appel@'ee@*
|
||||
Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
|
||||
RFC 1459 et/ou 2812 :@*
|
||||
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||
@item @option{fonction}: fonction Perl appel@'ee lorsque le message est re@,{c}u
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemple :}@*
|
||||
@code{IRC::add_message_handler ("privmsg", ma_fonction);}@*
|
||||
@code{sub ma_fonction}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ IRC::print ("serveur=$_[0]\n");}@*
|
||||
@code{@ @ @ @ ($null, $canal, $message) = split ":",$_[1],3;}@*
|
||||
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
|
||||
@code{@ @ @ @ IRC::print ("masque=$masque, canal=$canal, message=$message\n");}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_command_handler ( nom, fonction );}@*
|
||||
@*
|
||||
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Perl.@*
|
||||
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{nom}: nom de la nouvelle commande@*
|
||||
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
|
||||
la fonction Perl. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
|
||||
ne seront plus accessibles tant que le script Perl sera charg@'e.
|
||||
@item @option{fonction}: fonction Perl associ@'ee @`a la commande
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemple :}@*
|
||||
@code{IRC::add_command_handler ("commande", ma_commande);}@*
|
||||
@code{sub ma_commande}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ IRC::print("Serveur: $_[0], param@`etres: $_[1]\n");}@*
|
||||
@code{@ @ @ @ return 0;}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::get_info ( [serveur,] nom );}@*
|
||||
@*
|
||||
Obtenir des informations vari@'ees sur WeeChat, le serveur ou l'utilisateur.@*
|
||||
|
||||
@emph{Param@`etres :}
|
||||
@itemize @minus
|
||||
@item @option{serveur}: nom interne du serveur
|
||||
@item @option{nom}: nom de l'info @`a obtenir :
|
||||
@itemize @minus
|
||||
@item @option{0 ou version}: obtenir la version de WeeChat
|
||||
@item @option{1 ou nick}: obtenir le pseudo
|
||||
@item @option{2 ou channel}: obtenir le nom du canal
|
||||
@item @option{3 ou server}: obtenir le nom du serveur
|
||||
@item @option{4 ou weechatdir}: obtenir le r@'epertoire maison de WeeChat
|
||||
@item @option{5 ou away}: obtenir le drapeau "away" du serveur
|
||||
@end itemize
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemples :}@*
|
||||
@code{$version = get_info("version");}@*
|
||||
@code{$nick = get_info("freenode", "nick");}@*
|
||||
@*
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Scripts Python, Scripts Ruby, Scripts Perl, Extensions
|
||||
@section Scripts Python
|
||||
|
||||
Non d@'evelopp@'e !
|
||||
|
||||
@node Scripts Ruby, , Scripts Python, Extensions
|
||||
@section Scripts Ruby
|
||||
|
||||
Non d@'evelopp@'e !
|
||||
|
||||
@c **************************** Auteurs / Support *****************************
|
||||
|
||||
@node Auteurs / Support, , Extensions, Top
|
||||
@chapter Auteurs / Support
|
||||
|
||||
@ifhtml
|
||||
@menu
|
||||
* Auteurs::
|
||||
* Obtenir du support::
|
||||
* Copyright::
|
||||
@end menu
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Auteurs::
|
||||
* Obtenir du support::
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@node Auteurs, Obtenir du support, Auteurs / Support, Auteurs / Support
|
||||
@section Auteurs
|
||||
|
||||
WeeChat est d@'evelopp@'e par :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Obtenir du support, Copyright, Auteurs, Auteurs / Support
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@node Obtenir du support, , Auteurs, Auteurs / Support
|
||||
@end ifnothtml
|
||||
@section Obtenir du support
|
||||
|
||||
Avant de faire appel au support, merci de lire la documentation et la
|
||||
FAQ de WeeChat.@*
|
||||
(la documentation est le document que vous @^etes en train de lire, si vous
|
||||
n'avez pas tout lu jusqu'ici, il est encore temps de recommencer !)@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Support par IRC:@*
|
||||
- serveur : @b{irc.freenode.net}@*
|
||||
- canal : @b{#weechat}@*@*
|
||||
@item
|
||||
Forum WeeChat : @uref{http://forums.flashtux.org}@*@*
|
||||
@item
|
||||
Support par la liste de diffusion :@*
|
||||
- pour souscrire/d@'esinscrire :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||
- pour envoyer un mail @`a la liste de diffusion, envoyer @`a :@*@email{weechat-support@@nongnu.org}.@*
|
||||
|
||||
Les archives de la liste de diffusion sont ici :@*
|
||||
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||
@item
|
||||
Voir la page support WeeChat pour plus de d@'etails :@*
|
||||
@uref{http://weechat.flashtux.org/support.php}
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Copyright, , Obtenir du support, Auteurs / Support
|
||||
@section Copyright
|
||||
|
||||
Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
|
||||
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
|
||||
License version 2 ou plus.
|
||||
@end ifhtml
|
||||
|
||||
@bye
|
||||
@@ -0,0 +1,583 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename weechat_doc_pt.info
|
||||
@settitle WeeChat - Um cliente de IRC rapido, leve e extencivel
|
||||
@c %**end of header
|
||||
|
||||
@c WeeChat documentation (vers@~ao partuguesa)
|
||||
@c
|
||||
@c Copyright (c) 2005 by FlashCode <flashcode@flashtux.org>
|
||||
@c
|
||||
@c This manual is free software; you can redistribute it and/or modify
|
||||
@c it under the terms of the GNU General Public License as published by
|
||||
@c the Free Software Foundation; either version 2 of the License, or
|
||||
@c (at your option) any later version.
|
||||
@c
|
||||
@c This manual is distributed in the hope that it will be useful,
|
||||
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@c GNU General Public License for more details.
|
||||
@c
|
||||
@c You should have received a copy of the GNU General Public License
|
||||
@c along with this program; if not, write to the Free Software
|
||||
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@c pdf : texi2pdf weechat_doc_pt.texi
|
||||
@c html: makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
|
||||
@c tex
|
||||
@c \overfullrule=0pt
|
||||
@c end tex
|
||||
|
||||
@documentlanguage pt
|
||||
|
||||
@titlepage
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.0 - 12 de Fevereiro de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@page
|
||||
|
||||
Este manual documenta o cliente de IRC WeeChat, ele faz parte do WeeChat.@*
|
||||
@*
|
||||
A ultima versĂŁo deste documento pode ser descarregada de :@*
|
||||
@uref{http://weechat.flashtux.org/doc.php}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@*
|
||||
Este documento pode ser utilizado sobre os termos da Licen@,{c}a P@'ublica geral GNU (GNU General Public
|
||||
License) vers@~ao 2 ou superior.
|
||||
|
||||
@end titlepage
|
||||
|
||||
@everyheading @thischapter @| @|
|
||||
@everyfooting @thistitle @| @| Pagina @thispage
|
||||
|
||||
@contents
|
||||
|
||||
@node Top, Introducao, (dir), (dir)
|
||||
@menu
|
||||
* Introducao:: Descri@,{c}@~ao do WeeChat
|
||||
* Instalacao:: Instala@,{c}@~ao do WeeChat
|
||||
* Utilizacao:: Utiliza@,{c}@~ao do WeeChat
|
||||
* Extencoes:: Exten@,{c}@~oes do Weechat
|
||||
* Autores/Suporte:: Contactar os autores e obter suporte
|
||||
@end menu
|
||||
|
||||
|
||||
@c ******************************* Introducao *******************************
|
||||
|
||||
@node Introducao, Instalacao, Top, Top
|
||||
@chapter Introdu@,{c}@~ao
|
||||
@menu
|
||||
* Descricao::
|
||||
* Pre-requisitos::
|
||||
@end menu
|
||||
|
||||
@node Descricao, Pre-requisitos, Introducao, Introducao
|
||||
@section Descri@,{c}@~ao
|
||||
|
||||
O WeeChat (Wee Enhanced Environment for Chat) @'e um cliente de IRC livre, r@'apido e leve,
|
||||
concebido para funcionar em diversos sistemas operativos.@*
|
||||
@*
|
||||
As suas caracter@'isticas prinicpais s@~ao as seguintes :
|
||||
@itemize @minus
|
||||
@item
|
||||
liga@,{c}@~ao a m@'ultiplos servidores
|
||||
@item
|
||||
v@'arias interfaces : Curses, Gtk e Qt
|
||||
@item
|
||||
pequeno r@'apido e leve
|
||||
@item
|
||||
configuravel e extenc@'ivel com scripts
|
||||
@item
|
||||
compat@'ivel com RFCs 1459, 2810, 2811, 2812, e 2813
|
||||
@item
|
||||
multiplataforma (Gnu/Linux, *BSD, Windows e outros)
|
||||
@item
|
||||
100% GPL, Software Livre
|
||||
@end itemize
|
||||
|
||||
@*
|
||||
A p@'agina Web do Weechat @'e aqui :@*
|
||||
@uref{http://weechat.flashtux.org}@*
|
||||
|
||||
@node Pre-requisitos, ,Descricao, Introducao
|
||||
@section Pr@'e-requisitos
|
||||
|
||||
Para instalar o Weechat, vais @b{precisar} de ter :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Um sistema Gnu/Linux (com um compilador e outros utilit@'arios associados aos pacotes de c@'odigo fonte)
|
||||
@item
|
||||
Direitos de "root" (para instalar)
|
||||
@item
|
||||
Consoante a interface escolhida, uma das seguintes bibliotecas :
|
||||
@itemize @minus
|
||||
@item
|
||||
Curses: a biblioteca ncurses,
|
||||
@item
|
||||
Gtk: *** interface n@~ao desenvolvida ***,
|
||||
@item
|
||||
Qt: *** interface n@~ao desenvolvida ***,
|
||||
@end itemize
|
||||
@end itemize
|
||||
|
||||
|
||||
@c ******************************* Instalacao *******************************
|
||||
|
||||
@node Instalacao, Utilizacao, Introducao, Top
|
||||
@chapter Instala@,{c}@~ao
|
||||
@menu
|
||||
* Binarios::
|
||||
* Codigo Fonte::
|
||||
* Codigo Fonte via CVS::
|
||||
@end menu
|
||||
|
||||
@node Binarios, Codigo Fonte, Instalacao, Instalacao
|
||||
@section Bin@'arios
|
||||
|
||||
Os pacotes bin@'arios est@'ao dispon@'iveis para as seguintes distribui@,{c}@~oes :
|
||||
@itemize @bullet
|
||||
@item
|
||||
Debian (ou compat@'ivel)@*
|
||||
Instala@,{c}@~ao : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
|
||||
@item
|
||||
Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
|
||||
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Instala@,{c}@~ao : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
Slackware (n@~ao dispon@'ivel !)
|
||||
@item
|
||||
Windows (n@~ao dispon@'ivel !)
|
||||
@end itemize
|
||||
|
||||
Onde x.y.z @'e a vers@~ao (por exemplo 0.0.1)
|
||||
@*
|
||||
|
||||
@node Codigo Fonte, Codigo Fonte via CVS, Binarios, Instalacao
|
||||
@section C@'odigo Fonte
|
||||
|
||||
Escreve simplesmente numa consola ou num terminal :@*
|
||||
@kbd{./configure}@*
|
||||
@kbd{make}@*
|
||||
Nota: Para compilar certas interfaces, podes passar par@^ametros
|
||||
ao ./configure, escreve @kbd{./configure --help} para veres as op@,{c}@~oes.@*
|
||||
|
||||
Obter os direitos do root e instalar o Weechat :@*
|
||||
@kbd{su}@*
|
||||
(escreve aqui a palavra-passe do superutilizador)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@node Codigo Fonte via CVS, , Codigo Fonte, Instalacao
|
||||
@section C@'odigo Fonte via CVS
|
||||
|
||||
Aten@,{c}@~ao: o c@'odigo fonte CVS est@'a reservado aos utilizadores avan@,{c}ados : o WeeChat pode n@~ao compilar ou ficar inst@'avel.@*
|
||||
Considera-te avisado !@*
|
||||
|
||||
Para sacares o c@'odigo fonte via CVS, escreve estes comandos :@*
|
||||
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||
(quando te pedirem a palavra-passe, primen simplesmente Enter)@*
|
||||
|
||||
Executa o script :@*
|
||||
@kbd{./autogen.sh}@*
|
||||
|
||||
Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fonte}.
|
||||
|
||||
|
||||
@c ******************************* Utilizacao ********************************
|
||||
|
||||
@node Utilizacao, Extencoes, Instalacao, Top
|
||||
@chapter Utiliza@,{c}@~ao
|
||||
|
||||
@menu
|
||||
* Invocar o WeeChat::
|
||||
* Recursos de teclado::
|
||||
* Comandos do WeeChat::
|
||||
@end menu
|
||||
|
||||
@node Invocar o WeeChat, Recursos de teclado, Utilizacao, Utilizacao
|
||||
@section Invocar o WeeChat
|
||||
|
||||
@subsection Par@^ametros de linha de comandos
|
||||
|
||||
@table @code
|
||||
@item -c, --config
|
||||
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
|
||||
@item -h, --help
|
||||
Mostrar a ajuda@*
|
||||
@item -l, --license
|
||||
Mostrar a licen@,{c}a do WeeChat@*
|
||||
@item -v, --version
|
||||
Mostrar a vers@~ao do WeeChat@*
|
||||
@end table
|
||||
|
||||
@subsection Invocar o WeeChat
|
||||
|
||||
Escreve simplesmente este comando para invoceres o WeeChat :@*
|
||||
@kbd{weechat-curses} (para a interface em Curses)@*
|
||||
ou @kbd{weechat-gtk} (para a interface em Gtk)@*
|
||||
ou @kbd{weechat-qt} (para a interface em Qt)@*
|
||||
|
||||
Logo que lan@,{c}ares o WeeChat pela primeira vez, um ficheiro de configura@,{c}@~ao
|
||||
por defeito @'e criado, com as configura@,{c}@~oes por defeito.@*
|
||||
O ficheiro de configura@,{c}@~ao por defeito @'e : ~/.weechat/weechat.rc@*
|
||||
|
||||
Podes editar esse ficheiro para configurar o WeeChat @`a tua maneira, man tamb@'em podes modificar os par@^ametros dentro do WeeChat utilizando o comando @kbd{/set} - @xref{Comandos do WeeChat}.
|
||||
|
||||
@node Recursos de teclado, Comandos do WeeChat, Invocar o WeeChat, Utilizacao
|
||||
@section Recursos de teclado
|
||||
|
||||
@table @kbd
|
||||
@item Seta esquerda / Seta direita
|
||||
Ir um caractere para traz / para a frente na linha de comando@*
|
||||
@*
|
||||
@item Ctrl + Seta esquerda / Ctrl + Seta Direita
|
||||
Ir uma palavra para traz / para a frente na linha de comando@*
|
||||
@*
|
||||
@item Home / Ctrl + A
|
||||
Ir para o in@'icio da linha de comando@*
|
||||
@*
|
||||
@item End / Ctrl + E
|
||||
Ir para o fim da linha de comando@*
|
||||
@*
|
||||
@item Backspace / Delete
|
||||
Apagar o caractere anterior / seguinte na linha de comando@*
|
||||
@*
|
||||
@item Ctrl + Backspace / Ctrl + W
|
||||
Apagar a palavra anterior na linha de comando
|
||||
@*
|
||||
@item Tab
|
||||
Completar o comando ou o nick (@kbd{Tab} novamente : encontrar a pr@'oxima sugest@~ao)@*
|
||||
@*
|
||||
@item Qualquer caractere
|
||||
Inserir o caractere na linha de comando, no s@'itio do cursor@*
|
||||
@*
|
||||
@item Enter
|
||||
Executa o comando ou envia a mensagem@*
|
||||
@*
|
||||
@item Seta para cima / Seta para baixo
|
||||
Repetir os ultimos comandos/mensagens@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Navegar no hist@'orico da janela@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Ir para a janela anterior/seguinte@*
|
||||
@*
|
||||
@item F8
|
||||
Comute @`a janela seguinte@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@*
|
||||
@item Ctrl + L
|
||||
Redesenhe a janela inteira@*
|
||||
@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@*
|
||||
@item Alt + D
|
||||
Exposi@,{c}@~ao DCC atual@*
|
||||
@*
|
||||
@item Alt + R
|
||||
Hotlist desobstru@'ido (notifica@,{c}@~ao da atividade em outros amortecedores)@*
|
||||
@*
|
||||
@item Alt + S
|
||||
Comute ao amortecedor do servidor@*
|
||||
@*
|
||||
@item Alt + X
|
||||
Comute @`a primeira canaleta do servidor seguinte (ou do amortecedor do servidor se nenhuma canaleta for aberta)@*
|
||||
@*
|
||||
@item Alt + d@'igito (1-9)
|
||||
Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
|
||||
@section Comandos do WeeChat
|
||||
|
||||
N@~AO ESCRITO !
|
||||
|
||||
|
||||
@c ******************************* Extencoes *********************************
|
||||
|
||||
@node Extencoes, Autores/Suporte, Utilizacao, Top
|
||||
@chapter Exten@,{c}@~oes
|
||||
|
||||
@menu
|
||||
* Scripts Perl::
|
||||
* Scripts Python::
|
||||
* Scripts Ruby::
|
||||
@end menu
|
||||
|
||||
@node Scripts Perl, Scripts Python, Extencoes, Extencoes
|
||||
@section Scripts Perl
|
||||
|
||||
@subsection Carregar/Descarregar Scripts Perl
|
||||
|
||||
Os Scripts Perl s@~ao carregados e descarregados com o comando @command{/perl}.
|
||||
(escreve @kbd{/help perl} dentro do WeeChat para obteres ajuda acerca do comando).@*
|
||||
|
||||
@emph{Exemplos:}@*
|
||||
@itemize @bullet
|
||||
@item
|
||||
Carregar um Script Perl: @kbd{/perl load /tmp/sample.pl}@*
|
||||
@item
|
||||
Descarregar todos os Scripts Perl: @kbd{/perl unload}@*
|
||||
@item
|
||||
Listar todos os Scripts Perl: @kbd{/perl}@*
|
||||
@end itemize
|
||||
|
||||
@subsection Interface WeeChat / Perl
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@command{IRC::register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
|
||||
@*
|
||||
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Perl.@*
|
||||
Todos os Scripts Perl para o Weechat devem invocar esta fun@,{c}@~ao.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome @'unico que indentifique o script (cada Script Perl deve ter um @'unico nome)
|
||||
@item @option{vers@~ao}: vers@~ao do script
|
||||
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Perl invocada quando o script Ă© descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
|
||||
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{IRC::register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print ( mensagem );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na janela actual (canal ou servidor).@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{IRC::print ("mensagem");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_with_channel ( canal, [servidor,] mensagem );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na canal.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{canal}: nome da canal
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplos:}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "freenode", "mensagem");}@*
|
||||
@code{IRC::print_with_channel ("#weechat", "mensagem");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::print_infobar ( atrasa, mensagem );}@*
|
||||
@*
|
||||
Imprimne uma mensagem na barra do info.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
|
||||
(se 0, mensagem n@~ao forem apagados).
|
||||
@item @option{mensagem}: mensagem a mostrar
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{IRC::print_infobar (5, "mensagem");}@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_message_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Anexa uma fun@,{c}@~ao Perl a uma mensagem de IRC.@*
|
||||
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome da mensagem IRC@*
|
||||
Para conheceres uma lista de mensagens de IRC, por favor lĂŞ o RFC 1459 e/ou o 2812:@*
|
||||
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl invocada quando a mensagem Ă© recebida
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{IRC::add_message_handler ("privmsg", my_function);}@*
|
||||
@code{sub my_function}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
|
||||
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||
@code{@ @ @ @ IRC::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::add_command_handler ( nome, fun@,{c}@~ao );}@*
|
||||
@*
|
||||
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Perl.@*
|
||||
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{nome}: nome do novo comando@*
|
||||
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Perl. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Perl.
|
||||
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl ligada ao comando
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplo:}@*
|
||||
@code{IRC::add_command_handler ("command", my_command);}@*
|
||||
@code{sub my_command}@*
|
||||
@code{@{ }@*
|
||||
@code{@ @ @ @ IRC::print("Argumentos: ".@@_[0]);}@*
|
||||
@code{@ @ @ @ return 0;}@*
|
||||
@code{@} }@*
|
||||
@*
|
||||
|
||||
@item
|
||||
@command{IRC::get_info ( [servidor,] nome );}@*
|
||||
@*
|
||||
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
|
||||
|
||||
@emph{Argumentos:}
|
||||
@itemize @minus
|
||||
@item @option{servidor}: nome interno da servidor
|
||||
@item @option{nome}: nome do info a recuperar:
|
||||
@itemize @minus
|
||||
@item @option{0 ou version}: comece a vers@~ao de WeeChat
|
||||
@item @option{1 ou nick}: comece o nickname
|
||||
@item @option{2 ou channel}: comece o nome da canal
|
||||
@item @option{3 ou server}: comece o nome do servidor
|
||||
@item @option{4 ou weechatdir}: comece a WeeChat o diret@'orio home
|
||||
@item @option{5 ou away}: comece a bandeira ausente para o servidor
|
||||
@end itemize
|
||||
@end itemize
|
||||
@*
|
||||
@emph{Exemplos:}@*
|
||||
@code{$version = get_info("version");}@*
|
||||
@code{$nick = get_info("freenode", "nick");}@*
|
||||
@*
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Scripts Python, Scripts Ruby, Scripts Perl, Extencoes
|
||||
@section Scripts Python
|
||||
|
||||
N@~AO DESENVOLVIDO!
|
||||
|
||||
@node Scripts Ruby, , Scripts Python, Extencoes
|
||||
@section Scripts Ruby
|
||||
|
||||
N@~AO DESENVOLVIDO!
|
||||
|
||||
|
||||
@c **************************** Autores/Suporte *****************************
|
||||
|
||||
@node Autores/Suporte, , Extencoes, Top
|
||||
@chapter Autores / Suporte
|
||||
|
||||
@ifhtml
|
||||
@menu
|
||||
* Autores::
|
||||
* Obter Suporte::
|
||||
* Copyright::
|
||||
@end menu
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Autores::
|
||||
* Obter Suporte::
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@node Autores, Obter Suporte, Autores/Suporte, Autores/Suporte
|
||||
@section Autores
|
||||
|
||||
O WeeChat @'e desenvolvido por :@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Obter Suporte, Copyright, Autores, Autores/Suporte
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@node Obter Suporte, , Autores, Autores/Suporte
|
||||
@end ifnothtml
|
||||
@section Obter Suporte
|
||||
|
||||
Antes de pedires suporte, agradecemos se leres toda a documenta@,{c}@~ao e a FAQ.@*
|
||||
(a documenta@,{c}@~ao @'e este documento que est@'as a ler, se n@~ao leste tudo at@'e aqui, est@'a na hora de come@,{c}ares do in@'icio !)@*
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Suporte por IRC:@*
|
||||
- servidor : @b{irc.freenode.net}@*
|
||||
- canal : @b{#weechat}@*@*
|
||||
@item
|
||||
Forum do WeeChat : @uref{http://forums.flashtux.org}@*@*
|
||||
@item
|
||||
Suporte por lista de correio-e :@*
|
||||
- para te inscreveres/desinscreveres :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||
- para enviares uma mensagem para a lista :@*@email{weechat-support@@nongnu.org}.@*
|
||||
|
||||
Os arquivos da lista est@~ao aqui :@*
|
||||
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||
@item
|
||||
Para mais detalhes, v@^e tamb@'em a p@'agina de suporte do WeeChat :@*
|
||||
@uref{http://weechat.flashtux.org/support.php}
|
||||
|
||||
@end itemize
|
||||
|
||||
@ifhtml
|
||||
@node Copyright, , Obter Suporte, Autores/Suporte
|
||||
@section Copyright
|
||||
|
||||
Este manual documenta o cliente de IRC WeeChat, Ele faz parte do WeeChat.@*
|
||||
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
Tradu@,{c}@~ao portuguesa de Jo@~ao Jer@'onimo <@email{j_j_b_o@@sapo.pt, j_j_b_o AT sapo.pt}>@*
|
||||
@*
|
||||
A utiliza@,{c}@~ao deste documento @'e regida pela GNU General Public
|
||||
License vers@~ao 2 ou posterior.@*
|
||||
|
||||
@end ifhtml
|
||||
|
||||
@bye
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
DOMAIN = $(PACKAGE)
|
||||
subdir = po
|
||||
top_builddir = ..
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||
COPYRIGHT_HOLDER =
|
||||
EXTRA_LOCALE_CATEGORIES =
|
||||
MSGID_BUGS_ADDRESS = flashcode@flashtux.org
|
||||
@@ -0,0 +1,30 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc.h
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/plugins.c
|
||||
./src/plugins/plugins.h
|
||||
./src/gui/curses/gui-input.c
|
||||
./src/gui/curses/gui-display.c
|
||||
./src/gui/gtk/gui-display.c
|
||||
./src/gui/gtk/gui-input.c
|
||||
./src/gui/gui.h
|
||||
./src/gui/gui-common.c
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.c
|
||||
./src/common/command.h
|
||||
./src/common/completion.h
|
||||
./src/common/history.h
|
||||
./src/common/log.c
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.c
|
||||
./src/common/weeconfig.h
|
||||
@@ -0,0 +1,19 @@
|
||||
# Sed script that remove the POT-Creation-Date line in the header entry
|
||||
# from a POT file.
|
||||
#
|
||||
# The distinction between the first and the following occurrences of the
|
||||
# pattern is achieved by looking at the hold space.
|
||||
/^"POT-Creation-Date: .*"$/{
|
||||
x
|
||||
# Test if the hold space is empty.
|
||||
s/P/P/
|
||||
ta
|
||||
# Yes it was empty. First occurrence. Remove the line.
|
||||
g
|
||||
d
|
||||
bb
|
||||
:a
|
||||
# The hold space was nonempty. Following occurrences. Do nothing.
|
||||
x
|
||||
:b
|
||||
}
|
||||
+3192
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=weechat
|
||||
|
||||
OBJS=weechat.o config.o command.o completion.o history.o
|
||||
OBJS_IRC=irc/irc.a
|
||||
OBJS_GUI=gui/gui.a
|
||||
|
||||
|
||||
# WeeChat with Curses interface
|
||||
ifeq ($(GUI), curses)
|
||||
LIBS_CURSES=-lcurses
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
curses: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_CURSES)
|
||||
endif
|
||||
|
||||
# WeeChat with Gtk+ interface
|
||||
ifeq ($(GUI), gtk)
|
||||
OBJS_GTK=gui-gtk.o
|
||||
LIBS_GTK=
|
||||
DEFINES=WEE_GTK
|
||||
gtk: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_GTK)
|
||||
endif
|
||||
|
||||
# WeeChat with Qt interface
|
||||
ifeq ($(GUI), qt)
|
||||
OBJS_QT=gui-qt.o
|
||||
LIBS_QT=
|
||||
DEFINES=WEE_QT
|
||||
qt: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_QT)
|
||||
endif
|
||||
|
||||
# WeeChat with Text interface
|
||||
ifeq ($(GUI), text)
|
||||
OBJS_TEXT=gui-text.o
|
||||
LIBS_TEXT=
|
||||
DEFINES=WEE_TEXT
|
||||
text: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_TEXT)
|
||||
endif
|
||||
|
||||
|
||||
all:
|
||||
make curses GUI=curses
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
irc/irc.a:
|
||||
cd irc && make
|
||||
|
||||
gui/gui.a:
|
||||
cd gui && make $(GUI) GUI=$(GUI)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core $(OUTPUT)
|
||||
cd irc && make clean
|
||||
cd gui && make clean
|
||||
|
||||
command.o: command.c weechat.h command.h irc/irc.h gui/gui.h completion.h \
|
||||
history.h config.h
|
||||
completion.o: completion.c weechat.h completion.h irc/irc.h gui/gui.h \
|
||||
history.h command.h
|
||||
config.o: config.c weechat.h config.h irc/irc.h gui/gui.h completion.h \
|
||||
history.h
|
||||
history.o: history.c weechat.h history.h gui/gui.h completion.h
|
||||
weechat.o: weechat.c weechat.h config.h command.h irc/irc.h gui/gui.h \
|
||||
completion.h history.h
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
SUBDIRS = common irc plugins gui
|
||||
-670
@@ -1,670 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* command.c: WeeChat internal commands */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "command.h"
|
||||
#include "irc/irc.h"
|
||||
#include "config.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
t_weechat_command weechat_commands[] =
|
||||
{ { "alias", N_("create an alias for a command"),
|
||||
N_("[alias_name [command [arguments]]"),
|
||||
N_("alias_name: name of alias\ncommand: command name (" WEECHAT_NAME
|
||||
" or IRC command)\n" "arguments: arguments for command"),
|
||||
0, MAX_ARGS, weechat_cmd_alias, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
0, 1, weechat_cmd_clear, NULL },
|
||||
{ "help", N_("display help about commands"),
|
||||
N_("[command]"), N_("command: name of a " WEECHAT_NAME " or IRC command"),
|
||||
0, 1, weechat_cmd_help, NULL },
|
||||
{ "set", N_("set config parameters"),
|
||||
N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"),
|
||||
0, 2, weechat_cmd_set, NULL },
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, weechat_cmd_unalias, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
t_index_command *index_commands;
|
||||
t_index_command *last_index_command;
|
||||
|
||||
|
||||
/*
|
||||
* index_find_pos: find position for a command index (for sorting index)
|
||||
*/
|
||||
|
||||
t_index_command *
|
||||
index_command_find_pos (char *command)
|
||||
{
|
||||
t_index_command *ptr_index;
|
||||
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
{
|
||||
if (strcasecmp (command, ptr_index->command_name) < 0)
|
||||
return ptr_index;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* index_command_insert_sorted: insert index into sorted list
|
||||
*/
|
||||
|
||||
void
|
||||
index_command_insert_sorted (t_index_command *index)
|
||||
{
|
||||
t_index_command *pos_index;
|
||||
|
||||
pos_index = index_command_find_pos (index->command_name);
|
||||
|
||||
if (index_commands)
|
||||
{
|
||||
if (pos_index)
|
||||
{
|
||||
/* insert index into the list (before index found) */
|
||||
index->prev_index = pos_index->prev_index;
|
||||
index->next_index = pos_index;
|
||||
if (pos_index->prev_index)
|
||||
pos_index->prev_index->next_index = index;
|
||||
else
|
||||
index_commands = index;
|
||||
pos_index->prev_index = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add index to the end */
|
||||
index->prev_index = last_index_command;
|
||||
index->next_index = NULL;
|
||||
last_index_command->next_index = index;
|
||||
last_index_command = index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index->prev_index = NULL;
|
||||
index->next_index = NULL;
|
||||
index_commands = index;
|
||||
last_index_command = index;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* index_command_build: build an index of commands (internal, irc and alias)
|
||||
* This list will be sorted, and used for completion
|
||||
*/
|
||||
|
||||
void
|
||||
index_command_build ()
|
||||
{
|
||||
int i;
|
||||
t_index_command *new_index;
|
||||
|
||||
index_commands = NULL;
|
||||
last_index_command = NULL;
|
||||
i = 0;
|
||||
while (weechat_commands[i].command_name)
|
||||
{
|
||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
||||
{
|
||||
new_index->command_name = strdup (weechat_commands[i].command_name);
|
||||
index_command_insert_sorted (new_index);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (irc_commands[i].command_name)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
||||
{
|
||||
new_index->command_name = strdup (irc_commands[i].command_name);
|
||||
index_command_insert_sorted (new_index);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* explode_string: explode a string according to separators
|
||||
*/
|
||||
|
||||
char **
|
||||
explode_string (char *string, char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
int i, n_items;
|
||||
char **array;
|
||||
char *ptr, *ptr1, *ptr2;
|
||||
|
||||
if (num_items != NULL)
|
||||
*num_items = 0;
|
||||
|
||||
n_items = num_items_max;
|
||||
|
||||
if (string == NULL)
|
||||
return NULL;
|
||||
|
||||
if (num_items_max == 0)
|
||||
{
|
||||
/* calculate number of items */
|
||||
ptr = string;
|
||||
i = 1;
|
||||
while ((ptr = strpbrk (ptr, separators)))
|
||||
{
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
}
|
||||
|
||||
array =
|
||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
||||
sizeof (char *));
|
||||
|
||||
ptr1 = string;
|
||||
ptr2 = string;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
while (strchr (separators, ptr1[0]) != NULL)
|
||||
ptr1++;
|
||||
if (i == (n_items - 1) || (ptr2 = strpbrk (ptr1, separators)) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
||||
ptr2 = strchr (ptr1, '\0');
|
||||
|
||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr2 - ptr1 > 0)
|
||||
{
|
||||
array[i] =
|
||||
(char *) malloc ((ptr2 - ptr1 + 1) * sizeof (char));
|
||||
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
|
||||
array[i][ptr2 - ptr1] = '\0';
|
||||
ptr1 = ++ptr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_items_max == 0)
|
||||
{
|
||||
array[i] = NULL;
|
||||
if (num_items != NULL)
|
||||
*num_items = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_items != NULL)
|
||||
*num_items = num_items_max;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* returns: 1 if command was executed succesfully
|
||||
* 0 if error (command not executed)
|
||||
*/
|
||||
|
||||
int
|
||||
exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
int i, j, argc, return_code;
|
||||
char *pos, *ptr_args, **argv;
|
||||
|
||||
if ((!string[0]) || (string[0] != '/'))
|
||||
return 0;
|
||||
|
||||
/* look for end of command */
|
||||
ptr_args = NULL;
|
||||
pos = strchr (string, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
ptr_args = pos;
|
||||
if (!ptr_args[0])
|
||||
ptr_args = NULL;
|
||||
}
|
||||
|
||||
argv = explode_string (ptr_args, " ", 0, &argc);
|
||||
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, string + 1) == 0)
|
||||
{
|
||||
if ((argc < weechat_commands[i].min_arg)
|
||||
|| (argc > weechat_commands[i].max_arg))
|
||||
{
|
||||
if (weechat_commands[i].min_arg ==
|
||||
weechat_commands[i].max_arg)
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for "
|
||||
WEECHAT_NAME " command '%s' "
|
||||
"(expected: %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
weechat_commands[i].max_arg,
|
||||
(weechat_commands[i].max_arg >
|
||||
1) ? "s" : "");
|
||||
else
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for "
|
||||
WEECHAT_NAME " command '%s' "
|
||||
"(expected: between %d and %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
weechat_commands[i].min_arg,
|
||||
weechat_commands[i].max_arg,
|
||||
(weechat_commands[i].max_arg >
|
||||
1) ? "s" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weechat_commands[i].cmd_function_args != NULL)
|
||||
return_code = (int) (weechat_commands[i].cmd_function_args)
|
||||
(argc, argv);
|
||||
else
|
||||
return_code = (int) (weechat_commands[i].cmd_function_1arg)
|
||||
(ptr_args);
|
||||
if (return_code < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s " WEECHAT_NAME " command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, string + 1);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (irc_commands[i].command_name, string + 1) == 0)
|
||||
{
|
||||
if ((argc < irc_commands[i].min_arg)
|
||||
|| (argc > irc_commands[i].max_arg))
|
||||
{
|
||||
if (irc_commands[i].min_arg == irc_commands[i].max_arg)
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("%s wrong argument count for IRC command '%s' "
|
||||
"(expected: %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
irc_commands[i].max_arg,
|
||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
||||
else
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("%s wrong argument count for IRC command '%s' "
|
||||
"(expected: between %d and %d arg%s)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1,
|
||||
irc_commands[i].min_arg, irc_commands[i].max_arg,
|
||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((irc_commands[i].need_connection) &&
|
||||
((!server) || (!server->is_connected)))
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s command '%s' needs a server connection!\n"),
|
||||
WEECHAT_ERROR, irc_commands[i].command_name);
|
||||
return 0;
|
||||
}
|
||||
if (irc_commands[i].cmd_function_args != NULL)
|
||||
return_code = (int) (irc_commands[i].cmd_function_args)
|
||||
(server, argc, argv);
|
||||
else
|
||||
return_code = (int) (irc_commands[i].cmd_function_1arg)
|
||||
(server, ptr_args);
|
||||
if (return_code < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s IRC command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, string + 1);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
gui_printf (server->window,
|
||||
_("%s unknown command '%s' (type /help for help)\n"),
|
||||
WEECHAT_ERROR,
|
||||
string + 1);
|
||||
if (argv)
|
||||
{
|
||||
for (j = 0; argv[j]; j++)
|
||||
free (argv[j]);
|
||||
free (argv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* user_command: interprets user command (if beginning with '/')
|
||||
* any other text is sent to the server, if connected
|
||||
*/
|
||||
|
||||
void
|
||||
user_command (t_irc_server *server, char *command)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if ((!command) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
if ((command[0] == '/') && (command[1] != '/'))
|
||||
{
|
||||
/* WeeChat internal command (or IRC command) */
|
||||
exec_weechat_command (server, command);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (!WIN_IS_SERVER(gui_current_window))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
command);
|
||||
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window)->window, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window)->window,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
_("%s cannot find nick for sending message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_printf (server->window, _("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_alias: display or create alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_alias (int argc, char **argv)
|
||||
{
|
||||
if (argc == 0)
|
||||
{
|
||||
/* List all aliases */
|
||||
}
|
||||
argv = NULL;
|
||||
gui_printf (NULL, _("(TODO) \"/alias\" command not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_clear (int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
gui_window_clear_all ();
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("unknown parameter \"%s\" for /clear command\n"),
|
||||
argv[0]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_window_clear (gui_current_window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_help: display help
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_help (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("> List of " WEECHAT_NAME " internal commands:\n"));
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
gui_printf (NULL, " %s - %s\n",
|
||||
weechat_commands[i].command_name,
|
||||
weechat_commands[i].command_description);
|
||||
gui_printf (NULL, _("> List of IRC commands:\n"));
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
gui_printf (NULL, " %s - %s\n",
|
||||
irc_commands[i].command_name,
|
||||
irc_commands[i].command_description);
|
||||
}
|
||||
if (argc == 1)
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("> Help on " WEECHAT_NAME " internal command '%s':\n"),
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL,
|
||||
_("Syntax: /%s %s\n"),
|
||||
weechat_commands[i].command_name,
|
||||
(weechat_commands[i].
|
||||
arguments) ? weechat_commands[i].
|
||||
arguments : "");
|
||||
if (weechat_commands[i].arguments_description)
|
||||
{
|
||||
gui_printf (NULL, "%s\n",
|
||||
weechat_commands[i].
|
||||
arguments_description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("> Help on IRC command '%s':\n"),
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, _("Syntax: /%s %s\n"),
|
||||
irc_commands[i].command_name,
|
||||
(irc_commands[i].arguments) ?
|
||||
irc_commands[i].arguments : "");
|
||||
if (irc_commands[i].arguments_description)
|
||||
{
|
||||
gui_printf (NULL, "%s\n",
|
||||
irc_commands[i].
|
||||
arguments_description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
gui_printf (NULL,
|
||||
_("No help available, \"%s\" is an unknown command\n"),
|
||||
argv[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_set: set options
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_set (int argc, char **argv)
|
||||
{
|
||||
int i, j, section_displayed;
|
||||
char *color_name;
|
||||
|
||||
/* TODO: complete /set command */
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
section_displayed = 0;
|
||||
if (i != CONFIG_SECTION_SERVER)
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
if ((argc == 0) ||
|
||||
((argc > 0)
|
||||
&& (strstr (weechat_options[i][j].option_name, argv[0])
|
||||
!= NULL)))
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
gui_printf (NULL, "[%s]\n",
|
||||
config_sections[i].section_name);
|
||||
section_displayed = 1;
|
||||
}
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL, " %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(*weechat_options[i][j].ptr_int) ?
|
||||
"ON" : "OFF");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
" %s = %d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
*weechat_options[i][j].ptr_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
" %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
|
||||
gui_printf (NULL,
|
||||
" %s = %s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(color_name) ? color_name : _("(unknown)"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
gui_printf (NULL, " %s = %s\n",
|
||||
weechat_options[i][j].
|
||||
option_name,
|
||||
(*weechat_options[i][j].
|
||||
ptr_string) ?
|
||||
*weechat_options[i][j].
|
||||
ptr_string : "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_printf (NULL, _("(TODO) \"/set\" command not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* cmd_unalias: remove an alias
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_unalias (int argc, char **argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
gui_printf
|
||||
(NULL,
|
||||
_("Wrong argument count for unalias function (expexted: 1 arg)\n"));
|
||||
return -1;
|
||||
}
|
||||
argv = NULL;
|
||||
gui_printf (NULL, _("(TODO) \"/unalias\" not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
lib_weechat_main_a_SOURCES = weechat.c \
|
||||
weechat.h \
|
||||
command.c \
|
||||
command.h \
|
||||
completion.c \
|
||||
completion.h \
|
||||
weelist.c \
|
||||
weelist.h \
|
||||
weeconfig.c \
|
||||
weeconfig.h \
|
||||
history.c \
|
||||
history.h \
|
||||
hotlist.c \
|
||||
hotlist.h \
|
||||
log.c \
|
||||
log.h
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,7 +21,8 @@
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "irc/irc.h"
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
@@ -40,24 +39,40 @@ struct t_weechat_command
|
||||
int (*cmd_function_1arg)(char *);
|
||||
};
|
||||
|
||||
typedef struct t_index_command t_index_command;
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
|
||||
struct t_index_command
|
||||
struct t_weechat_alias
|
||||
{
|
||||
char *command_name;
|
||||
t_index_command *prev_index;
|
||||
t_index_command *next_index;
|
||||
char *alias_name;
|
||||
char *alias_command;
|
||||
t_weechat_alias *prev_alias;
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
extern t_index_command *index_commands;
|
||||
extern t_weechat_command weechat_commands[];
|
||||
|
||||
extern void index_command_build ();
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias(int, char **);
|
||||
extern int weechat_cmd_clear(int, char **);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_set (int, char **);
|
||||
extern int weechat_cmd_unalias (int, char **);
|
||||
extern int weechat_cmd_perl (int, char **);
|
||||
extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* completion.c: completes words according to context (cmd/nick) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* completion_init: init completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->base_command = NULL;
|
||||
completion->base_command_arg = 0;
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_free: free completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_free (t_completion *completion)
|
||||
{
|
||||
if (completion->base_command)
|
||||
free (completion->base_command);
|
||||
completion->base_command = NULL;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = NULL;
|
||||
|
||||
while (completion->completion_list)
|
||||
weelist_remove (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
completion->completion_list);
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_stop: stop completion (for example after 1 arg of command with 1 arg)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_stop (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->position = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_build_list: build data list according to command and argument #
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char option_name[256];
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (strcasecmp (completion->base_command, "save") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "alias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_list->data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "buffer") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"move");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "connect") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
weechat_commands[i].command_name);
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "perl") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"load");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"autoload");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"unload");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "set") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s =",
|
||||
weechat_options[i][j].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s =",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "unalias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_alias->alias_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "window") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splith");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splitv");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"merge");
|
||||
return;
|
||||
}
|
||||
|
||||
if (completion->base_command_arg == 2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"down");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"up");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"left");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"right");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"all");
|
||||
return;
|
||||
}
|
||||
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* IRC commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (strcasecmp (completion->base_command, "who") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "away") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_away);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
&& (completion->base_command_arg == 2))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"action");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"version");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "dcc") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"chat");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
{
|
||||
/* arg1: nickname */
|
||||
if (completion->base_command_arg == 1)
|
||||
return;
|
||||
|
||||
/* arg > 2: not allowed */
|
||||
if (completion->base_command_arg > 2)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg2: channel */
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
{
|
||||
for (ptr_channel = SERVER(gui_current_window->buffer)->channels;
|
||||
ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_channel->name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kick") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kill") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "notice") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "part") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_part);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "query") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "quit") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_quit);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "topic") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
if (!channel || !((t_irc_channel *)channel)->topic
|
||||
|| !((t_irc_channel *)channel)->topic[0])
|
||||
completion_stop (completion);
|
||||
else
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->topic);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_find_context: find context for completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
command = (buffer[0] == '/') ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
{
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
command_arg++;
|
||||
i++;
|
||||
while ((i < pos) && (buffer[i] == ' ')) i++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (command)
|
||||
{
|
||||
if (command_arg > 0)
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND_ARG;
|
||||
completion->base_command_arg = command_arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND;
|
||||
completion->base_command_arg = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
completion->context = COMPLETION_NICK;
|
||||
else
|
||||
completion->context = COMPLETION_NULL;
|
||||
}
|
||||
|
||||
/* look for word to complete (base word) */
|
||||
completion->base_word_pos = 0;
|
||||
completion->position_replace = pos;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
i = pos;
|
||||
pos_start = i;
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
if ((i > 0) && (buffer[i-1] != ' '))
|
||||
{
|
||||
i--;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (pos_start <= pos_end)
|
||||
{
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->base_word)
|
||||
completion->base_word = strdup ("");
|
||||
|
||||
/* find command (for command argument completion only) */
|
||||
if (completion->context == COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
pos_start = 0;
|
||||
while ((pos_start < size) && (buffer[pos_start] != '/'))
|
||||
pos_start++;
|
||||
if (buffer[pos_start] == '/')
|
||||
{
|
||||
pos_start++;
|
||||
pos_end = pos_start;
|
||||
while ((pos_end < size) && (buffer[pos_end] != ' '))
|
||||
pos_end++;
|
||||
if (buffer[pos_end] == ' ')
|
||||
pos_end--;
|
||||
|
||||
completion->base_command = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel
|
||||
&& (((t_irc_channel *)channel)->type == CHAT_PRIVATE))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
SERVER(gui_current_window->buffer)->nick);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command: complete a command
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word + 1, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command (completion);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command_arg: complete a command argument
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = completion->completion_list; ptr_weelist;
|
||||
ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command_arg (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_irc_nick *ptr_nick, *ptr_nick2;
|
||||
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2;
|
||||
ptr_nick2 = ptr_nick2->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick2->nick,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_nick (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_search: complete word according to context
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
char *old_word_found;
|
||||
|
||||
/* if new completion => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
switch (completion->context)
|
||||
{
|
||||
case COMPLETION_NULL:
|
||||
/* should never be executed */
|
||||
return;
|
||||
case COMPLETION_NICK:
|
||||
if (channel)
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case COMPLETION_COMMAND:
|
||||
completion_command (completion);
|
||||
break;
|
||||
case COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list)
|
||||
completion_command_arg (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
break;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
{
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->diff_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
|
||||
#define COMPLETION_NULL 0
|
||||
#define COMPLETION_NICK 1
|
||||
#define COMPLETION_COMMAND 2
|
||||
#define COMPLETION_COMMAND_ARG 3
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
/* completion context */
|
||||
int context; /* context: null, nick, command, cmd arg */
|
||||
char *base_command; /* command with arg to complete (can be NULL) */
|
||||
int base_command_arg; /* # arg to complete (if context is cmd arg) */
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where Tab was pressed */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
t_weelist *last_completion; /* last data element for completion */
|
||||
|
||||
/* completion found */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word has to be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_free (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_last = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
int num_history_general = 0;
|
||||
|
||||
|
||||
/*
|
||||
* history_hide_password: hide a nickserv password
|
||||
*/
|
||||
|
||||
void
|
||||
history_hide_password (char *string)
|
||||
{
|
||||
char *pos_pwd;
|
||||
|
||||
if (strstr (string, "nickserv "))
|
||||
{
|
||||
pos_pwd = strstr (string, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (string, "register ");
|
||||
if (pos_pwd)
|
||||
{
|
||||
pos_pwd += 9;
|
||||
while (pos_pwd[0])
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to general history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
else
|
||||
history_general_last = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
num_history_general++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_general > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_general_last->prev_history;
|
||||
history_general_last->prev_history->next_history = NULL;
|
||||
if (history_general_last->text)
|
||||
free (history_general_last->text);
|
||||
free (history_general_last);
|
||||
history_general_last = ptr_history;
|
||||
num_history_general--;
|
||||
}
|
||||
}
|
||||
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_general_free: free general history
|
||||
*/
|
||||
|
||||
void
|
||||
history_general_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_general)
|
||||
{
|
||||
ptr_history = history_general->next_history;
|
||||
if (history_general->text)
|
||||
free (history_general->text);
|
||||
free (history_general);
|
||||
history_general = ptr_history;
|
||||
}
|
||||
history_general = NULL;
|
||||
history_general_last = NULL;
|
||||
history_general_ptr = NULL;
|
||||
num_history_general = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* history_buffer_free: free history for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
history_buffer_free (void *buffer)
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (((t_gui_buffer *)(buffer))->history)
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)(buffer))->history->next_history;
|
||||
if (((t_gui_buffer *)(buffer))->history->text)
|
||||
free (((t_gui_buffer *)(buffer))->history->text);
|
||||
free (((t_gui_buffer *)(buffer))->history);
|
||||
((t_gui_buffer *)(buffer))->history = ptr_history;
|
||||
}
|
||||
((t_gui_buffer *)(buffer))->history = NULL;
|
||||
((t_gui_buffer *)(buffer))->last_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->ptr_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->num_history = 0;
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,5 +31,7 @@ struct t_history
|
||||
};
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_general_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
#endif /* history.h */
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* hotlist.c: WeeChat hotlist (buffers with activity) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_weechat_hotlist *hotlist = NULL;
|
||||
t_weechat_hotlist *last_hotlist = NULL;
|
||||
t_gui_buffer *hotlist_initial_buffer = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* hotlist_search: find hotlist with buffer pointer
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_search (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (ptr_hotlist->buffer == buffer)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_find_pos: find position for a inserting in hotlist (for sorting hotlist)
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_find_pos (t_weechat_hotlist *new_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (new_hotlist->priority > ptr_hotlist->priority)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_add: add a buffer to hotlist, with priority
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_add (int priority, t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist, *pos_hotlist;
|
||||
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
/* do not highlight current buffer */
|
||||
if (buffer == gui_current_window->buffer)
|
||||
return;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
{
|
||||
/* return if priority is greater or equal than the one to add */
|
||||
if (pos_hotlist->priority >= priority)
|
||||
return;
|
||||
/* remove buffer if present with lower priority and go on */
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
|
||||
if ((new_hotlist = (t_weechat_hotlist *) malloc (sizeof (t_weechat_hotlist))) == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s cannot add a buffer to hotlist\n"), WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
new_hotlist->priority = priority;
|
||||
new_hotlist->buffer = buffer;
|
||||
|
||||
if (hotlist)
|
||||
{
|
||||
pos_hotlist = hotlist_find_pos (new_hotlist);
|
||||
|
||||
if (pos_hotlist)
|
||||
{
|
||||
/* insert hotlist into the hotlist (before hotlist found) */
|
||||
new_hotlist->prev_hotlist = pos_hotlist->prev_hotlist;
|
||||
new_hotlist->next_hotlist = pos_hotlist;
|
||||
if (pos_hotlist->prev_hotlist)
|
||||
pos_hotlist->prev_hotlist->next_hotlist = new_hotlist;
|
||||
else
|
||||
hotlist = new_hotlist;
|
||||
pos_hotlist->prev_hotlist = new_hotlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add hotlist to the end */
|
||||
new_hotlist->prev_hotlist = last_hotlist;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
last_hotlist->next_hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_hotlist->prev_hotlist = NULL;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free: free a hotlist and remove it from hotlist queue
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free (t_weechat_hotlist *ptr_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist;
|
||||
|
||||
/* remove hotlist from queue */
|
||||
if (last_hotlist == ptr_hotlist)
|
||||
last_hotlist = ptr_hotlist->prev_hotlist;
|
||||
if (ptr_hotlist->prev_hotlist)
|
||||
{
|
||||
(ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist;
|
||||
new_hotlist = hotlist;
|
||||
}
|
||||
else
|
||||
new_hotlist = ptr_hotlist->next_hotlist;
|
||||
|
||||
if (ptr_hotlist->next_hotlist)
|
||||
(ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist;
|
||||
|
||||
free (ptr_hotlist);
|
||||
hotlist = new_hotlist;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free_all: free all hotlists
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free_all ()
|
||||
{
|
||||
/* remove all hotlists */
|
||||
while (hotlist)
|
||||
hotlist_free (hotlist);
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_remove_buffer: remove a buffer from hotlist
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_remove_buffer (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *pos_hotlist;
|
||||
|
||||
pos_hotlist = hotlist_search (buffer);
|
||||
if (pos_hotlist)
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_HOTLIST_H
|
||||
#define __WEECHAT_HOTLIST_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
typedef struct t_weechat_hotlist t_weechat_hotlist;
|
||||
|
||||
struct t_weechat_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
/* 2=nick highlight */
|
||||
t_gui_buffer *buffer; /* associated buffer */
|
||||
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
|
||||
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
|
||||
};
|
||||
|
||||
extern t_weechat_hotlist *hotlist;
|
||||
extern t_gui_buffer *hotlist_initial_buffer;
|
||||
|
||||
extern void hotlist_add (int, t_gui_buffer *);
|
||||
extern void hotlist_free (t_weechat_hotlist *);
|
||||
extern void hotlist_free_all ();
|
||||
extern void hotlist_remove_buffer (t_gui_buffer *);
|
||||
|
||||
#endif /* hotlist.h */
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* log.c: log buffers to files */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
/*
|
||||
* log_write_date: writes date to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_date (t_gui_buffer *buffer)
|
||||
{
|
||||
static char buf_time[256];
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
{
|
||||
strftime (buf_time, sizeof (buf_time) - 1, cfg_log_timestamp, date_tmp);
|
||||
fprintf (buffer->log_file, "%s ", buf_time);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write: writes a message to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
if (buffer->log_file)
|
||||
{
|
||||
fprintf (buffer->log_file, "%s", message);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_start: starts a log
|
||||
*/
|
||||
|
||||
void
|
||||
log_start (t_gui_buffer *buffer)
|
||||
{
|
||||
int length;
|
||||
char *ptr_home;
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
length = strlen (cfg_log_path) +
|
||||
((cfg_log_path[0] == '~') ? strlen (ptr_home) : 0) +
|
||||
64;
|
||||
if (SERVER(buffer))
|
||||
length += strlen (SERVER(buffer)->name);
|
||||
if (CHANNEL(buffer))
|
||||
length += strlen (CHANNEL(buffer)->name);
|
||||
buffer->log_filename = (char *) malloc (length);
|
||||
if (!buffer->log_filename)
|
||||
{
|
||||
wee_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
return;
|
||||
}
|
||||
if (cfg_log_path[0] == '~')
|
||||
{
|
||||
strcpy (buffer->log_filename, ptr_home);
|
||||
strcat (buffer->log_filename, cfg_log_path + 1);
|
||||
}
|
||||
else
|
||||
strcpy (buffer->log_filename, cfg_log_path);
|
||||
if (buffer->log_filename[strlen (buffer->log_filename) - 1] != DIR_SEPARATOR_CHAR)
|
||||
strcat (buffer->log_filename, DIR_SEPARATOR);
|
||||
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
strcat (buffer->log_filename, SERVER(buffer)->name);
|
||||
strcat (buffer->log_filename, ".");
|
||||
}
|
||||
if (CHANNEL(buffer))
|
||||
{
|
||||
strcat (buffer->log_filename, CHANNEL(buffer)->name);
|
||||
strcat (buffer->log_filename, ".");
|
||||
}
|
||||
strcat (buffer->log_filename, "weechatlog");
|
||||
|
||||
buffer->log_file = fopen (buffer->log_filename, "a");
|
||||
if (!buffer->log_file)
|
||||
{
|
||||
wee_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
free (buffer->log_filename);
|
||||
return;
|
||||
}
|
||||
log_write (buffer, _("**** Beginning of log "));
|
||||
log_write_date (buffer);
|
||||
log_write (buffer, "****\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* log_end: ends a log
|
||||
*/
|
||||
|
||||
void
|
||||
log_end (t_gui_buffer *buffer)
|
||||
{
|
||||
if (buffer->log_file)
|
||||
{
|
||||
log_write (buffer, _("**** End of log "));
|
||||
log_write_date (buffer);
|
||||
log_write (buffer, "****\n");
|
||||
fclose (buffer->log_file);
|
||||
buffer->log_file = NULL;
|
||||
}
|
||||
if (buffer->log_filename)
|
||||
free (buffer->log_filename);
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +18,14 @@
|
||||
*/
|
||||
|
||||
|
||||
/* gui-gtk.c: Gtk+ GUI for WeeChat */
|
||||
#ifndef __WEECHAT_LOG_H
|
||||
#define __WEECHAT_LOG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
/* ***** Gtk+ GUI for WeeChat, NOT developed! ***** */
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
extern void log_write (t_gui_buffer *, char *);
|
||||
extern void log_start (t_gui_buffer *);
|
||||
extern void log_end (t_gui_buffer *);
|
||||
|
||||
#endif /* log.h */
|
||||
@@ -0,0 +1,594 @@
|
||||
/* ############################################################################
|
||||
* ### ___ __ ______________ _____ ###
|
||||
* ### __ | / /___________ ____/__ /_______ __ /_ ###
|
||||
* ### __ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/ ###
|
||||
* ### __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ ###
|
||||
* ### ____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/ ###
|
||||
* ### ###
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By: FlashCode <flashcode@flashtux.org> ###
|
||||
* ### Bounga <bounga@altern.org> ###
|
||||
* ### Xahlexx <xahlexx@weeland.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weechat.c: core functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (!weechat_log_file)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
fprintf (weechat_log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (weechat_log_file, "%s", buffer);
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
*/
|
||||
|
||||
void wee_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
printf (_("WeeChat configuration options (~/.weechat/weechat.rc):\n\n"));
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if (weechat_options[i])
|
||||
{
|
||||
j = 0;
|
||||
while (weechat_options[i][j].option_name)
|
||||
{
|
||||
printf ("* %s:\n",
|
||||
weechat_options[i][j].option_name);
|
||||
switch (weechat_options[i][j].option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
printf (_(" . type boolean (values: 'on' or 'off')\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_int == BOOL_TRUE) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
printf (_(" . type integer (values: between %d and %d)\n"),
|
||||
weechat_options[i][j].min,
|
||||
weechat_options[i][j].max);
|
||||
printf (_(" . default value: %d\n"),
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
printf (_(" . type string (values: "));
|
||||
k = 0;
|
||||
while (weechat_options[i][j].array_values[k])
|
||||
{
|
||||
printf ("'%s'",
|
||||
weechat_options[i][j].array_values[k]);
|
||||
if (weechat_options[i][j].array_values[k + 1])
|
||||
printf (", ");
|
||||
k++;
|
||||
}
|
||||
printf (")\n");
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
printf (_(" . type color (Curses or Gtk color, look at WeeChat doc)\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
printf (_(" . type string (any string)\n"));
|
||||
printf (_(" . default value: '%s'\n"),
|
||||
(weechat_options[i][j].default_string) ?
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n\n"),
|
||||
gettext (weechat_options[i][j].long_description));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (_("Moreover, you can define aliases in [alias] section, by adding lines like:\n"));
|
||||
printf ("j=join\n");
|
||||
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
|
||||
void
|
||||
wee_parse_args (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
t_irc_server server_tmp;
|
||||
|
||||
server_cmd_line = 0;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!server_new (server_tmp.name, server_tmp.autoconnect,
|
||||
server_tmp.autoreconnect,
|
||||
server_tmp.autoreconnect_delay,
|
||||
1, server_tmp.address, server_tmp.port,
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
server_cmd_line = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
wee_create_dir (char *directory)
|
||||
{
|
||||
if (mkdir (directory, 0755) < 0)
|
||||
{
|
||||
/* exit if error (except if directory already exists) */
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, directory);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_home_dirs: create (if not found):
|
||||
* - WeeChat home directory ("~/.weechat")
|
||||
* - "perl" directory (and "autoload")
|
||||
* - "ruby" directory (and "autoload")
|
||||
* - "python" directory (and "autoload")
|
||||
*/
|
||||
|
||||
void
|
||||
wee_create_home_dirs ()
|
||||
{
|
||||
char *ptr_home, *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* TODO: rewrite this code for Windows version */
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!weechat_home)
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
|
||||
/* create home directory "~/.weechat" ; error is fatal */
|
||||
if (!wee_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
dir_name = (char *) malloc (dir_length * sizeof (char));
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
/* create "~/.weechat/perl" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"perl");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/perl/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "perl", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
/* create "~/.weechat/python" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"python");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/python/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "python", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_RUBY
|
||||
/* create "~/.weechat/ruby" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"ruby");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/ruby/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "ruby", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"logs");
|
||||
if (!wee_create_dir (dir_name))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
chmod (dir_name, 0700);
|
||||
|
||||
free (dir_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_vars: initialize some variables
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_vars ()
|
||||
{
|
||||
/* init received messages queue */
|
||||
recv_msgq = NULL;
|
||||
msgq_last_msg = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_log: initialize log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_log ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (filename, filename_length, "%s/" WEECHAT_LOG_NAME, weechat_home);
|
||||
if ((weechat_log_file = fopen (filename, "wt")) == NULL)
|
||||
fprintf (stderr,
|
||||
_("%s unable to create/append to log file (~/.weechat/%s)"),
|
||||
WEECHAT_WARNING, WEECHAT_LOG_NAME);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_welcome_message: display WeeChat welcome message - yeah!
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_welcome_message ()
|
||||
{
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
" ___ __ ______________ _____ \n"
|
||||
" __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
|
||||
}
|
||||
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s\n", cfg_look_weechat_slogan);
|
||||
}
|
||||
if (cfg_look_startup_version)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||
"%s" PACKAGE_STRING,
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s %s %s\n",
|
||||
_("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
if (cfg_look_startup_logo ||
|
||||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
|
||||
cfg_look_startup_version)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
*/
|
||||
|
||||
void
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
fclose (weechat_log_file);
|
||||
if (local_charset)
|
||||
free (local_charset);
|
||||
alias_free_all ();
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* main: WeeChat startup
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
case 0: /* config file OK */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
return EXIT_FAILURE;
|
||||
if (config_read () != 0)
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
gui_init (); /* init WeeChat interface */
|
||||
plugin_init (); /* init plugin interface(s) */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,24 +21,34 @@
|
||||
#ifndef __WEECHAT_H
|
||||
#define __WEECHAT_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libintl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define _(string) gettext(string)
|
||||
#define N_(string) (string)
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#define _(x) gettext(x)
|
||||
#ifdef gettext_noop
|
||||
#define N_(string) gettext_noop (string)
|
||||
#else
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(_)
|
||||
#define _(x) (x)
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
|
||||
#define WEECHAT_NAME "WeeChat"
|
||||
#define WEECHAT_VERSION "0.0.1"
|
||||
|
||||
#define WEECHAT_NAME_AND_VERSION WEECHAT_NAME " " WEECHAT_VERSION
|
||||
#define WEECHAT_COPYRIGHT WEECHAT_NAME " (c) 2003 by Wee Team"
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(WEECHAT_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(WEECHAT_NAME " Warning:")
|
||||
|
||||
/* debug mode, 0=normal use, 1=some debug msg, 2=full debug (developers only) */
|
||||
#define DEBUG 0
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||
|
||||
/* log file */
|
||||
|
||||
@@ -49,10 +57,8 @@
|
||||
/* license */
|
||||
|
||||
#define WEE_LICENSE \
|
||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"This program is free software; you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation; either version 2 of the License, or\n" \
|
||||
@@ -68,29 +74,37 @@
|
||||
"along with this program; if not, write to the Free Software\n" \
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE \
|
||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||
" -h, --help this help screen\n", \
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -c, --config config file help (list of options)\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n\n"
|
||||
|
||||
/* " -d, --display choose X display\n" \*/
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEPARATOR "\\"
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#endif
|
||||
|
||||
/*#define DEFAULT_DISPLAY ":0" */
|
||||
|
||||
|
||||
/*extern char *display_name; */
|
||||
int quit_weechat;
|
||||
/* global variables and functions */
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern void log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +21,8 @@
|
||||
#ifndef __WEECHAT_CONFIG_H
|
||||
#define __WEECHAT_CONFIG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define WEECHAT_CONFIG_NAME "weechat.rc"
|
||||
|
||||
#define CONFIG_SECTION_NONE -1
|
||||
@@ -30,10 +30,12 @@
|
||||
#define CONFIG_SECTION_COLORS 1
|
||||
#define CONFIG_SECTION_HISTORY 2
|
||||
#define CONFIG_SECTION_LOG 3
|
||||
#define CONFIG_SECTION_DCC 4
|
||||
#define CONFIG_SECTION_PROXY 5
|
||||
#define CONFIG_SECTION_SERVER 6
|
||||
#define CONFIG_NUMBER_SECTIONS 7
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_ALIAS 7
|
||||
#define CONFIG_SECTION_SERVER 8
|
||||
#define CONFIG_NUMBER_SECTIONS 9
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -71,12 +73,16 @@ struct t_config_option
|
||||
char **array_values;
|
||||
int *ptr_int;
|
||||
char **ptr_string;
|
||||
int (*handler_change)(int *, char **);
|
||||
void (*handler_change)();
|
||||
};
|
||||
|
||||
extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
@@ -88,6 +94,9 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern int cfg_look_infobar;
|
||||
extern char *cfg_look_infobar_timestamp;
|
||||
extern int cfg_look_infobar_delay_highlight;
|
||||
|
||||
extern int cfg_col_title;
|
||||
extern int cfg_col_title_bg;
|
||||
@@ -100,18 +109,24 @@ extern int cfg_col_chat_nick;
|
||||
extern int cfg_col_chat_host;
|
||||
extern int cfg_col_chat_channel;
|
||||
extern int cfg_col_chat_dark;
|
||||
extern int cfg_col_chat_highlight;
|
||||
extern int cfg_col_chat_bg;
|
||||
extern int cfg_col_status;
|
||||
extern int cfg_col_status_active;
|
||||
extern int cfg_col_status_delimiters;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_highlight;
|
||||
extern int cfg_col_status_data_other;
|
||||
extern int cfg_col_status_more;
|
||||
extern int cfg_col_status_bg;
|
||||
extern int cfg_col_infobar;
|
||||
extern int cfg_col_infobar_highlight;
|
||||
extern int cfg_col_infobar_bg;
|
||||
extern int cfg_col_input;
|
||||
extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
@@ -119,22 +134,37 @@ extern int cfg_col_nick_sep;
|
||||
extern int cfg_col_nick_self;
|
||||
extern int cfg_col_nick_private;
|
||||
extern int cfg_col_nick_bg;
|
||||
extern int cfg_col_dcc_selected;
|
||||
extern int cfg_col_dcc_waiting;
|
||||
extern int cfg_col_dcc_connecting;
|
||||
extern int cfg_col_dcc_active;
|
||||
extern int cfg_col_dcc_done;
|
||||
extern int cfg_col_dcc_failed;
|
||||
extern int cfg_col_dcc_aborted;
|
||||
|
||||
extern int cfg_history_max_lines;
|
||||
extern int cfg_history_max_commands;
|
||||
|
||||
extern int cfg_log_auto_channels;
|
||||
extern int cfg_log_auto_server;
|
||||
extern int cfg_log_auto_channel;
|
||||
extern int cfg_log_auto_private;
|
||||
extern char *cfg_log_path;
|
||||
extern char *cfg_log_name;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern char *cfg_log_start_string;
|
||||
extern char *cfg_log_end_string;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
|
||||
extern int cfg_irc_display_away;
|
||||
extern char *cfg_irc_default_msg_away;
|
||||
extern char *cfg_irc_default_msg_part;
|
||||
extern char *cfg_irc_default_msg_quit;
|
||||
extern int cfg_irc_away_check;
|
||||
extern int cfg_irc_lag_check;
|
||||
extern int cfg_irc_lag_min_show;
|
||||
extern int cfg_irc_lag_disconnect;
|
||||
|
||||
extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_max_size;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
@@ -148,8 +178,20 @@ extern char *cfg_proxy_password;
|
||||
extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS];
|
||||
extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
|
||||
extern char *config_get_section ();
|
||||
extern void config_change_noop ();
|
||||
extern void config_change_title ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
extern void *config_get_server_option_ptr (t_irc_server *, char *);
|
||||
extern int config_set_server_value (t_irc_server *, char *, char *);
|
||||
extern int config_read ();
|
||||
extern int config_create_default ();
|
||||
extern void config_write ();
|
||||
extern int config_write ();
|
||||
|
||||
#endif /* config.h */
|
||||
#endif /* weeconfig.h */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weelist.c: sorted lists management */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weelist.h"
|
||||
|
||||
|
||||
/*
|
||||
* weelist_search: search date in a list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_search (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) == 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* word not found in list */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_find_pos: find position for data (keeping list sorted)
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_find_pos (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) < 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* position not found, best position is at the end */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_insert: insert an element to the list (at good position)
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *pos_weelist;
|
||||
|
||||
pos_weelist = weelist_find_pos (*weelist, element->data);
|
||||
|
||||
if (*weelist)
|
||||
{
|
||||
if (pos_weelist)
|
||||
{
|
||||
/* insert data into the list (before position found) */
|
||||
element->prev_weelist = pos_weelist->prev_weelist;
|
||||
element->next_weelist = pos_weelist;
|
||||
if (pos_weelist->prev_weelist)
|
||||
pos_weelist->prev_weelist->next_weelist = element;
|
||||
else
|
||||
*weelist = element;
|
||||
pos_weelist->prev_weelist = element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add data to the end */
|
||||
element->prev_weelist = *last_weelist;
|
||||
element->next_weelist = NULL;
|
||||
(*last_weelist)->next_weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element->prev_weelist = NULL;
|
||||
element->next_weelist = NULL;
|
||||
*weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_add: create new data and add it to list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
if (!data || (!data[0]))
|
||||
return NULL;
|
||||
|
||||
if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist)))))
|
||||
{
|
||||
new_weelist->data = strdup (data);
|
||||
weelist_insert (weelist, last_weelist, new_weelist);
|
||||
return new_weelist;
|
||||
}
|
||||
/* failed to allocate new element */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_remove: free an element in a list
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
/* remove element from list */
|
||||
if (*last_weelist == element)
|
||||
*last_weelist = element->prev_weelist;
|
||||
if (element->prev_weelist)
|
||||
{
|
||||
(element->prev_weelist)->next_weelist = element->next_weelist;
|
||||
new_weelist = *weelist;
|
||||
}
|
||||
else
|
||||
new_weelist = element->next_weelist;
|
||||
|
||||
if (element->next_weelist)
|
||||
(element->next_weelist)->prev_weelist = element->prev_weelist;
|
||||
|
||||
/* free data */
|
||||
if (element->data)
|
||||
free (element->data);
|
||||
free (element);
|
||||
*weelist = new_weelist;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_LIST_H
|
||||
#define __WEECHAT_LIST_H 1
|
||||
|
||||
typedef struct t_weelist t_weelist;
|
||||
|
||||
struct t_weelist
|
||||
{
|
||||
char *data;
|
||||
t_weelist *prev_weelist;
|
||||
t_weelist *next_weelist;
|
||||
};
|
||||
|
||||
t_weelist *weelist_search (t_weelist *, char *);
|
||||
t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
|
||||
void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
|
||||
|
||||
#endif /* weelist.h */
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* completion.c: completes words according to context (cmd/nick) */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "irc/irc.h"
|
||||
#include "command.h"
|
||||
|
||||
|
||||
/*
|
||||
* completion_init: init completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command: complete a command
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_index_command *ptr_index;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
{
|
||||
if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_index->command_name;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_index->command_name, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command (completion);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_nick (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_search: complete word according to context
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, pos_start, pos_end;
|
||||
char *old_word_found;
|
||||
|
||||
/* TODO: complete when no word is there with command according to context */
|
||||
if (size == 0)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if new complation => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
|
||||
if ((pos == size) || (buffer[pos-1] != ' '))
|
||||
pos--;
|
||||
if ((pos > 0) && (buffer[pos] == ' '))
|
||||
return;
|
||||
|
||||
i = pos;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
if (pos_start > pos_end)
|
||||
return;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
|
||||
if (completion->base_word[0] == '/')
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
if (completion->base_word[0] == '/')
|
||||
{
|
||||
completion_command (completion);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word) + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
{
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where we shoud complete */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word should be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
-1021
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# WeeChat with Curses interface
|
||||
ifeq ($(GUI), curses)
|
||||
curses: curses/gui.a
|
||||
curses/gui.a:
|
||||
cd curses && make
|
||||
endif
|
||||
|
||||
# WeeChat with Gtk+ interface
|
||||
ifeq ($(GUI), gtk)
|
||||
gtk: gtk/gui.a
|
||||
gtk/gui.a:
|
||||
cd gtk && make
|
||||
endif
|
||||
|
||||
# WeeChat with Qt interface
|
||||
ifeq ($(GUI), qt)
|
||||
qt: qt/gui.a
|
||||
qt/gui.a:
|
||||
cd qt && make
|
||||
endif
|
||||
|
||||
# WeeChat with Text interface
|
||||
ifeq ($(GUI), text)
|
||||
text: text/gui.a
|
||||
text/gui.a:
|
||||
cd text && make
|
||||
endif
|
||||
|
||||
|
||||
all:
|
||||
make curses GUI=curses
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
cd curses && make clean
|
||||
cd gtk && make clean
|
||||
cd qt && make clean
|
||||
cd text && make clean
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,17 +15,16 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
OUTPUT=weechat
|
||||
if GUI_NCURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
all:
|
||||
cd src && make
|
||||
if GUI_GTK
|
||||
gtk_dir=gtk
|
||||
endif
|
||||
|
||||
install:
|
||||
@mkdir -v -p $(DESTDIR)/usr/$(LOCALRPM)/bin
|
||||
@cp -v src/$(OUTPUT) $(DESTDIR)/usr/$(LOCALRPM)/bin/
|
||||
@mkdir -v -p $(DESTDIR)/usr/share/man/man1
|
||||
@cp -v weechat.1 $(DESTDIR)/usr/share/man/man1/
|
||||
@echo -e "\n=== WeeChat installed!\n"
|
||||
if GUI_QT
|
||||
qt_dir=qt
|
||||
endif
|
||||
|
||||
clean:
|
||||
cd src && make clean
|
||||
SUBDIRS = $(curses_dir) $(gtk_dir) $(qt_dir)
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../completion.h \
|
||||
../../history.h ../../config.h ../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h ../../completion.h \
|
||||
../../history.h ../../command.h ../../irc/irc.h ../../gui/gui.h
|
||||
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(NCURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_curses_SOURCES = ../gui.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
gui-input.c
|
||||
+1605
-971
File diff suppressed because it is too large
Load Diff
+574
-342
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = weechat-gtk
|
||||
|
||||
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(GTK_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_gtk_SOURCES = ../gui.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
gui-input.c
|
||||
@@ -0,0 +1,789 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-display.c: display functions for Gtk GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
t_gui_color gui_colors[] =
|
||||
{ { "default", 0 },
|
||||
{ "black", 0 },
|
||||
{ "red", 0 },
|
||||
{ "lightred", 0 },
|
||||
{ "green", 0 },
|
||||
{ "lightgreen", 0 },
|
||||
{ "brown", 0 },
|
||||
{ "yellow", 0 },
|
||||
{ "blue", 0 },
|
||||
{ "lightblue", 0 },
|
||||
{ "magenta", 0L },
|
||||
{ "lightmagenta", 0 },
|
||||
{ "cyan", 0 },
|
||||
{ "lightcyan", 0 },
|
||||
{ "gray", 0 },
|
||||
{ "white", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "gray",
|
||||
"lightcyan", "lightmagenta", "lightgreen", "blue" };
|
||||
|
||||
int color_attr[NUM_COLORS];
|
||||
|
||||
GtkWidget *gtk_main_window;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *entry_topic;
|
||||
GtkWidget *notebook1;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *scrolledwindow_chat;
|
||||
GtkWidget *scrolledwindow_nick;
|
||||
GtkWidget *entry_input;
|
||||
GtkWidget *label1;
|
||||
|
||||
|
||||
/*
|
||||
* gui_assign_color: assign a color (read from config)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_assign_color (int *color, char *color_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk colors in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
{
|
||||
*color = gui_colors[i].color;
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_color_by_name: get color by name
|
||||
*/
|
||||
|
||||
int
|
||||
gui_get_color_by_name (char *color_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
return gui_colors[i].color;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_color_by_value: get color name by value
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_get_color_by_value (int color_value)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look for Gtk colors in table */
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (gui_colors[i].color == color_value)
|
||||
return gui_colors[i].name;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* color not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_has_nicklist: returns 1 if window has nicklist
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_has_nicklist (t_gui_window *window)
|
||||
{
|
||||
return (window->textbuffer_nicklist != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_calculate_pos_size: calculate position and size for a window & sub-win
|
||||
*/
|
||||
|
||||
void
|
||||
gui_calculate_pos_size (t_gui_window *window)
|
||||
{
|
||||
/* TODO: write gui_calculate_pos_size for Gtk GUI */
|
||||
(void) window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_title: draw title window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_title (t_gui_window *window)
|
||||
{
|
||||
char format[32];
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
if (CHANNEL(window))
|
||||
{
|
||||
sprintf (format, "%%-%ds", window->win_width);
|
||||
/* TODO: display topic */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: display title for server window */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_title: redraw title window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_title (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_title (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_get_line_num_splits: returns number of lines on window
|
||||
* (depending on window width and type (server/channel)
|
||||
* for alignment)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
|
||||
{
|
||||
int length, width;
|
||||
|
||||
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
|
||||
if (line->length_align >= window->win_chat_width - 5)
|
||||
{
|
||||
length = line->length;
|
||||
width = window->win_chat_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
length = line->length - line->length_align;
|
||||
width = window->win_chat_width - line->length_align;
|
||||
}
|
||||
|
||||
return (length % width == 0) ? (length / width) : ((length / width) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_end_of_line: display end of a line in the chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||
{
|
||||
/* TODO: display end of line! */
|
||||
(void) window;
|
||||
(void) line;
|
||||
(void) count;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_display_line: display a line in the chat window
|
||||
* if stop_at_end == 1, screen will not scroll and then we
|
||||
* exit since chat window is full
|
||||
* returns: 1 if stop_at_end == 0 or screen not full
|
||||
* 0 if screen is full and if stop_at_end == 1
|
||||
*/
|
||||
|
||||
int
|
||||
gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
|
||||
{
|
||||
/* TODO: display line! */
|
||||
(void) window;
|
||||
(void) line;
|
||||
(void) stop_at_end;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_chat: draw chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_chat (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw chat window */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_chat: redraw chat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_chat (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_chat (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_nick: draw nick window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_nick (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: display nicklist for Gtk GUI */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_nick: redraw nick window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_nick (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_nick (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_status: draw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_status (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw status window! */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_status: redraw status window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_status (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_status (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_infobar: draw infobar window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_infobar (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw infobar window! */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_infobar: redraw infobar window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_infobar (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_infobar (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_input: draw input window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_input (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: draw input window */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window_input: redraw input window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window_input (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
/* TODO: first delete window content */
|
||||
gui_draw_window_input (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_redraw_window: redraw a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_redraw_window (t_gui_window *window)
|
||||
{
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
return;
|
||||
|
||||
gui_redraw_window_title (window);
|
||||
gui_redraw_window_chat (window);
|
||||
if (gui_window_has_nicklist (window))
|
||||
gui_redraw_window_nick (window);
|
||||
gui_redraw_window_status (window);
|
||||
gui_redraw_window_input (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_window: switch to another window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_window (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
GtkTextIter start, end;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->is_displayed)
|
||||
{
|
||||
/* TODO: manage splitted windows */
|
||||
ptr_win->is_displayed = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_calculate_pos_size (window);
|
||||
|
||||
if (!window->textview_chat)
|
||||
{
|
||||
window->textview_chat = gtk_text_view_new ();
|
||||
gtk_widget_show (window->textview_chat);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), window->textview_chat);
|
||||
gtk_widget_set_size_request (window->textview_chat, 300, -1);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||
|
||||
window->textbuffer_chat = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_chat), window->textbuffer_chat);
|
||||
|
||||
window->texttag_chat = gtk_text_buffer_create_tag(window->textbuffer_chat, "courier", "font_family", "lucida");
|
||||
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||
}
|
||||
if (WIN_IS_CHANNEL (window) && !window->textbuffer_nicklist)
|
||||
{
|
||||
|
||||
window->textview_nicklist = gtk_text_view_new ();
|
||||
gtk_widget_show (window->textview_nicklist);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), window->textview_nicklist);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||
|
||||
window->textbuffer_nicklist = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_nicklist), window->textbuffer_nicklist);
|
||||
}
|
||||
|
||||
/* change current window to the new window */
|
||||
gui_current_window = window;
|
||||
|
||||
window->is_displayed = 1;
|
||||
window->unread_data = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_previous_window: switch to previous window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_previous_window ()
|
||||
{
|
||||
/* if only one windows then return */
|
||||
if (gui_windows == last_gui_window)
|
||||
return;
|
||||
|
||||
if (gui_current_window->prev_window)
|
||||
gui_switch_to_window (gui_current_window->prev_window);
|
||||
else
|
||||
gui_switch_to_window (last_gui_window);
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_next_window: switch to next window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_switch_to_next_window ()
|
||||
{
|
||||
/* if only one windows then return */
|
||||
if (gui_windows == last_gui_window)
|
||||
return;
|
||||
|
||||
if (gui_current_window->next_window)
|
||||
gui_switch_to_window (gui_current_window->next_window);
|
||||
else
|
||||
gui_switch_to_window (gui_windows);
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_page_up: display previous page on window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_page_up ()
|
||||
{
|
||||
if (!gui_current_window->first_line_displayed)
|
||||
{
|
||||
gui_current_window->sub_lines += gui_current_window->win_chat_height - 1;
|
||||
gui_redraw_window_chat (gui_current_window);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_page_down: display next page on window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_page_down ()
|
||||
{
|
||||
if (gui_current_window->sub_lines > 0)
|
||||
{
|
||||
gui_current_window->sub_lines -= gui_current_window->win_chat_height - 1;
|
||||
if (gui_current_window->sub_lines < 0)
|
||||
gui_current_window->sub_lines = 0;
|
||||
if (gui_current_window->sub_lines == 0)
|
||||
gui_current_window->unread_data = 0;
|
||||
gui_redraw_window_chat (gui_current_window);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_gtk_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_gtk_resize_handler ()
|
||||
{
|
||||
/* TODO: write resize handler for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_init_subwindows: init subwindows for a WeeChat window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_init_subwindows (t_gui_window *window)
|
||||
{
|
||||
window->textview_chat = NULL;
|
||||
window->textbuffer_chat = NULL;
|
||||
window->texttag_chat = NULL;
|
||||
window->textview_nicklist = NULL;
|
||||
window->textbuffer_nicklist = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_pre_init (int *argc, char **argv[])
|
||||
{
|
||||
/* Initialise Gtk+ */
|
||||
gtk_init (argc, argv);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_init_colors: init GUI colors
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init_colors ()
|
||||
{
|
||||
/* TODO: init colors for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_set_window_title: set window title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_set_window_title ()
|
||||
{
|
||||
/* TODO: set window title for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_init: init GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init ()
|
||||
{
|
||||
gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (gtk_main_window), PACKAGE_STRING);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_container_add (GTK_CONTAINER (gtk_main_window), vbox1);
|
||||
|
||||
entry_topic = gtk_entry_new ();
|
||||
gtk_widget_show (entry_topic);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), entry_topic, FALSE, FALSE, 0);
|
||||
|
||||
notebook1 = gtk_notebook_new ();
|
||||
gtk_widget_show (notebook1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook1), GTK_POS_BOTTOM);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
scrolledwindow_chat = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow_chat);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_chat, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_chat), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow_nick);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_nick, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_nick), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
entry_input = gtk_entry_new ();
|
||||
gtk_widget_show (entry_input);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), entry_input, FALSE, FALSE, 0);
|
||||
|
||||
label1 = gtk_label_new (_("server"));
|
||||
gtk_widget_show (label1);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
|
||||
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
|
||||
|
||||
gtk_widget_show_all (gtk_main_window);
|
||||
|
||||
/* create a new window */
|
||||
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
|
||||
|
||||
/* TODO: set gui_ready to 1 when Gtk display functions will be ok */
|
||||
gui_ready = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_end: GUI end
|
||||
*/
|
||||
|
||||
void
|
||||
gui_end ()
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
/* delete all windows */
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
/* TODO: delete Gtk windows */
|
||||
/* TODO: free input buffer, lines, messages, completion */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_add_message: add a message to a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_add_message (t_gui_window *window, int type, int color, char *message)
|
||||
{
|
||||
char *pos;
|
||||
int length;
|
||||
GtkTextIter start, end;
|
||||
|
||||
/* create new line if previous was ending by '\n' (or if 1st line) */
|
||||
if (window->line_complete)
|
||||
{
|
||||
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, "\n", -1);
|
||||
window->line_complete = 0;
|
||||
}
|
||||
|
||||
pos = strchr (message, '\n');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
window->line_complete = 1;
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, message, -1);
|
||||
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||
|
||||
if (pos)
|
||||
pos[0] = '\n';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_printf_color_type: display a message in a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_printf_color_type (t_gui_window *window, int type, int color, char *message, ...)
|
||||
{
|
||||
static char buffer[8192];
|
||||
char timestamp[16];
|
||||
char *pos;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (gui_ready)
|
||||
{
|
||||
if (color == -1)
|
||||
color = COLOR_WIN_CHAT;
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
if (SERVER(gui_current_window))
|
||||
window = SERVER(gui_current_window)->window;
|
||||
else
|
||||
window = gui_current_window;
|
||||
}
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
wee_log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (gui_ready)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buffer - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
if (window->line_complete)
|
||||
{
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_hour);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_min);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
|
||||
sprintf (timestamp, "%02d", date_tmp->tm_sec);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
|
||||
}
|
||||
gui_add_message (window, type, color, pos + 1);
|
||||
pos = strchr (pos + 1, '\n');
|
||||
if (pos && !pos[1])
|
||||
pos = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_print ("%s", buffer);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-input: user input functions for Gtk GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
*/
|
||||
|
||||
void
|
||||
gui_read_keyb ()
|
||||
{
|
||||
/* TODO: read keyboard for Gtk GUI */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with Gtk GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
/* TODO: main loop function for Gtk GUI */
|
||||
gtk_main ();
|
||||
}
|
||||
@@ -0,0 +1,809 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* gui-common.c: display functions, used by any GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <curses.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "gui.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../common/hotlist.h"
|
||||
#include "../common/log.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
int gui_init_ok = 0; /* = 1 if GUI is initialized */
|
||||
int gui_ok = 0; /* = 1 if GUI is ok */
|
||||
/* (0 when term size too small) */
|
||||
|
||||
t_gui_window *gui_windows = NULL; /* pointer to first window */
|
||||
t_gui_window *last_gui_window = NULL; /* pointer to last window */
|
||||
t_gui_window *gui_current_window = NULL; /* pointer to current window */
|
||||
|
||||
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
|
||||
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
|
||||
t_gui_buffer *buffer_before_dcc = NULL; /* buffer before dcc switch */
|
||||
t_gui_infobar *gui_infobar; /* pointer to infobar content */
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_new: create a new window
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_window_new (int x, int y, int width, int height)
|
||||
{
|
||||
t_gui_window *new_window;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
||||
{
|
||||
new_window->win_x = x;
|
||||
new_window->win_y = y;
|
||||
new_window->win_width = width;
|
||||
new_window->win_height = height;
|
||||
|
||||
new_window->win_chat_x = 0;
|
||||
new_window->win_chat_y = 0;
|
||||
new_window->win_chat_width = 0;
|
||||
new_window->win_chat_height = 0;
|
||||
new_window->win_chat_cursor_x = 0;
|
||||
new_window->win_chat_cursor_y = 0;
|
||||
|
||||
new_window->win_nick_x = 0;
|
||||
new_window->win_nick_y = 0;
|
||||
new_window->win_nick_width = 0;
|
||||
new_window->win_nick_height = 0;
|
||||
|
||||
new_window->win_title = NULL;
|
||||
new_window->win_chat = NULL;
|
||||
new_window->win_nick = NULL;
|
||||
new_window->win_status = NULL;
|
||||
new_window->win_infobar = NULL;
|
||||
new_window->win_input = NULL;
|
||||
new_window->win_separator = NULL;
|
||||
|
||||
new_window->textview_chat = NULL;
|
||||
new_window->textbuffer_chat = NULL;
|
||||
new_window->texttag_chat = NULL;
|
||||
new_window->textview_nicklist = NULL;
|
||||
new_window->textbuffer_nicklist = NULL;
|
||||
|
||||
new_window->dcc_first = NULL;
|
||||
new_window->dcc_selected = NULL;
|
||||
new_window->dcc_last_displayed = NULL;
|
||||
|
||||
new_window->buffer = NULL;
|
||||
|
||||
new_window->first_line_displayed = 0;
|
||||
new_window->sub_lines = 0;
|
||||
|
||||
/* add window to windows queue */
|
||||
new_window->prev_window = last_gui_window;
|
||||
if (gui_windows)
|
||||
last_gui_window->next_window = new_window;
|
||||
else
|
||||
gui_windows = new_window;
|
||||
last_gui_window = new_window;
|
||||
new_window->next_window = NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return new_window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_gui_buffer *new_buffer;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new buffer\n");
|
||||
#endif
|
||||
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
if (!dcc && gui_buffers && (!SERVER(gui_buffers)))
|
||||
{
|
||||
if (server)
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
gui_buffers->server = server;
|
||||
gui_buffers->channel = channel;
|
||||
if (cfg_log_auto_server)
|
||||
log_start (gui_buffers);
|
||||
return gui_buffers;
|
||||
}
|
||||
|
||||
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
|
||||
{
|
||||
new_buffer->num_displayed = 0;
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
new_buffer->server = server;
|
||||
new_buffer->channel = channel;
|
||||
new_buffer->dcc = dcc;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_buffer)->buffer = new_buffer;
|
||||
if (channel)
|
||||
CHANNEL(new_buffer)->buffer = new_buffer;
|
||||
|
||||
if (!window->buffer)
|
||||
{
|
||||
window->buffer = new_buffer;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
gui_calculate_pos_size (window);
|
||||
gui_window_init_subwindows (window);
|
||||
}
|
||||
|
||||
/* init lines */
|
||||
new_buffer->lines = NULL;
|
||||
new_buffer->last_line = NULL;
|
||||
new_buffer->num_lines = 0;
|
||||
new_buffer->line_complete = 1;
|
||||
|
||||
/* notify level */
|
||||
new_buffer->notify_level = 3;
|
||||
|
||||
/* create/append to log file */
|
||||
new_buffer->log_filename = NULL;
|
||||
new_buffer->log_file = NULL;
|
||||
if ((cfg_log_auto_server && BUFFER_IS_SERVER(new_buffer))
|
||||
|| (cfg_log_auto_channel && BUFFER_IS_CHANNEL(new_buffer))
|
||||
|| (cfg_log_auto_private && BUFFER_IS_PRIVATE(new_buffer)))
|
||||
log_start (new_buffer);
|
||||
|
||||
/* init input buffer */
|
||||
new_buffer->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_buffer->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_buffer->input_buffer[0] = '\0';
|
||||
new_buffer->input_buffer_size = 0;
|
||||
new_buffer->input_buffer_pos = 0;
|
||||
new_buffer->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_buffer->completion));
|
||||
|
||||
/* init history */
|
||||
new_buffer->history = NULL;
|
||||
new_buffer->last_history = NULL;
|
||||
new_buffer->ptr_history = NULL;
|
||||
new_buffer->num_history = 0;
|
||||
|
||||
/* add buffer to buffers queue */
|
||||
new_buffer->prev_buffer = last_gui_buffer;
|
||||
if (gui_buffers)
|
||||
last_gui_buffer->next_buffer = new_buffer;
|
||||
else
|
||||
gui_buffers = new_buffer;
|
||||
last_gui_buffer = new_buffer;
|
||||
new_buffer->next_buffer = NULL;
|
||||
|
||||
/* switch to new buffer */
|
||||
if (switch_to_buffer)
|
||||
gui_switch_to_buffer (window, new_buffer);
|
||||
|
||||
/* redraw buffer */
|
||||
gui_redraw_buffer (new_buffer);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return new_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear: clear buffer content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
while (buffer->lines->messages)
|
||||
{
|
||||
ptr_message = buffer->lines->messages->next_message;
|
||||
if (buffer->lines->messages->message)
|
||||
free (buffer->lines->messages->message);
|
||||
free (buffer->lines->messages);
|
||||
buffer->lines->messages = ptr_message;
|
||||
}
|
||||
free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
buffer->lines = NULL;
|
||||
buffer->last_line = NULL;
|
||||
buffer->num_lines = 0;
|
||||
buffer->line_complete = 1;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
{
|
||||
ptr_win->first_line_displayed = 1;
|
||||
ptr_win->sub_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear_all: clear all buffers content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear_all ()
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
gui_buffer_clear (ptr_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_infobar_printf: display message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
{
|
||||
static char buffer[1024];
|
||||
va_list argptr;
|
||||
t_gui_infobar *ptr_infobar;
|
||||
char *pos, *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buffer);
|
||||
|
||||
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
|
||||
if (ptr_infobar)
|
||||
{
|
||||
ptr_infobar->color = color;
|
||||
ptr_infobar->text = strdup (buf2);
|
||||
pos = strchr (ptr_infobar->text, '\n');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
|
||||
ptr_infobar->next_infobar = gui_infobar;
|
||||
gui_infobar = ptr_infobar;
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
WEECHAT_ERROR);
|
||||
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
if (window->next_window)
|
||||
window->next_window->prev_window = window->prev_window;
|
||||
if (gui_windows == window)
|
||||
gui_windows = window->next_window;
|
||||
if (last_gui_window == window)
|
||||
last_gui_window = window->prev_window;
|
||||
|
||||
free (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_infobar_remove: remove last displayed message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
gui_infobar_remove ()
|
||||
{
|
||||
t_gui_infobar *new_infobar;
|
||||
|
||||
if (gui_infobar)
|
||||
{
|
||||
new_infobar = gui_infobar->next_infobar;
|
||||
if (gui_infobar->text)
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_line_free: delete a line from a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_line_free (t_gui_line *line)
|
||||
{
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (line->messages)
|
||||
{
|
||||
ptr_message = line->messages->next_message;
|
||||
if (line->messages->message)
|
||||
free (line->messages->message);
|
||||
free (line->messages);
|
||||
line->messages = ptr_message;
|
||||
}
|
||||
free (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_free: delete a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_gui_line *ptr_line;
|
||||
int create_new;
|
||||
|
||||
create_new = (buffer->server || buffer->channel);
|
||||
|
||||
hotlist_remove_buffer (buffer);
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (buffer_before_dcc == buffer)
|
||||
buffer_before_dcc = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_switch_to_previous_buffer (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
/* decrease buffer number for all next buffers */
|
||||
for (ptr_buffer = buffer->next_buffer; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number--;
|
||||
}
|
||||
|
||||
/* free lines and messages */
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
/* close log if opened */
|
||||
if (buffer->log_file)
|
||||
log_end (buffer);
|
||||
|
||||
if (buffer->input_buffer)
|
||||
free (buffer->input_buffer);
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
history_buffer_free (buffer);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
if (buffer->next_buffer)
|
||||
buffer->next_buffer->prev_buffer = buffer->prev_buffer;
|
||||
if (gui_buffers == buffer)
|
||||
gui_buffers = buffer->next_buffer;
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
if (!gui_buffers && create_new && switch_to_another)
|
||||
(void) gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
new_line->last_message = NULL;
|
||||
if (!buffer->lines)
|
||||
buffer->lines = new_line;
|
||||
else
|
||||
buffer->last_line->next_line = new_line;
|
||||
new_line->prev_line = buffer->last_line;
|
||||
new_line->next_line = NULL;
|
||||
buffer->last_line = new_line;
|
||||
buffer->num_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for new line!\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove one line if necessary */
|
||||
if ((cfg_history_max_lines > 0)
|
||||
&& (buffer->num_lines > cfg_history_max_lines))
|
||||
{
|
||||
if (buffer->last_line == buffer->lines)
|
||||
buffer->last_line = NULL;
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
return new_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_message: create a new message for last line of a buffer
|
||||
*/
|
||||
|
||||
t_gui_message *
|
||||
gui_new_message (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_message *new_message;
|
||||
|
||||
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
||||
{
|
||||
if (!buffer->last_line->messages)
|
||||
buffer->last_line->messages = new_message;
|
||||
else
|
||||
buffer->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = buffer->last_line->last_message;
|
||||
new_message->next_message = NULL;
|
||||
buffer->last_line->last_message = new_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("not enough memory!\n"));
|
||||
return NULL;
|
||||
}
|
||||
return new_message;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_optimize_input_buffer_size: optimize input buffer size by adding
|
||||
* or deleting data block (predefined size)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_optimize_input_buffer_size (t_gui_buffer *buffer)
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = ((buffer->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
||||
if (buffer->input_buffer_alloc != optimal_size)
|
||||
{
|
||||
buffer->input_buffer_alloc = optimal_size;
|
||||
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_delete_previous_word: delete previous word
|
||||
*/
|
||||
|
||||
void
|
||||
gui_delete_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i, j, num_char_deleted, num_char_end;
|
||||
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0)
|
||||
i++;
|
||||
i++;
|
||||
num_char_deleted = buffer->input_buffer_pos - i;
|
||||
num_char_end = buffer->input_buffer_size -
|
||||
buffer->input_buffer_pos;
|
||||
|
||||
for (j = 0; j < num_char_end; j++)
|
||||
buffer->input_buffer[i + j] =
|
||||
buffer->input_buffer[buffer->input_buffer_pos + j];
|
||||
|
||||
buffer->input_buffer_size -= num_char_deleted;
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_pos = i;
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_previous_word: move to beginning of previous word
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i < 0)
|
||||
buffer->input_buffer_pos = 0;
|
||||
else
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
buffer->input_buffer_pos = i + 1;
|
||||
}
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_move_next_word: move to the end of next
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_next_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (buffer->input_buffer_pos <
|
||||
buffer->input_buffer_size + 1)
|
||||
{
|
||||
i = buffer->input_buffer_pos;
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i++;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos = i - 1;
|
||||
else
|
||||
{
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i++;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos =
|
||||
buffer->input_buffer_size;
|
||||
else
|
||||
buffer->input_buffer_pos = i;
|
||||
|
||||
}
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_insert_string: insert a string into the input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_insert_string (t_gui_buffer *buffer, char *string, int pos)
|
||||
{
|
||||
int i, start, end, length;
|
||||
|
||||
length = strlen (string);
|
||||
|
||||
/* increase buffer size */
|
||||
buffer->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
|
||||
/* move end of string to the right */
|
||||
start = pos + length;
|
||||
end = buffer->input_buffer_size - 1;
|
||||
for (i = end; i >= start; i--)
|
||||
buffer->input_buffer[i] =
|
||||
buffer->input_buffer[i - length];
|
||||
|
||||
/* insert new string */
|
||||
strncpy (buffer->input_buffer + pos, string, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* buffer is currently displayed ? */
|
||||
if (number == window->buffer->number)
|
||||
return window->buffer;
|
||||
|
||||
/* search for buffer in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
|
||||
{
|
||||
gui_switch_to_buffer (window, ptr_buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return ptr_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_buffer_to_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
int i;
|
||||
|
||||
/* buffer number is already ok ? */
|
||||
if (number == window->buffer->number)
|
||||
return;
|
||||
|
||||
if (number < 1)
|
||||
number = 1;
|
||||
|
||||
/* remove buffer from list */
|
||||
if (window->buffer == gui_buffers)
|
||||
{
|
||||
gui_buffers = window->buffer->next_buffer;
|
||||
gui_buffers->prev_buffer = NULL;
|
||||
}
|
||||
if (window->buffer == last_gui_buffer)
|
||||
{
|
||||
last_gui_buffer = window->buffer->prev_buffer;
|
||||
last_gui_buffer->next_buffer = NULL;
|
||||
}
|
||||
if (window->buffer->prev_buffer)
|
||||
(window->buffer->prev_buffer)->next_buffer = window->buffer->next_buffer;
|
||||
if (window->buffer->next_buffer)
|
||||
(window->buffer->next_buffer)->prev_buffer = window->buffer->prev_buffer;
|
||||
|
||||
if (number == 1)
|
||||
{
|
||||
gui_buffers->prev_buffer = window->buffer;
|
||||
window->buffer->prev_buffer = NULL;
|
||||
window->buffer->next_buffer = gui_buffers;
|
||||
gui_buffers = window->buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* assign new number to all buffers */
|
||||
i = 1;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number = i++;
|
||||
}
|
||||
|
||||
/* search for new position in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->number == number)
|
||||
break;
|
||||
}
|
||||
if (ptr_buffer)
|
||||
{
|
||||
/* insert before buffer found */
|
||||
window->buffer->prev_buffer = ptr_buffer->prev_buffer;
|
||||
window->buffer->next_buffer = ptr_buffer;
|
||||
if (ptr_buffer->prev_buffer)
|
||||
(ptr_buffer->prev_buffer)->next_buffer = window->buffer;
|
||||
ptr_buffer->prev_buffer = window->buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* number not found (too big)? => add to end */
|
||||
window->buffer->prev_buffer = last_gui_buffer;
|
||||
window->buffer->next_buffer = NULL;
|
||||
last_gui_buffer->next_buffer = window->buffer;
|
||||
last_gui_buffer = window->buffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* assign new number to all buffers */
|
||||
i = 1;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number = i++;
|
||||
}
|
||||
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
+204
-123
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,66 +21,71 @@
|
||||
#ifndef __WEECHAT_GUI_H
|
||||
#define __WEECHAT_GUI_H 1
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "../completion.h"
|
||||
#include "../history.h"
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#define KEY_ESCAPE 27
|
||||
#endif
|
||||
#include "../common/completion.h"
|
||||
#include "../common/history.h"
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 35
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_STATUS 11
|
||||
#define COLOR_WIN_STATUS_ACTIVE 12
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 13
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 14
|
||||
#define COLOR_WIN_STATUS_MORE 15
|
||||
#define COLOR_WIN_INPUT 16
|
||||
#define COLOR_WIN_INPUT_CHANNEL 17
|
||||
#define COLOR_WIN_INPUT_NICK 18
|
||||
#define COLOR_WIN_NICK 19
|
||||
#define COLOR_WIN_NICK_OP 20
|
||||
#define COLOR_WIN_NICK_HALFOP 21
|
||||
#define COLOR_WIN_NICK_VOICE 22
|
||||
#define COLOR_WIN_NICK_SEP 23
|
||||
#define COLOR_WIN_NICK_SELF 24
|
||||
#define COLOR_WIN_NICK_PRIVATE 25
|
||||
#define COLOR_WIN_NICK_FIRST 26
|
||||
#define COLOR_WIN_NICK_LAST 35
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define NUM_COLORS 47
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_DELIMITERS 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 16
|
||||
#define COLOR_WIN_STATUS_MORE 17
|
||||
#define COLOR_WIN_INFOBAR 18
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
|
||||
#define COLOR_WIN_INPUT 20
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_OP 25
|
||||
#define COLOR_WIN_NICK_HALFOP 26
|
||||
#define COLOR_WIN_NICK_VOICE 27
|
||||
#define COLOR_WIN_NICK_SEP 28
|
||||
#define COLOR_WIN_NICK_SELF 29
|
||||
#define COLOR_WIN_NICK_PRIVATE 30
|
||||
#define COLOR_WIN_NICK_FIRST 31
|
||||
#define COLOR_WIN_NICK_LAST 40
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 41
|
||||
#define COLOR_DCC_WAITING 42
|
||||
#define COLOR_DCC_CONNECTING 43
|
||||
#define COLOR_DCC_ACTIVE 44
|
||||
#define COLOR_DCC_DONE 45
|
||||
#define COLOR_DCC_FAILED 46
|
||||
#define COLOR_DCC_ABORTED 47
|
||||
|
||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||
#define CHANNEL(window) ((t_irc_channel *)(window->channel))
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define WIN_IS_SERVER(window) (SERVER(window) && !CHANNEL(window))
|
||||
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
|
||||
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 0
|
||||
#define MSG_TYPE_NICK 1
|
||||
#define MSG_TYPE_INFO 2
|
||||
#define MSG_TYPE_MSG 3
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_NICK 2
|
||||
#define MSG_TYPE_INFO 4
|
||||
#define MSG_TYPE_MSG 8
|
||||
#define MSG_TYPE_HIGHLIGHT 16
|
||||
|
||||
#define gui_printf_color(window, color, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
|
||||
#define gui_printf(window, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -102,6 +105,7 @@ struct t_gui_line
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
t_gui_message *messages; /* messages for the line */
|
||||
t_gui_message *last_message; /* last message of the line */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
@@ -116,14 +120,72 @@ struct t_gui_color
|
||||
int color;
|
||||
};
|
||||
|
||||
typedef struct t_gui_infobar t_gui_infobar;
|
||||
|
||||
struct t_gui_infobar
|
||||
{
|
||||
int color; /* text color */
|
||||
char *text; /* infobar text */
|
||||
int remaining_time; /* delay (sec) before erasing this text */
|
||||
/* if < 0, text is never erased (except */
|
||||
/* by user action to erase it) */
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_buffer t_gui_buffer;
|
||||
|
||||
struct t_gui_buffer
|
||||
{
|
||||
int num_displayed; /* number of windows displaying buffer */
|
||||
|
||||
int number; /* buffer number (for jump/switch) */
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* buffer's server */
|
||||
void *channel; /* buffer's channel */
|
||||
int dcc; /* buffer is dcc status */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
int num_lines; /* number of lines in the window */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
|
||||
/* notify level: when activity should be displayed? default: 3 (always) */
|
||||
int notify_level; /* 0 = never */
|
||||
/* 1 = highlight only */
|
||||
/* 2 = highlight + message */
|
||||
/* 3 = highlight + message + join/part */
|
||||
|
||||
/* file to save buffer content */
|
||||
char *log_filename; /* filename for saving buffer content */
|
||||
FILE *log_file; /* for logging buffer to file */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *last_history; /* last command in history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
int num_history; /* number of commands in history */
|
||||
|
||||
/* link to previous/next buffer */
|
||||
t_gui_buffer *prev_buffer; /* link to previous buffer */
|
||||
t_gui_buffer *next_buffer; /* link to next buffer */
|
||||
};
|
||||
|
||||
typedef struct t_gui_window t_gui_window;
|
||||
|
||||
struct t_gui_window
|
||||
{
|
||||
/* server/channel */
|
||||
void *server; /* window's server */
|
||||
void *channel; /* window's channel */
|
||||
|
||||
/* global position & size */
|
||||
int win_x, win_y; /* position of window */
|
||||
int win_width, win_height; /* window geometry */
|
||||
@@ -140,90 +202,109 @@ struct t_gui_window
|
||||
int win_nick_width; /* width of chat window */
|
||||
int win_nick_height; /* height of chat window */
|
||||
|
||||
/* windows */
|
||||
#ifdef WEE_CURSES
|
||||
WINDOW *win_title; /* title window */
|
||||
WINDOW *win_chat; /* chat window (exemple: channel) */
|
||||
WINDOW *win_nick; /* nick window */
|
||||
WINDOW *win_status; /* status window */
|
||||
WINDOW *win_input; /* input window */
|
||||
#endif
|
||||
#ifdef WEE_GTK
|
||||
/* TODO: declare Gtk+ window */
|
||||
#endif
|
||||
#ifdef WEE_QT
|
||||
/* TODO: declare Qt window */
|
||||
#endif
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (example: channel) */
|
||||
void *win_nick; /* nick window */
|
||||
void *win_status; /* status window */
|
||||
void *win_infobar; /* info bar window */
|
||||
void *win_input; /* input window */
|
||||
void *win_separator; /* separation between 2 splited (V) win */
|
||||
|
||||
/* windows for Gtk GUI */
|
||||
void *textview_chat; /* textview widget for chat */
|
||||
void *textbuffer_chat; /* textbuffer widget for chat */
|
||||
void *texttag_chat; /* texttag widget for chat */
|
||||
void *textview_nicklist; /* textview widget for nicklist */
|
||||
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
|
||||
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
/* DCC */
|
||||
void *dcc_first; /* first dcc displayed */
|
||||
void *dcc_selected; /* selected dcc */
|
||||
void *dcc_last_displayed; /* last dcc displayed (for scroll) */
|
||||
|
||||
t_gui_buffer *buffer; /* buffer currently displayed in window */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
int unread_data; /* highlight windows with unread data */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
|
||||
/* link to next window */
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
};
|
||||
|
||||
/* variables */
|
||||
|
||||
extern int gui_ready;
|
||||
extern int gui_init_ok;
|
||||
extern int gui_ok;
|
||||
extern t_gui_window *gui_windows;
|
||||
extern t_gui_window *last_gui_window;
|
||||
extern t_gui_window *gui_current_window;
|
||||
extern t_gui_buffer *gui_buffers;
|
||||
extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_buffer *buffer_before_dcc;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
/* GUI independent functions */
|
||||
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_message *gui_new_message (t_gui_buffer *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_delete_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, int);
|
||||
|
||||
/* GUI dependant functions */
|
||||
|
||||
extern int gui_assign_color (int *, char *);
|
||||
extern int gui_get_color_by_name (char *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
|
||||
extern void gui_draw_window_title (t_gui_window *);
|
||||
extern void gui_redraw_window_title (t_gui_window *);
|
||||
extern void gui_draw_window_chat (t_gui_window *);
|
||||
extern void gui_redraw_window_chat (t_gui_window *);
|
||||
extern void gui_draw_window_nick (t_gui_window *);
|
||||
extern void gui_redraw_window_nick (t_gui_window *);
|
||||
extern void gui_draw_window_status (t_gui_window *);
|
||||
extern void gui_redraw_window_status (t_gui_window *);
|
||||
extern void gui_draw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window (t_gui_window *);
|
||||
|
||||
extern void gui_window_clear (t_gui_window *);
|
||||
extern void gui_window_clear_all ();
|
||||
|
||||
extern void gui_switch_to_window (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window ();
|
||||
extern void gui_switch_to_next_window ();
|
||||
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_get_dcc_buffer ();
|
||||
extern void gui_switch_to_dcc_buffer ();
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
|
||||
extern void gui_curses_resize_handler ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern int gui_window_merge_up (t_gui_window *);
|
||||
extern int gui_window_merge_down (t_gui_window *);
|
||||
extern int gui_window_merge_left (t_gui_window *);
|
||||
extern int gui_window_merge_right (t_gui_window *);
|
||||
extern void gui_window_merge_auto (t_gui_window *);
|
||||
extern void gui_window_merge_all (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
/* TODO: add coordinates and size */
|
||||
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
|
||||
extern void gui_display_nick (t_gui_window *, void *, int, int, int, int);
|
||||
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* gui-text.c: text GUI - display functions */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "gui-text.h"
|
||||
#include "command.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_init: init GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_init_irc_window: allocates a window for a channel or server
|
||||
*/
|
||||
|
||||
void
|
||||
gui_init_irc_window (t_irc_window * window)
|
||||
{
|
||||
/* no window in text GUI */
|
||||
window->text = NULL;
|
||||
window->window = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_free_irc_window: free a GUI window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_free_irc_window (t_irc_window * window)
|
||||
{
|
||||
/* no window in text GUI */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_end: GUI end
|
||||
*/
|
||||
|
||||
void
|
||||
gui_end ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* read_keyb: read keyboard line
|
||||
*/
|
||||
|
||||
void
|
||||
read_keyb ()
|
||||
{
|
||||
int num_read;
|
||||
static char buffer[4096];
|
||||
static int pos_buffer = 0;
|
||||
char buffer_tmp[1024];
|
||||
int pos_buffer_tmp;
|
||||
|
||||
num_read = read (STDIN_FILENO, buffer_tmp, sizeof (buffer_tmp) - 1);
|
||||
pos_buffer_tmp = 0;
|
||||
while (pos_buffer_tmp < num_read)
|
||||
{
|
||||
switch (buffer_tmp[pos_buffer_tmp])
|
||||
{
|
||||
case '\r':
|
||||
break;
|
||||
case '\n':
|
||||
buffer[pos_buffer] = '\0';
|
||||
pos_buffer = 0;
|
||||
user_command (buffer);
|
||||
break;
|
||||
default:
|
||||
buffer[pos_buffer] = buffer_tmp[pos_buffer_tmp];
|
||||
if (pos_buffer < (int) (sizeof (buffer) - 2))
|
||||
pos_buffer++;
|
||||
}
|
||||
pos_buffer_tmp++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with text GUI
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_loop ()
|
||||
{
|
||||
struct timeval timeout;
|
||||
fd_set read_fd;
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
quit_weechat = 0;
|
||||
while (!quit_weechat)
|
||||
{
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 10000;
|
||||
FD_ZERO (&read_fd);
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
}
|
||||
select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout);
|
||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
||||
{
|
||||
read_keyb ();
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (FD_ISSET (ptr_server->sock4, &read_fd))
|
||||
recv_from_server (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_display_message: display a message on the screen
|
||||
*/
|
||||
|
||||
void
|
||||
gui_display_message (char *message)
|
||||
{
|
||||
printf ("%s\n", message);
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *window, char *string)
|
||||
{
|
||||
t_history *new_history;
|
||||
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
/* add history to general history */
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
|
||||
/* add history to local history */
|
||||
if (((t_gui_window *)(window))->history)
|
||||
((t_gui_window *)(window))->history->prev_history = new_history;
|
||||
new_history->next_history = ((t_gui_window *)(window))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_window *)window)->history = new_history;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
|
||||
OUTPUT=irc.a
|
||||
OBJS=irc-commands.o irc-display.o irc-server.o irc-channel.o irc-nick.o
|
||||
DEFINES=WEE_CURSES
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
|
||||
irc-channel.o: irc-channel.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
irc-commands.o: irc-commands.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h ../command.h ../irc/irc.h ../config.h
|
||||
irc-display.o: irc-display.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
irc-nick.o: irc-nick.c ../weechat.h irc.h ../gui/gui.h ../completion.h \
|
||||
../history.h
|
||||
irc-server.o: irc-server.c ../weechat.h irc.h ../gui/gui.h \
|
||||
../completion.h ../history.h
|
||||
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_irc.a
|
||||
|
||||
lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-commands.c \
|
||||
irc-send.c \
|
||||
irc-recv.c \
|
||||
irc-server.c \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-display.c
|
||||
+66
-13
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,18 +17,21 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-channel.c: manages a chat (channel or private chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
t_irc_channel *current_channel = NULL;
|
||||
char *channel_modes = "iklmnst";
|
||||
|
||||
|
||||
/*
|
||||
@@ -38,13 +39,10 @@ t_irc_channel *current_channel = NULL;
|
||||
*/
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
#if DEBUG >= 1
|
||||
log_printf ("joining channel %s\n", channel_name);
|
||||
#endif
|
||||
|
||||
/* alloc memory for new channel */
|
||||
if ((new_channel = (t_irc_channel *) malloc (sizeof (t_irc_channel))) == NULL)
|
||||
@@ -57,6 +55,11 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
new_channel->type = channel_type;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
@@ -69,7 +72,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_window_new (server, new_channel);
|
||||
gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
@@ -151,3 +154,53 @@ string_is_channel (char *string)
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_check_away: check for away on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
+140
-2787
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,387 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* irc-dcc.c: DCC communications (files & chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../common/hotlist.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_dcc *dcc_list = NULL; /* DCC files & chat list */
|
||||
char *dcc_status_string[] = /* strings for DCC status */
|
||||
{ N_("Waiting"), N_("Connecting"), N_("Active"), N_("Done"), N_("Failed"),
|
||||
N_("Aborted") };
|
||||
|
||||
|
||||
/*
|
||||
* dcc_redraw: redraw DCC buffer (and add to hotlist)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_redraw (int highlight)
|
||||
{
|
||||
gui_redraw_buffer (gui_get_dcc_buffer ());
|
||||
if (highlight)
|
||||
{
|
||||
hotlist_add (highlight, gui_get_dcc_buffer ());
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_connect: connect to another host
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_connect (t_dcc *ptr_dcc)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
||||
ptr_dcc->status = DCC_CONNECTING;
|
||||
|
||||
ptr_dcc->sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (ptr_dcc->sock == -1)
|
||||
return;
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr.sin_port = htons (ptr_dcc->port);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
|
||||
fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK);
|
||||
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_send: send DCC request (file or chat)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_send ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_free: free DCC struct and remove it from list
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_free (t_dcc *ptr_dcc)
|
||||
{
|
||||
t_dcc *new_dcc_list;
|
||||
|
||||
if (ptr_dcc->prev_dcc)
|
||||
{
|
||||
(ptr_dcc->prev_dcc)->next_dcc = ptr_dcc->next_dcc;
|
||||
new_dcc_list = dcc_list;
|
||||
}
|
||||
else
|
||||
new_dcc_list = ptr_dcc->next_dcc;
|
||||
|
||||
if (ptr_dcc->next_dcc)
|
||||
(ptr_dcc->next_dcc)->prev_dcc = ptr_dcc->prev_dcc;
|
||||
|
||||
if (ptr_dcc->nick)
|
||||
free (ptr_dcc->nick);
|
||||
if (ptr_dcc->filename)
|
||||
free (ptr_dcc->filename);
|
||||
|
||||
free (ptr_dcc);
|
||||
dcc_list = new_dcc_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_close: close a DCC connection
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_close (t_dcc *ptr_dcc, int status)
|
||||
{
|
||||
ptr_dcc->status = status;
|
||||
if (ptr_dcc->sock != -1)
|
||||
{
|
||||
close (ptr_dcc->sock);
|
||||
ptr_dcc->sock = -1;
|
||||
}
|
||||
if (ptr_dcc->file != -1)
|
||||
{
|
||||
close (ptr_dcc->file);
|
||||
ptr_dcc->file = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_accept: accepts a DCC file or chat request
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_accept (t_dcc *ptr_dcc)
|
||||
{
|
||||
char *ptr_home, *filename2;
|
||||
|
||||
dcc_connect (ptr_dcc);
|
||||
if (ptr_dcc->sock == -1)
|
||||
ptr_dcc->status = DCC_FAILED;
|
||||
else
|
||||
{
|
||||
ptr_dcc->status = DCC_ACTIVE;
|
||||
ptr_home = getenv ("HOME");
|
||||
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
|
||||
strlen (ptr_dcc->nick) +
|
||||
strlen (ptr_dcc->filename) +
|
||||
((cfg_dcc_download_path[0] == '~') ?
|
||||
strlen (ptr_home) : 0) +
|
||||
4);
|
||||
if (!ptr_dcc->local_filename)
|
||||
{
|
||||
ptr_dcc->status = DCC_FAILED;
|
||||
dcc_redraw (1);
|
||||
return;
|
||||
}
|
||||
if (cfg_dcc_download_path[0] == '~')
|
||||
{
|
||||
strcpy (ptr_dcc->local_filename, ptr_home);
|
||||
strcat (ptr_dcc->local_filename, cfg_dcc_download_path + 1);
|
||||
}
|
||||
else
|
||||
strcpy (ptr_dcc->local_filename, cfg_dcc_download_path);
|
||||
if (ptr_dcc->local_filename[strlen (ptr_dcc->local_filename) - 1] != DIR_SEPARATOR_CHAR)
|
||||
strcat (ptr_dcc->local_filename, DIR_SEPARATOR);
|
||||
strcat (ptr_dcc->local_filename, ptr_dcc->nick);
|
||||
strcat (ptr_dcc->local_filename, ".");
|
||||
strcat (ptr_dcc->local_filename, ptr_dcc->filename);
|
||||
|
||||
/* file already exists? */
|
||||
if (access (ptr_dcc->local_filename, F_OK) == 0)
|
||||
{
|
||||
/* if auto rename is not set, then abort DCC */
|
||||
if (!cfg_dcc_auto_rename)
|
||||
{
|
||||
ptr_dcc->status = DCC_FAILED;
|
||||
dcc_redraw (1);
|
||||
return;
|
||||
}
|
||||
|
||||
filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
|
||||
if (!filename2)
|
||||
{
|
||||
ptr_dcc->status = DCC_FAILED;
|
||||
dcc_redraw (1);
|
||||
return;
|
||||
}
|
||||
ptr_dcc->filename_suffix = 0;
|
||||
do
|
||||
{
|
||||
ptr_dcc->filename_suffix++;
|
||||
sprintf (filename2, "%s.%d",
|
||||
ptr_dcc->local_filename,
|
||||
ptr_dcc->filename_suffix);
|
||||
}
|
||||
while (access (filename2, F_OK) == 0);
|
||||
|
||||
free (ptr_dcc->local_filename);
|
||||
ptr_dcc->local_filename = strdup (filename2);
|
||||
free (filename2);
|
||||
}
|
||||
ptr_dcc->file = open (ptr_dcc->local_filename,
|
||||
O_CREAT | O_TRUNC | O_WRONLY,
|
||||
0644);
|
||||
}
|
||||
dcc_redraw (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_add: add a DCC file to queue
|
||||
*/
|
||||
|
||||
t_dcc *
|
||||
dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, char *filename,
|
||||
unsigned int size)
|
||||
{
|
||||
t_dcc *new_dcc;
|
||||
|
||||
if ((new_dcc = (t_dcc *) malloc (sizeof (t_dcc))) == NULL)
|
||||
{
|
||||
gui_printf (NULL, _("%s not enough memory for new DCC\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
new_dcc->server = server;
|
||||
new_dcc->type = type;
|
||||
new_dcc->status = DCC_WAITING;
|
||||
new_dcc->addr = addr;
|
||||
new_dcc->port = port;
|
||||
new_dcc->nick = strdup (nick);
|
||||
new_dcc->sock = -1;
|
||||
new_dcc->file = -1;
|
||||
new_dcc->filename = strdup (filename);
|
||||
new_dcc->local_filename = NULL;
|
||||
new_dcc->filename_suffix = -1;
|
||||
new_dcc->size = size;
|
||||
new_dcc->pos = 0;
|
||||
new_dcc->prev_dcc = NULL;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
if (dcc_list)
|
||||
dcc_list->prev_dcc = new_dcc;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
gui_current_window->dcc_first = NULL;
|
||||
gui_current_window->dcc_selected = NULL;
|
||||
|
||||
if (type == DCC_FILE_RECV)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Incoming DCC file from "));
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_NICK,
|
||||
"%s",
|
||||
nick);
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_DARK,
|
||||
" (");
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_HOST,
|
||||
"%d.%d.%d.%d",
|
||||
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_DARK,
|
||||
")");
|
||||
gui_printf (server->buffer, ": ");
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s",
|
||||
filename);
|
||||
gui_printf (server->buffer, ", ");
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%lu",
|
||||
size);
|
||||
gui_printf (server->buffer, _(" bytes\n"));
|
||||
}
|
||||
|
||||
if ( ( (type == DCC_CHAT_RECV) && (cfg_dcc_auto_accept_chats) )
|
||||
|| ( (type == DCC_FILE_RECV) && (cfg_dcc_auto_accept_files) ) )
|
||||
dcc_accept (new_dcc);
|
||||
else
|
||||
dcc_redraw (2);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
|
||||
return new_dcc;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_handle: receive/send data for each active DCC
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_handle ()
|
||||
{
|
||||
t_dcc *ptr_dcc;
|
||||
int num;
|
||||
char buffer[8192];
|
||||
uint32_t pos;
|
||||
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
{
|
||||
if (ptr_dcc->type == DCC_FILE_RECV)
|
||||
{
|
||||
num = recv (ptr_dcc->sock, buffer, sizeof (buffer), 0);
|
||||
if (num != -1)
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (write (ptr_dcc->file, buffer, num) == -1)
|
||||
{
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
dcc_redraw (1);
|
||||
return;
|
||||
}
|
||||
ptr_dcc->pos += (unsigned long) num;
|
||||
pos = htonl (ptr_dcc->pos);
|
||||
send (ptr_dcc->sock, (char *) &pos, 4, 0);
|
||||
if (ptr_dcc->pos >= ptr_dcc->size)
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
|
||||
gui_printf_color (ptr_dcc->server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s",
|
||||
ptr_dcc->filename);
|
||||
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
|
||||
gui_printf_color (ptr_dcc->server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s",
|
||||
ptr_dcc->local_filename);
|
||||
gui_printf (ptr_dcc->server->buffer, _(") from "));
|
||||
gui_printf_color (ptr_dcc->server->buffer,
|
||||
COLOR_WIN_CHAT_NICK,
|
||||
"%s",
|
||||
ptr_dcc->nick);
|
||||
gui_printf (ptr_dcc->server->buffer, _(": ok!\n"));
|
||||
dcc_close (ptr_dcc, DCC_DONE);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
dcc_redraw (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_end: close all opened sockets (called when WeeChat is exiting)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_end ()
|
||||
{
|
||||
t_dcc *ptr_dcc;
|
||||
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (ptr_dcc->sock != -1)
|
||||
{
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
wee_log_printf (_("aborting active DCC: \"%s\" from %s\n"),
|
||||
ptr_dcc->filename, ptr_dcc->nick);
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
-37
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,18 +17,21 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-display.c: display functions for IRC */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../config.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -40,65 +41,72 @@
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_nick: display nick in chat window
|
||||
* if color_nick < 0 then nick is highlighted
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_printf_color_type (window,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", nick->nick);
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -107,21 +115,94 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_mode (t_gui_window *window, char *channel_name, char set_flag,
|
||||
irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
char *symbol, char *nick_host, char *message, char *param)
|
||||
{
|
||||
irc_display_prefix (window, PREFIX_INFO);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
irc_display_prefix (buffer, PREFIX_INFO);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
if (param)
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_server: display server description
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
}
|
||||
|
||||
+43
-36
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,15 +17,18 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-nick.c: manages nick list for channels */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
@@ -36,34 +37,18 @@
|
||||
*/
|
||||
|
||||
int
|
||||
nick_find_color (t_irc_channel *channel)
|
||||
nick_find_color (t_irc_nick *nick)
|
||||
{
|
||||
int i, color_less_used, min_used;
|
||||
int count_used[COLOR_WIN_NICK_NUMBER];
|
||||
t_irc_nick *ptr_nick;
|
||||
int i, color;
|
||||
|
||||
/* initialize array for counting usage of color */
|
||||
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
|
||||
count_used[i] = 0;
|
||||
|
||||
/* summarize each color usage */
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
count_used[ptr_nick->color - COLOR_WIN_NICK_FIRST]++;
|
||||
|
||||
/* look for color less used on channel */
|
||||
color_less_used = -1;
|
||||
min_used = INT_MAX;
|
||||
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
|
||||
color = 0;
|
||||
for (i = strlen (nick->nick) - 1; i >= 0; i--)
|
||||
{
|
||||
if (count_used[i] < min_used)
|
||||
{
|
||||
color_less_used = i;
|
||||
min_used = count_used[i];
|
||||
}
|
||||
color += (int)(nick->nick[i]);
|
||||
}
|
||||
color = (color % COLOR_WIN_NICK_NUMBER);
|
||||
|
||||
return (color_less_used < 0) ?
|
||||
COLOR_WIN_NICK_FIRST : COLOR_WIN_NICK_FIRST + color_less_used;
|
||||
return COLOR_WIN_NICK_FIRST + color;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -79,8 +64,8 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 3) + (nick1->is_halfop * 2) + nick1->has_voice );
|
||||
score2 = - ( (nick2->is_op * 3) + (nick2->is_halfop * 2) + nick2->has_voice );
|
||||
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
@@ -181,7 +166,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->window,
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
@@ -191,10 +176,11 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->window)->nick) == 0)
|
||||
new_nick->is_away = 0;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
new_nick->color = nick_find_color (channel);
|
||||
new_nick->color = nick_find_color (new_nick);
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
@@ -230,10 +216,18 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick)
|
||||
void
|
||||
nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
|
||||
{
|
||||
int nick_is_me;
|
||||
|
||||
nick_is_me = (strcmp (nick->nick, SERVER(channel->buffer)->nick) == 0) ? 1 : 0;
|
||||
|
||||
/* change nickname */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
nick->nick = strdup (new_nick);
|
||||
if (nick_is_me)
|
||||
nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
nick->color = nick_find_color (nick);
|
||||
|
||||
/* insert again nick into sorted list */
|
||||
nick_resort (channel, nick);
|
||||
@@ -346,8 +340,7 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
max_length = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
length = strlen (ptr_nick->nick);
|
||||
if (length > max_length)
|
||||
@@ -355,3 +348,17 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
}
|
||||
return max_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+3100
File diff suppressed because it is too large
Load Diff
+1372
File diff suppressed because it is too large
Load Diff
+559
-182
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,35 +17,177 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-server.c: (dis)connection and communication with irc server */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_irc_server *irc_servers = NULL;
|
||||
t_irc_server *last_irc_server = NULL;
|
||||
t_irc_server *current_irc_server = NULL;
|
||||
|
||||
t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
|
||||
/* buffer containing beginning of message if not ending with \r\n */
|
||||
char *unterminated_message = NULL;
|
||||
int check_away = 0;
|
||||
|
||||
/*
|
||||
* server_init: init server struct with default values
|
||||
*/
|
||||
|
||||
void
|
||||
server_init (t_irc_server *server)
|
||||
{
|
||||
server->name = NULL;
|
||||
server->autoconnect = 0;
|
||||
server->autoreconnect = 1;
|
||||
server->autoreconnect_delay = 30;
|
||||
server->command_line = 0;
|
||||
server->address = NULL;
|
||||
server->port = -1;
|
||||
server->password = NULL;
|
||||
server->nick1 = NULL;
|
||||
server->nick2 = NULL;
|
||||
server->nick3 = NULL;
|
||||
server->username = NULL;
|
||||
server->realname = NULL;
|
||||
server->command = NULL;
|
||||
server->command_delay = 1;
|
||||
server->autojoin = NULL;
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->is_connected = 0;
|
||||
server->reconnect_start = 0;
|
||||
server->reconnect_join = 0;
|
||||
server->sock4 = -1;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
server->buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_init_with_url: init a server with url of this form:
|
||||
* irc://nick:pass@irc.toto.org:6667
|
||||
* returns: 0 = ok
|
||||
* -1 = invalid syntax
|
||||
*/
|
||||
|
||||
int
|
||||
server_init_with_url (char *irc_url, t_irc_server *server)
|
||||
{
|
||||
char *url, *pos_server, *pos_channel, *pos, *pos2;
|
||||
struct passwd *my_passwd;
|
||||
|
||||
server_init (server);
|
||||
if (strncasecmp (irc_url, "irc://", 6) != 0)
|
||||
return -1;
|
||||
url = strdup (irc_url);
|
||||
pos_server = strchr (url, '@');
|
||||
if (pos_server)
|
||||
{
|
||||
pos_server[0] = '\0';
|
||||
pos_server++;
|
||||
pos = url + 6;
|
||||
if (!pos[0])
|
||||
{
|
||||
free (url);
|
||||
return -1;
|
||||
}
|
||||
pos2 = strchr (pos, ':');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
server->password = strdup (pos2 + 1);
|
||||
}
|
||||
server->nick1 = strdup (pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((my_passwd = getpwuid (geteuid ())) != NULL)
|
||||
server->nick1 = strdup (my_passwd->pw_name);
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: %s (%s).",
|
||||
WEECHAT_WARNING,
|
||||
_("Unable to get user's name"),
|
||||
strerror (errno));
|
||||
free (url);
|
||||
return -1;
|
||||
}
|
||||
pos_server = url + 6;
|
||||
}
|
||||
if (!pos_server[0])
|
||||
{
|
||||
free (url);
|
||||
return -1;
|
||||
}
|
||||
pos_channel = strchr (pos_server, '/');
|
||||
if (pos_channel)
|
||||
{
|
||||
pos_channel[0] = '\0';
|
||||
pos_channel++;
|
||||
}
|
||||
pos = strchr (pos_server, ':');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
server->port = atoi (pos + 1);
|
||||
}
|
||||
server->name = strdup (pos_server);
|
||||
server->address = strdup (pos_server);
|
||||
if (pos_channel && pos_channel[0])
|
||||
{
|
||||
if (string_is_channel (pos_channel))
|
||||
server->autojoin = strdup (pos_channel);
|
||||
else
|
||||
{
|
||||
server->autojoin = (char *) malloc (strlen (pos_channel) + 2);
|
||||
strcpy (server->autojoin, "#");
|
||||
strcat (server->autojoin, pos_channel);
|
||||
}
|
||||
}
|
||||
|
||||
free (url);
|
||||
|
||||
/* some default values */
|
||||
if (server->port < 0)
|
||||
server->port = DEFAULT_IRC_PORT;
|
||||
server->nick2 = (char *) malloc (strlen (server->nick1) + 2);
|
||||
strcpy (server->nick2, server->nick1);
|
||||
server->nick2 = strcat (server->nick2, "1");
|
||||
server->nick3 = (char *) malloc (strlen (server->nick1) + 2);
|
||||
strcpy (server->nick3, server->nick1);
|
||||
server->nick3 = strcat (server->nick3, "2");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_alloc: allocate a new server and add it to the servers queue
|
||||
@@ -57,36 +197,16 @@ t_irc_server *
|
||||
server_alloc ()
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
#if DEBUG >= 1
|
||||
log_printf ("allocating new server\n");
|
||||
#endif
|
||||
|
||||
/* alloc memory for new server */
|
||||
if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot allocate new server"), WEECHAT_ERROR);
|
||||
fprintf (stderr, _("%s cannot allocate new server\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* initialize new server */
|
||||
new_server->name = NULL;
|
||||
new_server->address = NULL;
|
||||
new_server->password = NULL;
|
||||
new_server->nick1 = NULL;
|
||||
new_server->nick2 = NULL;
|
||||
new_server->nick3 = NULL;
|
||||
new_server->username = NULL;
|
||||
new_server->realname = NULL;
|
||||
new_server->nick = NULL;
|
||||
new_server->is_connected = 0;
|
||||
new_server->sock4 = -1;
|
||||
new_server->is_away = 0;
|
||||
new_server->server_read = -1;
|
||||
new_server->server_write = -1;
|
||||
new_server->window = NULL;
|
||||
new_server->channels = NULL;
|
||||
new_server->last_channel = NULL;
|
||||
server_init (new_server);
|
||||
|
||||
/* add new server to queue */
|
||||
new_server->prev_server = last_irc_server;
|
||||
@@ -102,42 +222,12 @@ server_alloc ()
|
||||
}
|
||||
|
||||
/*
|
||||
* server_create_window: create windows for a server
|
||||
* server_destroy: free server data (not struct himself)
|
||||
*/
|
||||
|
||||
void
|
||||
server_create_window (t_irc_server *server)
|
||||
server_destroy (t_irc_server *server)
|
||||
{
|
||||
if (!SERVER(gui_windows))
|
||||
{
|
||||
server->window = gui_windows;
|
||||
SERVER(gui_windows) = server;
|
||||
}
|
||||
else
|
||||
gui_window_new (server, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* server_free: free a server and remove it from servers queue
|
||||
*/
|
||||
|
||||
void
|
||||
server_free (t_irc_server *server)
|
||||
{
|
||||
t_irc_server *new_irc_servers;
|
||||
|
||||
/* remove server from queue */
|
||||
if (server->prev_server)
|
||||
{
|
||||
(server->prev_server)->next_server = server->next_server;
|
||||
new_irc_servers = irc_servers;
|
||||
}
|
||||
else
|
||||
new_irc_servers = server->next_server;
|
||||
|
||||
if (server->next_server)
|
||||
(server->next_server)->prev_server = server->prev_server;
|
||||
|
||||
/* free data */
|
||||
if (server->name)
|
||||
free (server->name);
|
||||
@@ -155,12 +245,40 @@ server_free (t_irc_server *server)
|
||||
free (server->username);
|
||||
if (server->realname)
|
||||
free (server->realname);
|
||||
if (server->command)
|
||||
free (server->command);
|
||||
if (server->autojoin)
|
||||
free (server->autojoin);
|
||||
if (server->nick)
|
||||
free (server->nick);
|
||||
if (server->channels)
|
||||
channel_free_all (server);
|
||||
/* TODO: free weechat window (???) */
|
||||
/* (...) */
|
||||
}
|
||||
|
||||
/*
|
||||
* server_free: free a server and remove it from servers queue
|
||||
*/
|
||||
|
||||
void
|
||||
server_free (t_irc_server *server)
|
||||
{
|
||||
t_irc_server *new_irc_servers;
|
||||
|
||||
/* remove server from queue */
|
||||
if (last_irc_server == server)
|
||||
last_irc_server = server->prev_server;
|
||||
if (server->prev_server)
|
||||
{
|
||||
(server->prev_server)->next_server = server->next_server;
|
||||
new_irc_servers = irc_servers;
|
||||
}
|
||||
else
|
||||
new_irc_servers = server->next_server;
|
||||
|
||||
if (server->next_server)
|
||||
(server->next_server)->prev_server = server->prev_server;
|
||||
|
||||
server_destroy (server);
|
||||
free (server);
|
||||
irc_servers = new_irc_servers;
|
||||
}
|
||||
@@ -182,26 +300,35 @@ server_free_all ()
|
||||
*/
|
||||
|
||||
t_irc_server *
|
||||
server_new (char *name, char *address, int port, char *password,
|
||||
char *nick1, char *nick2, char *nick3,
|
||||
char *username, char *realname)
|
||||
server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_delay,
|
||||
int command_line, char *address, int port, char *password,
|
||||
char *nick1, char *nick2, char *nick3, char *username,
|
||||
char *realname, char *command, int command_delay, char *autojoin,
|
||||
int autorejoin)
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
if (!name || !address || (port < 0) || !nick1 || !nick2 || !nick3
|
||||
|| !username || !realname)
|
||||
if (!name || !address || (port < 0))
|
||||
return NULL;
|
||||
|
||||
#if DEBUG >= 1
|
||||
log_printf ("creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s)\n",
|
||||
name, address, port, password, nick1, nick2, nick3,
|
||||
username, realname);
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
{
|
||||
new_server->name = strdup (name);
|
||||
new_server->autoconnect = autoconnect;
|
||||
new_server->autoreconnect = autoreconnect;
|
||||
new_server->autoreconnect_delay = autoreconnect_delay;
|
||||
new_server->command_line = command_line;
|
||||
new_server->address = strdup (address);
|
||||
new_server->port = port;
|
||||
new_server->password = (password) ? strdup (password) : strdup ("");
|
||||
@@ -212,6 +339,12 @@ server_new (char *name, char *address, int port, char *password,
|
||||
(username) ? strdup (username) : strdup ("weechat");
|
||||
new_server->realname =
|
||||
(realname) ? strdup (realname) : strdup ("realname");
|
||||
new_server->command =
|
||||
(command) ? strdup (command) : NULL;
|
||||
new_server->command_delay = command_delay;
|
||||
new_server->autojoin =
|
||||
(autojoin) ? strdup (autojoin) : NULL;
|
||||
new_server->autorejoin = autorejoin;
|
||||
new_server->nick = strdup (new_server->nick1);
|
||||
}
|
||||
else
|
||||
@@ -236,32 +369,43 @@ server_send (t_irc_server * server, char *buffer, int size_buf)
|
||||
* server_sendf: send formatted data to irc server
|
||||
*/
|
||||
|
||||
int
|
||||
void
|
||||
server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
return -1;
|
||||
return;
|
||||
|
||||
va_start (args, fmt);
|
||||
size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
#ifdef DEBUG
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#if DEBUG >= 2
|
||||
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
return server_send (server, buffer, size_buf);
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -269,20 +413,38 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
*/
|
||||
|
||||
void
|
||||
server_msgq_add_msg (t_irc_server * server, char *msg)
|
||||
server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
{
|
||||
t_irc_message *message;
|
||||
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
message->server = server;
|
||||
if (unterminated_message)
|
||||
if (!message)
|
||||
{
|
||||
message->data = (char *) malloc (strlen (unterminated_message) +
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
message->server = server;
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
message->data = (char *) malloc (strlen (server->unterminated_message) +
|
||||
strlen (msg) + 1);
|
||||
strcpy (message->data, unterminated_message);
|
||||
strcat (message->data, msg);
|
||||
free (unterminated_message);
|
||||
unterminated_message = NULL;
|
||||
if (!message->data)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (message->data, server->unterminated_message);
|
||||
strcat (message->data, msg);
|
||||
}
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
}
|
||||
else
|
||||
message->data = strdup (msg);
|
||||
@@ -305,7 +467,7 @@ server_msgq_add_msg (t_irc_server * server, char *msg)
|
||||
*/
|
||||
|
||||
void
|
||||
server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
@@ -320,18 +482,37 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (buffer, '\0');
|
||||
pos = strstr (buffer, "\n");
|
||||
if (pos)
|
||||
{
|
||||
unterminated_message =
|
||||
(char *) realloc (unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
strcpy (unterminated_message, buffer);
|
||||
return;
|
||||
pos[0] = '\0';
|
||||
server_msgq_add_msg (server, buffer);
|
||||
buffer = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (buffer, '\0');
|
||||
if (pos)
|
||||
{
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcpy (server->unterminated_message, buffer);
|
||||
return;
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
gui_printf (server->window,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,78 +525,89 @@ void
|
||||
server_msgq_flush ()
|
||||
{
|
||||
t_irc_message *next;
|
||||
/*char **argv;
|
||||
int argc;*/
|
||||
char *ptr_data, *pos, *pos2;
|
||||
char *entire_line, *ptr_data, *pos, *pos2;
|
||||
char *host, *command, *args;
|
||||
|
||||
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
|
||||
while (recv_msgq)
|
||||
{
|
||||
#if DEBUG >= 2
|
||||
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
|
||||
#endif
|
||||
|
||||
ptr_data = recv_msgq->data;
|
||||
|
||||
while (ptr_data[0] == ' ')
|
||||
ptr_data++;
|
||||
|
||||
if (ptr_data)
|
||||
if (recv_msgq->data)
|
||||
{
|
||||
#if DEBUG >= 2
|
||||
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
|
||||
#ifdef DEBUG
|
||||
gui_printf (gui_current_window->buffer, "[DEBUG] %s\n", recv_msgq->data);
|
||||
#endif
|
||||
|
||||
host = NULL;
|
||||
command = NULL;
|
||||
args = ptr_data;
|
||||
ptr_data = recv_msgq->data;
|
||||
entire_line = strdup (ptr_data);
|
||||
|
||||
if (ptr_data[0] == ':')
|
||||
{
|
||||
pos = strchr(ptr_data, ' ');
|
||||
pos[0] = '\0';
|
||||
host = ptr_data+1;
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
pos = ptr_data;
|
||||
while (ptr_data[0] == ' ')
|
||||
ptr_data++;
|
||||
|
||||
if (pos != NULL)
|
||||
if (ptr_data)
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr(pos, ' ');
|
||||
if (pos2 != NULL)
|
||||
#ifdef DEBUG
|
||||
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
|
||||
#endif
|
||||
|
||||
host = NULL;
|
||||
command = NULL;
|
||||
args = ptr_data;
|
||||
|
||||
if (ptr_data[0] == ':')
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
command = strdup(pos);
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
args = (pos2[0] == ':') ? pos2+1 : pos2;
|
||||
pos = strchr(ptr_data, ' ');
|
||||
pos[0] = '\0';
|
||||
host = ptr_data+1;
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
pos = ptr_data;
|
||||
|
||||
if (pos != NULL)
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr(pos, ' ');
|
||||
if (pos2 != NULL)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
command = strdup(pos);
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
args = (pos2[0] == ':') ? pos2+1 : pos2;
|
||||
}
|
||||
}
|
||||
|
||||
switch (irc_recv_command (recv_msgq->server, entire_line, host,
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
|
||||
break;
|
||||
case -2:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s No command to execute!\n"), WEECHAT_ERROR);
|
||||
break;
|
||||
case -3:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_ERROR, command, args);
|
||||
break;
|
||||
}
|
||||
|
||||
if (command)
|
||||
free (command);
|
||||
}
|
||||
|
||||
switch (irc_recv_command (recv_msgq->server, host, command, args))
|
||||
{
|
||||
case -1:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
_("Command '%s' failed!\n"), command);
|
||||
break;
|
||||
case -2:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
_("No command to execute!\n"));
|
||||
break;
|
||||
case -3:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
_("Unknown command: cmd=%s, args=%s\n"),
|
||||
command, args);
|
||||
break;
|
||||
}
|
||||
free (entire_line);
|
||||
free (recv_msgq->data);
|
||||
}
|
||||
|
||||
free (recv_msgq->data);
|
||||
|
||||
next = recv_msgq->next_message;
|
||||
free (recv_msgq);
|
||||
recv_msgq = next;
|
||||
@@ -441,10 +633,18 @@ server_recv (t_irc_server *server)
|
||||
server_msgq_add_buffer (server, buffer);
|
||||
server_msgq_flush ();
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot read data from socket, disconnecting from server...\n"),
|
||||
WEECHAT_ERROR);
|
||||
server_disconnect (server, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_connect: connect to an irc server
|
||||
* server_connect: connect to an IRC server
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -457,17 +657,19 @@ server_connect (t_irc_server *server)
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
|
||||
gui_printf (server->window,
|
||||
_(WEECHAT_NAME ": connecting to %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
log_printf ("connecting to server %s:%d...\n",
|
||||
server->address, server->port);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
server->is_connected = 0;
|
||||
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
return 0;
|
||||
@@ -481,22 +683,29 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
_("%s cannot set socket option 'SO_REUSEADDR'\n"),
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
close (server->server_read);
|
||||
@@ -512,14 +721,16 @@ server_connect (t_irc_server *server)
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s can't bind to hostname\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
} */
|
||||
}*/
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -529,13 +740,15 @@ server_connect (t_irc_server *server)
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
gui_printf (server->window,
|
||||
_(WEECHAT_NAME ": server IP is: %s\n"), ip_address);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -543,25 +756,115 @@ server_connect (t_irc_server *server)
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
current_irc_server = server;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_reconnect: reconnect to a server (after disconnection)
|
||||
*/
|
||||
|
||||
void
|
||||
server_reconnect (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server...\n"),
|
||||
PACKAGE_NAME);
|
||||
server->reconnect_start = 0;
|
||||
|
||||
if (server_connect (server))
|
||||
{
|
||||
server->reconnect_join = 1;
|
||||
irc_login (server);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_auto_connect: auto-connect to servers (called at startup)
|
||||
*/
|
||||
|
||||
void
|
||||
server_auto_connect (int command_line)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if ( ((command_line) && (ptr_server->command_line))
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_disconnect: disconnect from an irc server
|
||||
*/
|
||||
|
||||
void
|
||||
server_disconnect (t_irc_server *server)
|
||||
server_disconnect (t_irc_server *server, int reconnect)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
if (server->is_connected)
|
||||
{
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->is_connected = 0;
|
||||
/* write disconnection message on each channel/private buffer */
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
nick_free_all (ptr_channel);
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
if (server->server_read >= 0)
|
||||
close (server->server_read);
|
||||
server->server_read = -1;
|
||||
|
||||
if (server->server_write >= 0)
|
||||
close (server->server_write);
|
||||
server->server_write = -1;
|
||||
|
||||
if (server->sock4 >= 0)
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
|
||||
server->is_connected = 0;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
|
||||
if ((reconnect) && (server->autoreconnect))
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -574,7 +877,25 @@ server_disconnect_all ()
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
server_disconnect (ptr_server);
|
||||
server_disconnect (ptr_server, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* server_search: return pointer on a server with a name
|
||||
*/
|
||||
|
||||
t_irc_server *
|
||||
server_search (char *servername)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (strcmp (ptr_server->name, servername) == 0)
|
||||
return ptr_server;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -613,3 +934,59 @@ server_name_already_exists (char *name)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_away: remove away for all chans/nicks (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_remove_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_check_away: check for away on all channels (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_check_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_away: set/unset away status for a server (all channels)
|
||||
*/
|
||||
|
||||
void
|
||||
server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
+169
-24
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,8 +21,12 @@
|
||||
#ifndef __WEECHAT_IRC_H
|
||||
#define __WEECHAT_IRC_H 1
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
|
||||
#define PREFIX_SERVER "-@-"
|
||||
#define PREFIX_INFO "-=-"
|
||||
#define PREFIX_ACTION_ME "-*-"
|
||||
@@ -32,9 +34,42 @@
|
||||
#define PREFIX_PART "<--"
|
||||
#define PREFIX_QUIT "<--"
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "-P-"
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
#define CHANNEL_MODE_LIMIT 2
|
||||
#define CHANNEL_MODE_MODERATED 3
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -45,7 +80,8 @@ struct t_irc_nick
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int color; /* color for nickname */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
@@ -63,9 +99,13 @@ struct t_irc_channel
|
||||
int type; /* channel type */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
t_irc_channel *prev_channel; /* link to previous channel */
|
||||
t_irc_channel *next_channel; /* link to next channel */
|
||||
};
|
||||
@@ -78,6 +118,10 @@ struct t_irc_server
|
||||
{
|
||||
/* user choices */
|
||||
char *name; /* name of server (only for display) */
|
||||
int autoconnect; /* = 1 if auto connect at startup */
|
||||
int autoreconnect; /* = 1 if auto reco when disconnected */
|
||||
int autoreconnect_delay; /* delay before trying again reconnect */
|
||||
int command_line; /* server was given on command line */
|
||||
char *address; /* address of server (IP or name) */
|
||||
int port; /* port for server (6667 by default) */
|
||||
char *password; /* password for server */
|
||||
@@ -86,15 +130,26 @@ struct t_irc_server
|
||||
char *nick3; /* 2nd alternate nickname */
|
||||
char *username; /* user name */
|
||||
char *realname; /* real name */
|
||||
char *command; /* command to run once connected */
|
||||
int command_delay; /* delay after execution of command */
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int sock4; /* socket for server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
t_gui_window *window; /* GUI window allocated for server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
struct timeval lag_check_time; /* last time lag was checked (ping sent)*/
|
||||
time_t lag_next_check; /* time for next check */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
t_irc_server *prev_server; /* link to previous server */
|
||||
@@ -121,6 +176,8 @@ struct t_irc_command
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
/* irc messages */
|
||||
|
||||
typedef struct t_irc_message t_irc_message;
|
||||
|
||||
struct t_irc_message
|
||||
@@ -130,35 +187,73 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_dcc t_dcc;
|
||||
|
||||
struct t_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
int type; /* DCC type (send or receive) */
|
||||
int status; /* DCC status (waiting, sending, ..) */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int sock; /* socket for connection */
|
||||
int file; /* local file (for reading or writing) */
|
||||
char *filename; /* filename (given by sender) */
|
||||
char *local_filename; /* local filename (with path) */
|
||||
int filename_suffix; /* suffix (.1 for ex) if renaming file */
|
||||
unsigned long size; /* file size */
|
||||
unsigned long pos; /* number of bytes received/sent */
|
||||
t_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern int check_away;
|
||||
extern t_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
extern void server_init (t_irc_server *);
|
||||
extern int server_init_with_url (char *, t_irc_server *);
|
||||
extern t_irc_server *server_alloc ();
|
||||
extern void server_create_window (t_irc_server *);
|
||||
extern void server_destroy (t_irc_server *);
|
||||
extern void server_free (t_irc_server *);
|
||||
extern void server_free_all ();
|
||||
extern t_irc_server *server_new (char *, char *, int, char *, char *, char *,
|
||||
char *, char *, char *);
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, char *,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
int, char *, int);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern int server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
extern int server_connect ();
|
||||
extern void server_disconnect (t_irc_server *);
|
||||
extern int server_connect (t_irc_server *);
|
||||
extern void server_reconnect (t_irc_server *);
|
||||
extern void server_auto_connect (int);
|
||||
extern void server_disconnect (t_irc_server *, int);
|
||||
extern void server_disconnect_all ();
|
||||
extern t_irc_server *server_search (char *);
|
||||
extern int server_get_number_connected ();
|
||||
extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *);
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *, int);
|
||||
extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
@@ -170,45 +265,84 @@ extern void nick_free_all (t_irc_channel *);
|
||||
extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
extern void dcc_free (t_dcc *);
|
||||
extern void dcc_close (t_dcc *, int);
|
||||
extern void dcc_accept (t_dcc *);
|
||||
extern t_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, char *,
|
||||
unsigned int);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (t_gui_window *, char *);
|
||||
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_info (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ison (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_join (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_links (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_list (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_lusers (t_irc_server *, char *);
|
||||
extern int irc_send_me (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int irc_send_me_all_channels (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_me (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_mode (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_motd (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_msg (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_names (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_nick (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_notice (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_op (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_oper (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_oper (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_part (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ping (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ping (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_query (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quit (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quote (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_rehash (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_restart (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_service (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_servlist (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_squery (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_squit (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_stats (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_summon (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_time (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_trace (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_userhost (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_users (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_version (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_voice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_wallops (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
||||
@@ -218,6 +352,7 @@ extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
|
||||
@@ -226,9 +361,15 @@ extern int irc_cmd_recv_topic (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_315 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
|
||||
@@ -236,11 +377,15 @@ extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,23 +15,24 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_QT
|
||||
# if PLUGIN_PYTHON
|
||||
# python_dir = python
|
||||
# endif
|
||||
|
||||
all: $(OBJS)
|
||||
ar r $(OUTPUT) $(OBJS)
|
||||
# if PLUGIN_RUBY
|
||||
# ruby_dir = ruby
|
||||
# endif
|
||||
|
||||
$(OBJS):
|
||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
||||
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
SUBDIRS = $(perl_dir)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ core
|
||||
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||
|
||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
lib_weechat_plugins_a_SOURCES = plugins.h \
|
||||
plugins.c
|
||||
+4
-2
@@ -2,8 +2,10 @@ WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
This is plugins directory for WeeChat.
|
||||
In the future, you'll find there interfaces with many famous languages for
|
||||
|
||||
Today, Perl interface is developed.
|
||||
|
||||
In the future, you'll find there interfaces with other famous languages for
|
||||
writing extensions to WeeChat:
|
||||
- Perl interface,
|
||||
- Python interface,
|
||||
- Ruby interface.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program 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 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_perl.a
|
||||
|
||||
lib_weechat_perl_a_SOURCES = wee-perl.h \
|
||||
wee-perl.c
|
||||
@@ -0,0 +1,656 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* wee-perl.c: Perl plugin support for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#include "../../common/weechat.h"
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "../../gui/gui.h"
|
||||
|
||||
|
||||
static PerlInterpreter *my_perl = NULL;
|
||||
|
||||
t_plugin_script *perl_scripts = NULL;
|
||||
t_plugin_script *last_perl_script = NULL;
|
||||
|
||||
extern void boot_DynaLoader (pTHX_ CV* cv);
|
||||
|
||||
|
||||
/*
|
||||
* IRC::register: startup function for all WeeChat Perl scripts
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_register)
|
||||
{
|
||||
char *name, *version, *shutdown_func, *description;
|
||||
int integer;
|
||||
t_plugin_script *ptr_perl_script, *perl_script_found, *new_perl_script;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
version = SvPV (ST (1), integer);
|
||||
shutdown_func = SvPV (ST (2), integer);
|
||||
description = SvPV (ST (3), integer);
|
||||
|
||||
perl_script_found = NULL;
|
||||
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||
ptr_perl_script = ptr_perl_script->next_script)
|
||||
{
|
||||
if (strcasecmp (ptr_perl_script->name, name) == 0)
|
||||
{
|
||||
perl_script_found = ptr_perl_script;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (perl_script_found)
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: unable to register Perl script \"%s\" (another script "
|
||||
"already exists with this name)\n"),
|
||||
name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* registering script */
|
||||
new_perl_script = (t_plugin_script *)malloc (sizeof (t_plugin_script));
|
||||
if (new_perl_script)
|
||||
{
|
||||
new_perl_script->name = strdup (name);
|
||||
new_perl_script->version = strdup (version);
|
||||
new_perl_script->shutdown_func = strdup (shutdown_func);
|
||||
new_perl_script->description = strdup (description);
|
||||
|
||||
/* add new script to list */
|
||||
new_perl_script->prev_script = last_perl_script;
|
||||
new_perl_script->next_script = NULL;
|
||||
if (perl_scripts)
|
||||
last_perl_script->next_script = new_perl_script;
|
||||
else
|
||||
perl_scripts = new_perl_script;
|
||||
last_perl_script = new_perl_script;
|
||||
|
||||
wee_log_printf (_("registered Perl script: \"%s\", version %s (%s)\n"),
|
||||
name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to load Perl script \"%s\" (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
XST_mPV (0, VERSION);
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print: print message to current buffer
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print)
|
||||
{
|
||||
int i, integer;
|
||||
char *message;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window->buffer, "%s", message);
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print_with_channel: print message to a specific channel/server
|
||||
* (server is optional)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
int integer;
|
||||
char *message, *channel, *server = NULL;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
/* server specified */
|
||||
if (items > 2)
|
||||
{
|
||||
server = SvPV (ST (2), integer);
|
||||
if (!server[0])
|
||||
server = NULL;
|
||||
}
|
||||
|
||||
/* look for buffer for printing message */
|
||||
channel = SvPV (ST (1), integer);
|
||||
ptr_buffer = NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!server || (strcasecmp (ptr_server->name, server)) == 0)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel) == 0)
|
||||
{
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptr_buffer)
|
||||
break;
|
||||
}
|
||||
|
||||
/* buffer found => display message & return 1 */
|
||||
if (ptr_buffer)
|
||||
{
|
||||
message = SvPV (ST (0), integer);
|
||||
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s", message);
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/* no buffer found => return 0 */
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print_infobar: print message to infobar
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print_infobar)
|
||||
{
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
if (items == 2)
|
||||
gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: wrong parameters for IRC::print_infobar Perl function\n"));
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::command: send command to server
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_command)
|
||||
{
|
||||
int integer;
|
||||
char *server, *command, *command2;
|
||||
t_irc_server *ptr_server;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
if (items == 2)
|
||||
{
|
||||
server = SvPV (ST (0), integer);
|
||||
command = SvPV (ST (1), integer);
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (strcasecmp (ptr_server->name, server) == 0)
|
||||
break;
|
||||
}
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: server not found for IRC::command Perl function\n"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
command = SvPV (ST (0), integer);
|
||||
}
|
||||
|
||||
if (ptr_server)
|
||||
{
|
||||
command2 = (char *) malloc (strlen (command) + 8);
|
||||
strcpy (command2, command);
|
||||
if (!strstr (command2, "\r\n"))
|
||||
strcat (command2, "\r\n");
|
||||
server_sendf (ptr_server, command2);
|
||||
free (command2);
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::add_message_handler: add handler for messages (privmsg, ...)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_add_message_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
plugin_handler_add (&plugin_msg_handlers, &last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PERL, name, function);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::add_command_handler: add command handler (define/redefine commands)
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_add_command_handler)
|
||||
{
|
||||
char *name, *function;
|
||||
int integer;
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (!weelist_search (index_commands, name))
|
||||
weelist_add (&index_commands, &last_index_command, name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
free (ptr_plugin_handler->function_name);
|
||||
ptr_plugin_handler->function_name = strdup (function);
|
||||
}
|
||||
else
|
||||
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PERL, name, function);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::get_info: get various infos
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_get_info)
|
||||
{
|
||||
char *arg, *info = NULL, *server;
|
||||
t_irc_server *ptr_server;
|
||||
int integer;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) cv;
|
||||
|
||||
if (items == 2)
|
||||
{
|
||||
server = SvPV (ST (0), integer);
|
||||
arg = SvPV (ST (1), integer);
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (strcasecmp (ptr_server->name, server) == 0)
|
||||
break;
|
||||
}
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: server not found for IRC::get_info Perl function\n"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
arg = SvPV (ST (0), integer);
|
||||
}
|
||||
|
||||
if (ptr_server && arg)
|
||||
{
|
||||
|
||||
if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) )
|
||||
{
|
||||
info = PACKAGE_STRING;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
|
||||
{
|
||||
if (ptr_server->nick)
|
||||
info = ptr_server->nick;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||
{
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
info = CHANNEL (gui_current_window->buffer)->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
|
||||
{
|
||||
if (ptr_server->name)
|
||||
info = ptr_server->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) )
|
||||
{
|
||||
info = weechat_home;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
|
||||
{
|
||||
XST_mIV (0, SERVER(gui_current_window->buffer)->is_away);
|
||||
XSRETURN (1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (info)
|
||||
XST_mPV (0, info);
|
||||
else
|
||||
XST_mPV (0, "");
|
||||
}
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* xs_init: initialize subroutines
|
||||
*/
|
||||
|
||||
void
|
||||
xs_init (pTHX)
|
||||
{
|
||||
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
|
||||
newXS ("IRC::register", XS_IRC_register, "IRC");
|
||||
newXS ("IRC::print", XS_IRC_print, "IRC");
|
||||
newXS ("IRC::print_with_channel", XS_IRC_print_with_channel, "IRC");
|
||||
newXS ("IRC::print_infobar", XS_IRC_print_infobar, "IRC");
|
||||
newXS ("IRC::command", XS_IRC_command, "IRC");
|
||||
newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");
|
||||
newXS ("IRC::add_command_handler", XS_IRC_add_command_handler, "IRC");
|
||||
newXS ("IRC::get_info", XS_IRC_get_info, "IRC");
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_init: initialize Perl interface for WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_init ()
|
||||
{
|
||||
char *perl_args[] = { "", "-e", "0" };
|
||||
/* Following Perl code is extracted/modified from X-Chat IRC client */
|
||||
/* X-Chat is (c) 1998-2002 Peter Zelezny */
|
||||
char *weechat_perl_func =
|
||||
{
|
||||
"sub wee_perl_load_file"
|
||||
"{"
|
||||
" my $filename = shift;"
|
||||
" local $/ = undef;"
|
||||
" open FILE, $filename or return \"__WEECHAT_ERROR__\";"
|
||||
" $_ = <FILE>;"
|
||||
" close FILE;"
|
||||
" return $_;"
|
||||
"}"
|
||||
"sub wee_perl_load_eval_file"
|
||||
"{"
|
||||
" my $filename = shift;"
|
||||
" my $content = wee_perl_load_file ($filename);"
|
||||
" if ($content eq \"__WEECHAT_ERROR__\")"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " Perl script '$filename' not found.\\n\";"
|
||||
" return 1;"
|
||||
" }"
|
||||
" eval $content;"
|
||||
" if ($@)"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"$@\\n\";"
|
||||
" return 2;"
|
||||
" }"
|
||||
" return 0;"
|
||||
"}"
|
||||
"$SIG{__WARN__} = sub { IRC::print \"$_[0]\n\"; };"
|
||||
};
|
||||
|
||||
my_perl = perl_alloc ();
|
||||
perl_construct (my_perl);
|
||||
perl_parse (my_perl, xs_init, 3, perl_args, NULL);
|
||||
eval_pv (weechat_perl_func, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_search: search a (loaded) Perl script by name
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
wee_perl_search (char *name)
|
||||
{
|
||||
t_plugin_script *ptr_perl_script;
|
||||
|
||||
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||
ptr_perl_script = ptr_perl_script->next_script)
|
||||
{
|
||||
if (strcmp (ptr_perl_script->name, name) == 0)
|
||||
return ptr_perl_script;
|
||||
}
|
||||
|
||||
/* script not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_exec: execute a Perl script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_perl_exec (char *function, char *server, char *arguments)
|
||||
{
|
||||
char *argv[3];
|
||||
int count, return_code;
|
||||
SV *sv;
|
||||
|
||||
/* call Perl function */
|
||||
dSP;
|
||||
ENTER;
|
||||
SAVETMPS;
|
||||
PUSHMARK(sp);
|
||||
if (!server)
|
||||
argv[0] = strdup ("");
|
||||
else
|
||||
argv[0] = server;
|
||||
argv[1] = arguments;
|
||||
argv[2] = NULL;
|
||||
count = perl_call_argv (function, G_EVAL | G_SCALAR, argv);
|
||||
SPAGAIN;
|
||||
|
||||
/* check if ok */
|
||||
sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV));
|
||||
return_code = 1;
|
||||
if (SvTRUE (sv))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: %s\n"),
|
||||
SvPV (sv, count));
|
||||
POPs;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
|
||||
function, count);
|
||||
}
|
||||
else
|
||||
return_code = POPi;
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_load: load a Perl script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_perl_load (char *filename)
|
||||
{
|
||||
/* execute Perl script */
|
||||
wee_log_printf (_("loading Perl script \"%s\"\n"), filename);
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Loading Perl script \"%s\"\n"), filename);
|
||||
return wee_perl_exec ("wee_perl_load_eval_file", filename, "");
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_script_free: free a Perl script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_script_free (t_plugin_script *ptr_perl_script)
|
||||
{
|
||||
t_plugin_script *new_perl_scripts;
|
||||
|
||||
/* remove script from list */
|
||||
if (last_perl_script == ptr_perl_script)
|
||||
last_perl_script = ptr_perl_script->prev_script;
|
||||
if (ptr_perl_script->prev_script)
|
||||
{
|
||||
(ptr_perl_script->prev_script)->next_script = ptr_perl_script->next_script;
|
||||
new_perl_scripts = perl_scripts;
|
||||
}
|
||||
else
|
||||
new_perl_scripts = ptr_perl_script->next_script;
|
||||
|
||||
if (ptr_perl_script->next_script)
|
||||
(ptr_perl_script->next_script)->prev_script = ptr_perl_script->prev_script;
|
||||
|
||||
/* free data */
|
||||
if (ptr_perl_script->name)
|
||||
free (ptr_perl_script->name);
|
||||
if (ptr_perl_script->version)
|
||||
free (ptr_perl_script->version);
|
||||
if (ptr_perl_script->shutdown_func)
|
||||
free (ptr_perl_script->shutdown_func);
|
||||
if (ptr_perl_script->description)
|
||||
free (ptr_perl_script->description);
|
||||
free (ptr_perl_script);
|
||||
perl_scripts = new_perl_scripts;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_unload: unload a Perl script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_unload (t_plugin_script *ptr_perl_script)
|
||||
{
|
||||
if (ptr_perl_script)
|
||||
{
|
||||
wee_log_printf (_("unloading Perl script \"%s\"\n"),
|
||||
ptr_perl_script->name);
|
||||
|
||||
/* call shutdown callback function */
|
||||
if (ptr_perl_script->shutdown_func[0])
|
||||
wee_perl_exec (ptr_perl_script->shutdown_func, "", "");
|
||||
wee_perl_script_free (ptr_perl_script);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_unload_all: unload all Perl scripts
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_unload_all ()
|
||||
{
|
||||
wee_log_printf (_("unloading all Perl scripts...\n"));
|
||||
while (perl_scripts)
|
||||
wee_perl_unload (perl_scripts);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_perl_end: shutdown Perl interface
|
||||
*/
|
||||
|
||||
void
|
||||
wee_perl_end ()
|
||||
{
|
||||
/* unload all scripts */
|
||||
wee_perl_unload_all ();
|
||||
|
||||
/* free all handlers */
|
||||
plugin_handler_free_all_type (&plugin_msg_handlers,
|
||||
&last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PERL);
|
||||
plugin_handler_free_all_type (&plugin_cmd_handlers,
|
||||
&last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PERL);
|
||||
|
||||
/* free Perl interpreter */
|
||||
if (my_perl)
|
||||
{
|
||||
perl_destruct (my_perl);
|
||||
perl_free (my_perl);
|
||||
my_perl = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +18,17 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_GUI_GTK_H
|
||||
#define __WEECHAT_GUI_GTK_H 1
|
||||
#ifndef __WEECHAT_PERL_H
|
||||
#define __WEECHAT_PERL_H 1
|
||||
|
||||
#endif /* gui-gtk.h */
|
||||
#include "../plugins.h"
|
||||
|
||||
extern void wee_perl_init ();
|
||||
extern t_plugin_script *wee_perl_search (char *);
|
||||
extern int wee_perl_exec (char *, char *, char *);
|
||||
extern int wee_perl_load (char *);
|
||||
extern void wee_perl_unload (t_plugin_script *);
|
||||
extern void wee_perl_unload_all ();
|
||||
extern void wee_perl_end ();
|
||||
|
||||
#endif /* wee-perl.h */
|
||||
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* plugins.c: manages WeeChat plugins (Perl and/or Python and/or Ruby) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
#include "perl/wee-perl.h"
|
||||
#endif
|
||||
|
||||
|
||||
char *plugin_name[3] = { "Perl", "Python", "Ruby" };
|
||||
|
||||
t_plugin_handler *plugin_msg_handlers = NULL;
|
||||
t_plugin_handler *last_plugin_msg_handler = NULL;
|
||||
|
||||
t_plugin_handler *plugin_cmd_handlers = NULL;
|
||||
t_plugin_handler *last_plugin_cmd_handler = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* plugin_auto_load: auto-load all scripts in a directory
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_auto_load (int plugin_type, char *directory)
|
||||
{
|
||||
int dir_length;
|
||||
char *dir_name, *current_dir;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat statbuf;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (directory) + 2;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||
|
||||
/* save working directory */
|
||||
current_dir = (char *) malloc (1024 * sizeof (char));
|
||||
if (!getcwd (current_dir, 1024 - 1))
|
||||
{
|
||||
free (current_dir);
|
||||
current_dir = NULL;
|
||||
}
|
||||
|
||||
/* browse autoload directory */
|
||||
dir = opendir (dir_name);
|
||||
chdir (dir_name);
|
||||
if (dir)
|
||||
{
|
||||
while ((entry = readdir (dir)))
|
||||
{
|
||||
lstat (entry->d_name, &statbuf);
|
||||
if (! S_ISDIR(statbuf.st_mode))
|
||||
{
|
||||
wee_log_printf (_("auto-loading %s script: %s%s%s\n"),
|
||||
plugin_name[plugin_type],
|
||||
dir_name, DIR_SEPARATOR, entry->d_name);
|
||||
plugin_load (plugin_type, entry->d_name);
|
||||
}
|
||||
}
|
||||
closedir (dir);
|
||||
}
|
||||
|
||||
/* restore working directory */
|
||||
if (current_dir)
|
||||
{
|
||||
chdir (current_dir);
|
||||
free (current_dir);
|
||||
}
|
||||
free (dir_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_init: initialize all plugins
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_init ()
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_init();
|
||||
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_load: load a plugin
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_load (int plugin_type, char *filename)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_load (filename);
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: load Python script */
|
||||
break;
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
(void) filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_search: look for message/command handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
plugin_handler_search (t_plugin_handler *plugin_handlers, char *name)
|
||||
{
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
/* handler found */
|
||||
if (strcasecmp (ptr_plugin_handler->name, name) == 0)
|
||||
return ptr_plugin_handler;
|
||||
}
|
||||
/* handler not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_add: add a message/command handler
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_add (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
int plugin_type, char *name, char *function)
|
||||
{
|
||||
t_plugin_handler *new_plugin_handler;
|
||||
|
||||
new_plugin_handler = (t_plugin_handler *)malloc (sizeof (t_plugin_handler));
|
||||
if (new_plugin_handler)
|
||||
{
|
||||
new_plugin_handler->plugin_type = plugin_type;
|
||||
new_plugin_handler->name = strdup (name);
|
||||
new_plugin_handler->function_name = strdup (function);
|
||||
|
||||
/* add new handler to list */
|
||||
new_plugin_handler->prev_handler = *last_plugin_handler;
|
||||
new_plugin_handler->next_handler = NULL;
|
||||
if (*plugin_handlers)
|
||||
(*last_plugin_handler)->next_handler = new_plugin_handler;
|
||||
else
|
||||
*plugin_handlers = new_plugin_handler;
|
||||
*last_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unable to add handler for \"%s\" message (not enough memory)\n"),
|
||||
WEECHAT_ERROR, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free: free message/command handler
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
t_plugin_handler *ptr_plugin_handler)
|
||||
{
|
||||
t_plugin_handler *new_plugin_handlers;
|
||||
|
||||
/* remove handler from list */
|
||||
if (*last_plugin_handler == ptr_plugin_handler)
|
||||
*last_plugin_handler = ptr_plugin_handler->prev_handler;
|
||||
if (ptr_plugin_handler->prev_handler)
|
||||
{
|
||||
(ptr_plugin_handler->prev_handler)->next_handler = ptr_plugin_handler->next_handler;
|
||||
new_plugin_handlers = *plugin_handlers;
|
||||
}
|
||||
else
|
||||
new_plugin_handlers = ptr_plugin_handler->next_handler;
|
||||
|
||||
if (ptr_plugin_handler->next_handler)
|
||||
(ptr_plugin_handler->next_handler)->prev_handler = ptr_plugin_handler->prev_handler;
|
||||
|
||||
/* free data */
|
||||
free (ptr_plugin_handler->name);
|
||||
free (ptr_plugin_handler->function_name);
|
||||
free (ptr_plugin_handler);
|
||||
*plugin_handlers = new_plugin_handlers;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free_all: remove all message/command handlers
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free_all (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler)
|
||||
{
|
||||
while (*plugin_handlers)
|
||||
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||
*plugin_handlers);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_free_all_type: remove all message/command handlers for one type
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_handler_free_all_type (t_plugin_handler **plugin_handlers,
|
||||
t_plugin_handler **last_plugin_handler,
|
||||
int plugin_type)
|
||||
{
|
||||
t_plugin_handler *ptr_plugin_handler, *new_plugin_handler;
|
||||
|
||||
ptr_plugin_handler = *plugin_handlers;
|
||||
while (ptr_plugin_handler)
|
||||
{
|
||||
if (ptr_plugin_handler->plugin_type == plugin_type)
|
||||
{
|
||||
new_plugin_handler = ptr_plugin_handler->next_handler;
|
||||
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||
ptr_plugin_handler);
|
||||
ptr_plugin_handler = new_plugin_handler;
|
||||
}
|
||||
else
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_event_msg: IRC message received => call all handlers for this message
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_event_msg (char *irc_command, char *arguments, char *server)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments, server);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) irc_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_exec_command: execute a command handler
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_exec_command (char *user_command, char *arguments, char *server)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||
{
|
||||
if (strcasecmp (ptr_plugin_handler->name, user_command) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_PERL
|
||||
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||
wee_perl_exec (ptr_plugin_handler->function_name, arguments, server);
|
||||
#endif
|
||||
|
||||
/* command executed */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) user_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
|
||||
/* no command executed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_unload: unload all scripts for a plugin type
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_unload (int plugin_type, char *scriptname)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) scriptname;
|
||||
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
case PLUGIN_TYPE_PERL:
|
||||
#ifdef PLUGIN_PERL
|
||||
/* unload one Perl script is not allowed */
|
||||
wee_perl_end ();
|
||||
wee_perl_init ();
|
||||
#endif
|
||||
break;
|
||||
case PLUGIN_TYPE_PYTHON:
|
||||
/* TODO: unload Python scripts */
|
||||
break;
|
||||
case PLUGIN_TYPE_RUBY:
|
||||
/* TODO: unload Ruby scripts */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_end: shutdown plugin interface
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_end ()
|
||||
{
|
||||
plugin_handler_free_all (&plugin_msg_handlers, &last_plugin_msg_handler);
|
||||
plugin_handler_free_all (&plugin_cmd_handlers, &last_plugin_cmd_handler);
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
wee_perl_end();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PLUGINS_H
|
||||
#define __WEECHAT_PLUGINS_H 1
|
||||
|
||||
#define PLUGIN_TYPE_PERL 0
|
||||
#define PLUGIN_TYPE_PYTHON 1
|
||||
#define PLUGIN_TYPE_RUBY 2
|
||||
|
||||
typedef struct t_plugin_script t_plugin_script;
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
char *name; /* name of script */
|
||||
char *version; /* version of script */
|
||||
char *shutdown_func; /* function when script ends */
|
||||
char *description; /* description of script */
|
||||
t_plugin_script *prev_script; /* link to previous Perl script */
|
||||
t_plugin_script *next_script; /* link to next Perl script */
|
||||
};
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
struct t_plugin_handler
|
||||
{
|
||||
int plugin_type; /* plugin type (Perl, Python, Ruby) */
|
||||
char *name; /* name of IRC command (PRIVMSG, ..)
|
||||
or command (without first '/') */
|
||||
char *function_name; /* name of function (handler) */
|
||||
t_plugin_handler *prev_handler; /* link to previous handler */
|
||||
t_plugin_handler *next_handler; /* link to next handler */
|
||||
};
|
||||
|
||||
extern t_plugin_handler *plugin_msg_handlers;
|
||||
extern t_plugin_handler *last_plugin_msg_handler;
|
||||
|
||||
extern t_plugin_handler *plugin_cmd_handlers;
|
||||
extern t_plugin_handler *last_plugin_cmd_handler;
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
extern t_plugin_script *perl_scripts;
|
||||
#endif
|
||||
|
||||
extern void plugin_auto_load (int, char *);
|
||||
extern void plugin_init ();
|
||||
extern void plugin_load (int, char *);
|
||||
extern void plugin_unload (int, /*@null@*/ char *);
|
||||
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *);
|
||||
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **,
|
||||
int, char *, char *);
|
||||
extern void plugin_handler_free_all_type (t_plugin_handler **,
|
||||
t_plugin_handler **, int);
|
||||
extern void plugin_event_msg (char *, char *, char *);
|
||||
extern int plugin_exec_command (char *, /*@null@*/ char *, char *);
|
||||
extern void plugin_end ();
|
||||
|
||||
#endif /* plugins.h */
|
||||
-311
@@ -1,311 +0,0 @@
|
||||
/* ############################################################################
|
||||
* ### ___ __ ______________ _____ ###
|
||||
* ### __ | / /___________ ____/__ /_______ __ /_ ###
|
||||
* ### __ | /| / /_ _ \ _ \ / __ __ \ __ `/ __/ ###
|
||||
* ### __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ ###
|
||||
* ### ____/|__/ \___/\___/\____/ /_/ /_/\__,_/ \__/ ###
|
||||
* ### ###
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By: FlashCode <flashcode@flashtux.org> ###
|
||||
* ### Bounga <bounga@altern.org> ###
|
||||
* ### Xahlexx <xahlexx@tuxisland.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
||||
* Bounga <bounga@altern.org>
|
||||
* Xahlexx <xahlexx@tuxisland.org>
|
||||
* See README for License detail.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* weechat.c: core functions for WeeChat */
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "config.h"
|
||||
#include "command.h"
|
||||
#include "irc/irc.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
||||
/* char *display_name; */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
|
||||
FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log */
|
||||
|
||||
|
||||
/*
|
||||
* log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
|
||||
void
|
||||
log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
|
||||
if (!log_file)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
fflush (log_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
|
||||
void
|
||||
wee_parse_args (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_USAGE);
|
||||
exit (0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
exit (0);
|
||||
}
|
||||
/*else if ((strcmp (argv[i], "-d") == 0)
|
||||
|| (strcmp (argv[i], "--display") == 0))
|
||||
{
|
||||
if (i == (argc - 1))
|
||||
fprintf (stderr,
|
||||
_("%s no display specified (parameter '%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
else
|
||||
{
|
||||
display_name = argv[i + 1];
|
||||
i++;
|
||||
}
|
||||
}*/
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (WEECHAT_VERSION "\n");
|
||||
exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s unknown parameter '%s', ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_home_dir: create weechat home directory (if not found)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_create_home_dir ()
|
||||
{
|
||||
char *weechat_home_dir;
|
||||
int return_code;
|
||||
|
||||
weechat_home_dir =
|
||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
||||
sprintf (weechat_home_dir, "%s/.weechat", getenv ("HOME"));
|
||||
return_code = mkdir (weechat_home_dir, 0755);
|
||||
if (return_code < 0)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||
WEECHAT_ERROR, weechat_home_dir);
|
||||
free (weechat_home_dir);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
free (weechat_home_dir);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_vars: initialize some variables
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_vars ()
|
||||
{
|
||||
/* GUI not yet initialized */
|
||||
gui_ready = 0;
|
||||
|
||||
/* init received messages queue */
|
||||
recv_msgq = NULL;
|
||||
msgq_last_msg = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_log: initialize log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_log ()
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename =
|
||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
||||
sprintf (filename, "%s/.weechat/" WEECHAT_LOG_NAME, getenv ("HOME"));
|
||||
if ((log_file = fopen (filename, "wt")) == NULL)
|
||||
{
|
||||
free (filename);
|
||||
fprintf (stderr,
|
||||
_("%s unable to create/append to log file (~/.weechat/"
|
||||
WEECHAT_LOG_NAME), WEECHAT_ERROR);
|
||||
}
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown ()
|
||||
{
|
||||
gui_end ();
|
||||
server_free_all ();
|
||||
if (log_file)
|
||||
fclose (log_file);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* main: WeeChat startup
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* initialize variables */
|
||||
wee_init_vars ();
|
||||
|
||||
/* parse command line args */
|
||||
wee_parse_args (argc, argv);
|
||||
|
||||
/* create weechat home directory */
|
||||
wee_create_home_dir ();
|
||||
|
||||
/* init log file */
|
||||
wee_init_log ();
|
||||
|
||||
/* read configuration */
|
||||
switch (config_read ())
|
||||
{
|
||||
case 0: /* success */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
config_create_default ();
|
||||
config_read ();
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* init gui */
|
||||
gui_init ();
|
||||
|
||||
/* build commands index (sorted), for completion */
|
||||
index_command_build ();
|
||||
|
||||
/* Welcome message - yeah! */
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
" ___ __ ______________ _____ \n"
|
||||
" __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
|
||||
}
|
||||
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, WEECHAT_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s\n", cfg_look_weechat_slogan);
|
||||
}
|
||||
if (cfg_look_startup_version)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||
"%s" WEECHAT_NAME_AND_VERSION,
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s %s %s\n",
|
||||
_("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
if (cfg_look_startup_logo ||
|
||||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
|
||||
cfg_look_startup_version)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||
|
||||
/* connect to all servers */
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
server_create_window (ptr_server);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
gui_main_loop ();
|
||||
server_disconnect_all ();
|
||||
|
||||
/* program ending */
|
||||
wee_shutdown ();
|
||||
|
||||
/* make gcc happy (statement never executed) */
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
.TH WEECHAT 1 "February 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B weechat-curses
|
||||
.RI [ options... ]
|
||||
or
|
||||
.RI [ url... ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Fast, light and extensible IRC client for many operating systems.
|
||||
.br
|
||||
Everything can be done with a keyboard. It is customizable and extensible with scripts.
|
||||
Many GUIs are available (Curses, Gtk, Qt, and text).
|
||||
It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-c, \-\-config
|
||||
.br
|
||||
display config file help (list of options)
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
.br
|
||||
display summary of options
|
||||
.TP
|
||||
.B \-l, \-\-license
|
||||
.br
|
||||
display program license
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
.br
|
||||
display WeeChat version
|
||||
|
||||
.SH URL
|
||||
WeeChat can use an URL (Uniform Resource Locator) to automatically connect
|
||||
to an IRC server. These are in the following form:
|
||||
.TP
|
||||
.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel]
|
||||
.TP
|
||||
Exemple to join WeeChat channel support with nick "FlashCode":
|
||||
irc://FlashCode@irc.freenode.net/weechat
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $HOME/.weechat/weechat.rc
|
||||
configuration file for WeeChat
|
||||
.TP
|
||||
.B $HOME/.weechat/weechat.log
|
||||
WeeChat log file
|
||||
|
||||
.SH AUTHOR
|
||||
WeeChat is written by:
|
||||
.br
|
||||
- FlashCode <flashcode@flashtux.org>
|
||||
- Bounga <bounga@altern.org>
|
||||
- Xahlexx <xahlexx@weeland.org>
|
||||
.br
|
||||
WeeChat on the web:
|
||||
.UR
|
||||
http://weechat.flashtux.org
|
||||
.br
|
||||
Get support there:
|
||||
.UR
|
||||
http://weechat.flashtux.org/support.php
|
||||
.UE
|
||||
@@ -1,44 +0,0 @@
|
||||
.TH WEECHAT 1 "September 2003" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat \- wee enhanced environment for chat
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B weechat
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Fast, light and extensible IRC client for many operating systems. Everything can be
|
||||
done with a keyboard. It is customizable and extensible with scripts.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
.br
|
||||
display summary of options
|
||||
.TP
|
||||
.B \-l, \-\-license
|
||||
.br
|
||||
display program license
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
.br
|
||||
display WeeChat version
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $HOME/.weechat/weechat.rc
|
||||
configuration file for WeeChat
|
||||
|
||||
.SH AUTHOR
|
||||
WeeChat is written by:
|
||||
.br
|
||||
- FlashCode <flashcode@flashtux.org>
|
||||
- Bounga <bounga@altern.org>
|
||||
- Xahlexx <xahlexx@tuxisland.org>
|
||||
.br
|
||||
WeeChat on the web:
|
||||
.UR
|
||||
http://weechat.flashtux.org
|
||||
.UE
|
||||
+28
-6
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.1
|
||||
%define version 0.1.0
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -10,6 +10,7 @@ Source: http://weechat.flashtux.org/download/%{name}-%{version}.tar.gz
|
||||
URL: http://weechat.flashtux.org
|
||||
Group: Networking/IRC
|
||||
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||||
Requires: perl
|
||||
License: GPL
|
||||
|
||||
%description
|
||||
@@ -22,20 +23,41 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure --enable-perl
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
|
||||
|
||||
%install
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
|
||||
|
||||
%find_lang %name
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root,0755)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
|
||||
/usr/share/man/man1/weechat.1*
|
||||
/usr/local/bin/weechat
|
||||
%doc AUTHORS BUGS ChangeLog COPYING FAQ FAQ.fr INSTALL NEWS README TODO
|
||||
/usr/local/man/man1/weechat-curses.1*
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Thu Sep 27 2003 FlashCode <flashcode@flashtux.org> 0.0.1-1
|
||||
* Sat Feb 12 2005 FlashCode <flashcode@flashtux.org> 0.1.0-1
|
||||
- Released version 0.1.0
|
||||
* Sat Jan 01 2005 FlashCode <flashcode@flashtux.org> 0.0.9-1
|
||||
- Released version 0.0.9
|
||||
* Sat Oct 30 2004 FlashCode <flashcode@flashtux.org> 0.0.8-1
|
||||
- Released version 0.0.8
|
||||
* Sat Aug 08 2004 FlashCode <flashcode@flashtux.org> 0.0.7-1
|
||||
- Released version 0.0.7
|
||||
* Sat Jun 05 2004 FlashCode <flashcode@flashtux.org> 0.0.6-1
|
||||
- Released version 0.0.6
|
||||
* Thu Feb 02 2004 FlashCode <flashcode@flashtux.org> 0.0.5-1
|
||||
- Released version 0.0.5
|
||||
* Thu Jan 01 2004 FlashCode <flashcode@flashtux.org> 0.0.4-1
|
||||
- Released version 0.0.4
|
||||
* Mon Nov 03 2003 FlashCode <flashcode@flashtux.org> 0.0.3-1
|
||||
- Released version 0.0.3
|
||||
* Sun Oct 05 2003 FlashCode <flashcode@flashtux.org> 0.0.2-1
|
||||
- Released version 0.0.2
|
||||
* Sat Sep 27 2003 FlashCode <flashcode@flashtux.org> 0.0.1-1
|
||||
- Released version 0.0.1
|
||||
|
||||
+17
-11
@@ -1,29 +1,35 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
Developer:
|
||||
---------
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Testers:
|
||||
-------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@tuxisland.org>
|
||||
Web : http://www.tuxisland.org
|
||||
IRC : nick is "xahlexx"
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
+11
-13
@@ -1,17 +1,15 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2003-09-27
|
||||
WeeChat known bugs, 2005-02-12
|
||||
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(irc protocol is under dev!)
|
||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
||||
problem)
|
||||
- alias/unalias commands doesn't work
|
||||
- config is not saved (to ~/.weechat/weechatrc)
|
||||
- intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!)
|
||||
- program is stopped when bad option in config file (it should not, only display
|
||||
warning)
|
||||
- too much opened channel => display bug
|
||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => some nicks are hidden
|
||||
- when quitting WeeChat term title is not restored (if look_set_title is ON)
|
||||
- command name for /server can not contain spaces
|
||||
- wrong alias is not created and not saved when quitting WeeChat
|
||||
- when many WeeChat are launched, log file is not properly written (cleared by
|
||||
each WeeChat at startup)
|
||||
- display problems with old Konsole versions (Kde terminal) (???)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user