+Tue May 7 20:41:58 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Merged with Irssi CVS for Irssi SILC client.
+
Tue May 7 11:07:16 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
* Added the founder's public key delivery to the
am_opt=--include-deps;;
esac
-rm -f aclocal.m4
+rm -f aclocal.m4 glib.m4 glib-2.0.m4
if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
aclocalinclude="$ACLOCAL_FLAGS -I ."
echo "Running aclocal $aclocalinclude ..."
+
+# see if we don't have glib.m4 or glib-2.0.m4 there yet
+error=`aclocal $aclocalinclude 2>&1`
+if test "x`echo $error|grep 'AM_PATH_GLIB[^_]'`" != "x"; then
+ cp glib.m4_ glib.m4
+ error=`aclocal $aclocalinclude 2>&1`
+fi
+if test "x`echo $error|grep AM_PATH_GLIB_2_0`" != "x"; then
+ cp glib-2.0.m4_ glib-2.0.m4
+fi
+
aclocal $aclocalinclude
+
+# aclocal for some reason doesn't complain about glib2, so we still need
+# to check it later again..
+if grep "^AC_DEFUN.AM_PATH_GLIB_2_0" aclocal.m4 >/dev/null; then :;
+else
+ cp glib-2.0.m4_ glib-2.0.m4
+ aclocal $aclocalinclude
+fi
+
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
echo "Running autoheader..."
autoheader
perl_prefix_note=yes
fi
+AC_ARG_WITH(tests,
+[ --with-glib2 Use GLIB 2.0 instead of 1.2],
+ if test x$withval = xyes; then
+ want_glib2=yes
+ else
+ if test "x$withval" = xno; then
+ want_glib2=no
+ else
+ want_glib2=yes
+ fi
+ fi,
+ want_glib2=yes)
+
AC_ARG_WITH(perl-staticlib,
[ --with-perl-staticlib Specify that we want to link perl libraries
statically in irssi, default is no],
AC_CHECK_GLIBDIR
if test -z "$GLIB_DIR"; then
- AM_PATH_GLIB(1.2.0,,, gmodule)
- if test -z "$GLIB_LIBS"; then
- echo "*** trying without -lgmodule"
- glib_config_args=
- AM_PATH_GLIB(1.2.0)
+ if test "x$with_glib2" = "xyes"; then
+ dnl * check only for glib2
+ checks="3 4"
else
- AC_DEFINE(HAVE_GMODULE)
- have_gmodule=yes
+ dnl * check glib1 then glib2
+ checks="1 2 3 4"
fi
+ for try in $checks; do
+ glib_config_args=
+ if test $try = 1 -o $try = 3; then
+ glib_modules=gmodule
+ else
+ echo "*** trying without -lgmodule"
+ glib_modules=
+ fi
+ if test $try = 1 -o $try = 2; then
+ AM_PATH_GLIB(1.2.0,,, $glib_modules)
+ else
+ AM_PATH_GLIB_2_0(2.0.0,,, $glib_modules)
+ fi
+ if test "$GLIB_LIBS"; then
+ if test $glib_modules = gmodule; then
+ AC_DEFINE(HAVE_GMODULE)
+ have_gmodule=yes
+ fi
+ break
+ fi
+ done
+
if test -z "$GLIB_LIBS"; then
echo
echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org"
LIBS="$LIBS -ltermcap"
want_termcap=yes
], [
- AC_MSG_WARN(Terminfo/termcap not found)
+ AC_ERROR(Terminfo/termcap not found - install ncurses-devel package)
want_textui=no
- curses_error=yes
])))
fi
if test "x$want_termcap" = "xyes"; then
esac
dnl * check that perl's ldflags actually work
- AC_CACHE_VAL(irssi_cv_lib_perl_works, [
- echo "main(){perl_alloc(); return 0;}" > conftest.c
- $CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
- if test -s conftest; then
- irssi_cv_lib_perl_works=yes
- else
- irssi_cv_lib_perl_works=no
- fi
- ])
-
- if test "x$irssi_cv_lib_perl_works" = "xno"; then
+ echo "main(){perl_alloc(); return 0;}" > conftest.c
+ $CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
+ if test ! -s conftest; then
perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
AC_MSG_RESULT([error linking with perl libraries, building without Perl])
want_perl=no
fi
+
rm -f perl.error.tmp
fi
echo
-if test "x$curses_error" != "xyes"; then
- if test "x$want_textui" = "xno"; then
- text=no
- elif test "x$want_termcap" = "xyes"; then
- text="yes, using termcap"
- elif test "x$want_terminfo" = "xyes"; then
- text="yes, using terminfo"
- else
- text="yes, using curses"
- fi
- echo "Building text frontend ..... : $text"
+if test "x$want_textui" = "xno"; then
+ text=no
+elif test "x$want_termcap" = "xyes"; then
+ text="yes, using termcap"
+elif test "x$want_terminfo" = "xyes"; then
+ text="yes, using terminfo"
else
- echo "Building text frontend ..... : NO!!"
- echo " - Because curses was not found, specify the path to it with"
- echo " --with-curses=/dir and make sure you have the curses headers"
- echo " installed (usually in ncurses-devel package)"
+ text="yes, using curses"
fi
+echo "Building text frontend ..... : $text"
echo "Building irssi bot ......... : $want_irssibot"
echo "Building irssi proxy ....... : $want_irssiproxy"
echo "Building with IPv6 support . : $want_ipv6"
echo " - NOTE: Perl support will be compiled statically to irssi, not as"
echo " a module as requested. Reason:"
echo " $perl_mod_error"
+
+ if test -f /etc/debian_version; then
+ echo " - Try: apt-get install libperl-dev"
+ fi
fi
if test "x$want_perl" != "xno"; then
echo "Install prefix ............. : $prefix"
+echo
+echo "If there was any problems, read the INSTALL file."
#############################################################################
# default foreground color (%N) - 0 is the "default terminal color"
-default_color = 0;
+default_color = "-1";
-# default foreground color when "0" can't be used,
-# such as with bolds and reverses. white is default.
-default_real_color = 7;
+# print timestamp/servertag at the end of line, not at beginning
+info_eol = "false";
# these characters are automatically replaced with specified color
# (dark grey by default)
-replaces = {};
+replaces = { "()=" = "%K$*%n"; };
+#replaces = {};
abstracts = {
##
How to submit a good bug report?
+Send them to bugs@irssi.org.
+
First you should give the following information:
- irssi version, if CVS (or devel. tarball) then which day?
- operating system / distribution and it's version
text text background
---------------------------------------------------------------------
- %k %K %0 black bold black black
+ %k %K %0 black dark grey black
%r %R %1 red bold red red
%g %G %2 green bold green green
%y %Y %3 yellow bold yellow yellow
%9 %_ Bold on/off
%: Insert newline
%| Marks the indentation position
+ %# Monospace font on/off (useful with lists and GUI)
%% A single %
In .theme files %n works a bit differently. See default.theme
-nick: Hilight only the nick, not the whole line (default)
-word: Hilight only the word (default with non-public messages)
-line: Hilight the whole line with the hilight color.
- -color: Print the message with <color>. color is in %code format
+ -color: Print the message with <color>. color is in %%code format
(see docs/formats.txt)
+ -actcolor: Color to show in statusbar activity, or don't change if %%n.
-level: Match only for <level> messages, default is
publics,msgs,notices,actions
-channels: Match only in <channels>
/HILIGHT mynick
Hilight lines that were written by nicks from *.fi with bold green
- /HILIGHT -color %G -mask *!*@*.fi
+ /HILIGHT -color %%G -mask *!*@*.fi
For regular expressions, see `man 7 regex`.
ACTIONS - Actions (/me) - usually ORed with PUBLIC or MSGS
JOINS - Someone joins a channel
PARTS - Someone parts a channel
- QUITS - Someone quits network
+ QUITS - Someone quits IRC
KICKS - Someone gets kicked from channel
MODES - Channel mode is changed
TOPICS - Channel topic is changed
NICKS - Someone changes nick
DCC - DCC related messages
DCCMSGS - DCC chat messages
- CLIENTNOTICES - Irssi's notices
- CLIENTERRORS - Irssi's error messages
+ CLIENTNOTICE - Irssi's notices
+ CLIENTERROR - Irssi's error messages
CLIENTCRAP - Some other messages from Irssi
And a few special ones that could be included with the
Irssi 0.8 documentation - http://irssi.org/
- Copyright(c) 2000 Timo Sirainen <tss@iki.fi>
+ Copyright(c) 2000 Timo Sirainen <cras@irssi.org>
Index
Channel::bans()
Return a list of bans in channel.
-Channel::ebans()
- Return a list of ban exceptions in channel.
-
-Channel::invites()
- Return invite list (+I) of channel.
-
Channel::ban_get_mask(nick)
Get ban mask for `nick'.
Channel::banlist_remove(ban)
Remove a ban from channel.
-Channel::banlist_exception_add(ban, nick, time)
- Add a new ban exception to channel.
-
-Channel::banlist_exception_remove(ban)
- Remove a ban exception from channel.
-
-Channel::invitelist_add(mask)
- Add a new invite mask to channel.
-
-Channel::invitelist_remove(mask)
- Remove invite mask from channel.
-
-modes_join(old, mode, channel)
- Add `mode' to `old' - return newly allocated mode. If `channel' is 1,
- we're parsing channel mode and we should try to join mode arguments too.
-
*** DCC
"query created", QUERY_REC, int automatic
"query destroyed", QUERY_REC
"query nick changed", QUERY_REC, char *orignick
+ "window item name changed", WI_ITEM_REC
"query address changed", QUERY_REC
"query server changed", QUERY_REC, SERVER_REC
"ban remove", CHANNEL_REC, BAN_REC
modes.c:
- "channel mode changed", CHANNEL_REC
- "nick mode changed", CHANNEL_REC, NICK_REC
+ "channel mode changed", CHANNEL_REC, char *setby
+ "nick mode changed", CHANNEL_REC, NICK_REC, char *setby
"user mode changed", SERVER_REC, char *old
"away mode changed", SERVER_REC
* Requires to work properly:
- "gui print text", WINDOW_REC, int fg, int bg, int flags, char *text, int level
+ "gui print text", WINDOW_REC, int fg, int bg, int flags, char *text, TEXT_DEST_REC
(Can be used to determine when all "gui print text"s are sent (not required))
"gui print text finished", WINDOW_REC
"message irc own_ctcp", SERVER_REC, char *cmd, char *data, char *target
"message irc ctcp", SERVER_REC, char *cmd, char *data, char *nick, char *address, char *target
+fe-modes.c:
+ "message irc mode", SERVER_REC, char *channel, char *nick, char *addr, char *mode
+
dcc/fe-dcc-chat-messages.c:
"message dcc own", DCC_REC *dcc, char *msg
"message dcc own_action", DCC_REC *dcc, char *msg
<p>Index with some FAQ questions that are answered in the chapter:</p>
<ol>
-<li><a href="#c1">For all the lazy people</a></li>
+<li><a href="#c1">For all the lazy people</a>
<ul>
<li>This window management is just weird, I want it exactly like ircII</li>
- </ul>
+ </ul></li>
<li><a href="#c2">Basic user interface usage</a>
<ul>
<li>Split windows work in weird way</li>
+ <li>How can I easily switch between windows?</li>
+ <li>But alt-1 etc. don't work!</li>
</ul></li>
<li><a href="#c3">Server and channel automation</a>
<ul>
<li>How do I automatically connect to servers at startup?</li>
<li>How do I automatically join to channels at startup?</li>
+ <li>How do I automatically send commands to server at connect?</li>
</ul></li>
<li><a href="#c4">Setting up windows and automatically restoring them
at startup</a></li>
/SET use_msgs_window ON
</pre>
-<p>Disable automatic window closing when /PARTing channel or /UNQUERYing
-query:</p>
+<p>Disable automatic window closing when <code>/PART</code>ing channel or
+<code>/UNQUERY</code>ing query:</p>
<pre>
/SET autoclose_windows OFF
<p>Windows can be scrolled up/down with PgUp and PgDown keys. If they don't
work for you, use Meta-p and Meta-n keys. For jumping to beginning or end of
-the buffer, use /SB HOME and /SB END commands.</p>
+the buffer, use <code>/SB HOME</code> and <code>/SB END</code> commands.</p>
-<p>By default, irssi uses "hidden windows" for everything. Hidden
-window is created every time you /JOIN a channel or /QUERY someone.
-There's several ways you can change between these windows:</p>
+<p>By default, irssi uses "hidden windows" for everything. Hidden window is
+created every time you <code>/JOIN</code> a channel or <code>/QUERY</code>
+someone. There's several ways you can change between these windows:</p>
<pre>
Meta-1, Meta-2, .. Meta-0 - Jump directly between windows 1-10
</pre>
<p>And how exactly do you set these X resources? For Debian, there's
-/etc/X11/Xresources/xterm file where you can put them and it's read
-automatically when X starts. ~/.Xresources and ~/.Xdefaults files might also
-work. If you can't get anything else to work, just copy&paste those lines to
-~/.Xresources and directly call "xrdb -merge ~/.Xresources" in some xterm.
-The resources affect only the new xterms you start, not existing ones.</p>
+<code>/etc/X11/Xresources/xterm</code> file where you can put them and it's
+read automatically when X starts. <code>~/.Xresources</code> and
+<code>~/.Xdefaults</code> files might also work. If you can't get anything
+else to work, just copy and paste those lines to <code>~/.Xresources</code>
+and directly call <code>xrdb -merge ~/.Xresources</code> in some xterm.
+The resources affect only the new xterms you start, not existing ones.</p>
<p>Many windows SSH clients also don't allow usage of ALT. One excellent
client that does allow is putty, you can download it from
useful in some other ways too :) For information how to actually use
irssi correctly with multiple servers see the chapter 6.</p>
-<p>First you need to have your IRC network set, use /IRCNET command to
-see if it's already there. If it isn't, use /IRCNET ADD yourircnet. To
-make Irssi work properly with different IRC networks, you might need to
-give some special settings to /IRCNET ADD, see manual.txt for more
-information about them. Irssi defaults to IRCNet's behaviour.</p>
+<p>First you need to have your IRC network set, use <code>/IRCNET</code>
+command to see if it's already there. If it isn't, use <code>/IRCNET ADD
+yourircnet</code>. If you want to execute some commands automatically when
+you're connected to some network, use <code>-autosendcmd</code> option.
+Here's some examples:</p>
+
+<pre>
+ /IRCNET ADD -autosendcmd '^msg bot invite' ircnet
+ /IRCNET ADD -autosendcmd "/^msg nickserv ident pass;wait -opn 2000" opn
+</pre>
<p>After that you need to add your servers. For example:</p>
/SERVER ADD -auto -ircnet worknet irc.mycompany.com 6667 password
</pre>
-<p>The -auto option specifies that this server is automatically connected
-at startup. You don't need to make more than one server with -auto
-option to one IRC network, other servers are automatically connected in
-same network if the -auto server fails.</p>
+<p>The <code>-auto</code> option specifies that this server is
+automatically connected at startup. You don't need to make more than one
+server with <code>-auto</code> option to one IRC network, other servers are
+automatically connected in same network if the <code>-auto</code> server
+fails.</p>
<p>And finally channels:</p>
/CHANNEL ADD -auto #secret ircnet password
</pre>
-<p>-bots and -botcmd should be the only ones needing a bit of
-explaining. They're used to send commands automatically to bot when
-channel is joined, usually to get ops automatically. You can specify
-multiple bot masks with -bots option separated with spaces (and
-remember to quote the string then). The $0 in -botcmd specifies the
-first found bot in the list. If you don't need the bot masks (ie. the
-bot is always with the same nick, like chanserv) you can give only the
--botcmd option and the command is always sent.</p>
-
+<p><code>-bots</code> and <code>-botcmd</code> should be the only ones
+needing a bit of explaining. They're used to send commands automatically to
+bot when channel is joined, usually to get ops automatically. You can
+specify multiple bot masks with <code>-bots</code> option separated with
+spaces (and remember to quote the string then). The $0 in
+<code>-botcmd</code> specifies the first found bot in the list. If you
+don't need the bot masks (ie. the bot is always with the same nick, like
+chanserv) you can give only the <code>-botcmd</code> option and the command
+is always sent.</p>
<h3><a id="c4">4. Setting up windows and automatically restoring them at startup</a></h3>
/WINDOW ITEM MOVE <number>|<name> - move channel/query to another window
</pre>
-<p>When everything looks the way you like, use /LAYOUT SAVE command
-(and /SAVE, if you don't have autosaving enabled) and when you start
-irssi next time, irssi remembers the positions of the channels, queries
-and everything. This "remembering" doesn't mean that simply using
-/LAYOUT SAVE would automatically make irssi reconnect to all servers
-and join all channels, you'll need the /SERVER ADD -auto and /CHANNEL
-ADD -auto commands to do that.</p>
+<p>When everything looks the way you like, use <code>/LAYOUT SAVE</code>
+command (and <code>/SAVE</code>, if you don't have autosaving enabled) and
+when you start irssi next time, irssi remembers the positions of the
+channels, queries and everything. This "remembering" doesn't mean that
+simply using <code>/LAYOUT SAVE</code> would automatically make irssi
+reconnect to all servers and join all channels, you'll need the
+<code>/SERVER ADD -auto</code> and <code>/CHANNEL ADD -auto</code> commands
+to do that.</p>
<p>If you want to change the layout, you just rearrange the layout like
-you want it and use /LAYOUT SAVE again. If you want to remove the
-layout for some reason, use /LAYOUT RESET.</p>
+you want it and use <code>/LAYOUT SAVE</code> again. If you want to remove
+the layout for some reason, use <code>/LAYOUT RESET.</code></p>
<h3><a id="c5">5. Status and msgs windows & message levels</a></h3>
</pre>
<p>This doesn't have any effect until you restart irssi. If you want to
-remove it immediately, just /WINDOW CLOSE it.</p>
+remove it immediately, just <code>/WINDOW CLOSE</code> it.</p>
<p>Another common window is "messages window", where all private
messages go. By default it's disabled and query windows are created
</pre>
<p>Note that neither use_msgs_window nor use_status_window have any
-effect at all if /LAYOUT SAVE has been used.</p>
+effect at all if <code>/LAYOUT SAVE</code> has been used.</p>
<p>This brings us to message levels.. What are they? All messages that
irssi prints have one or more "message levels". Most common are PUBLIC
/HELP levels
</pre>
-<p>Status window has message level "ALL -MSGS", meaning that all messages,
-except private messages, without more specific place go to status
-window. The -MSGS is there so it doesn't conflict with messages
-window.</p>
+<p>Status window has message level <code>ALL -MSGS</code>, meaning that all
+messages, except private messages, without more specific place go to status
+window. The <code>-MSGS</code> is there so it doesn't conflict with
+messages window.</p>
<h3><a id="c6">6. How support for multiple servers works in irssi</a></h3>
/CONNECT irc.server.org
</pre>
-<p>Instead of the /SERVER which disconnects the existing connection. To
-see list of all active connections, use /SERVER without any parameters.
-You should see a list of something like:</p>
+<p>Instead of the <code>/SERVER</code> which disconnects the existing
+connection. To see list of all active connections, use <code>/SERVER</code>
+without any parameters. You should see a list of something like:</p>
<pre>
-!- IRCNet: irc.song.fi:6667 (IRCNet)
adds a number after the tag so there could be ircnet, ircnet2, ircnet3
etc.</p>
-<p>Server tags beginning with RECON- mean server reconnections. Above we
-see that connection to server at 192.168.0.1 wasn't successful and
-irssi will try to connect it again in 3 minutes.</p>
+<p>Server tags beginning with <code>RECON-</code> mean server
+reconnections. Above we see that connection to server at 192.168.0.1 wasn't
+successful and irssi will try to connect it again in 3 minutes.</p>
<p>To disconnect one of the servers, or to stop irssi from
reconnecting, use</p>
messages in non-channel/query messages so you'll know where it came
from.</p>
-<p>Several commands also accept -servertag option to specify which server
-it should use:</p>
+<p>Several commands also accept <code>-servertag</code> option to specify
+which server it should use:</p>
<pre>
/MSG -tag nick message
/QUERY -tag nick
</pre>
-<p>/MSG tab completion also automatically adds the -tag option when
-nick isn't in active server.</p>
+<p><code>/MSG</code> tab completion also automatically adds the
+<code>-tag</code> option when nick isn't in active server.</p>
<p>Window's server can be made sticky. When sticky, it will never
automatically change to anything else, and if server gets disconnected, the
<h3><a id="c7">7. /LASTLOG and jumping around in scrollback</a></h3>
-<p>/LASTLOG command can be used for searching texts in scrollback
-buffer. Simplest usages are</p>
+<p><code>/LASTLOG</code> command can be used for searching texts in
+scrollback buffer. Simplest usages are</p>
<pre>
/LASTLOG word - print all lines with "word" in them
</pre>
<p>If there's more than 1000 lines to be printed, irssi thinks that you
-probably made some mistake and won't print them without -force option.
-If you want to save the full lastlog to file, use</p>
+probably made some mistake and won't print them without <code>-force</code>
+option. If you want to save the full lastlog to file, use</p>
<pre>
/LASTLOG -file ~/irc.log
</pre>
-<p>With -file option you don't need -force even if there's more than 1000
-lines. /LASTLOG has a lot of other options too, see /HELP lastlog for
-details.</p>
+<p>With <code>-file</code> option you don't need <code>-force</code> even
+if there's more than 1000 lines. <code>/LASTLOG</code> has a lot of other
+options too, see <code>/HELP lastlog</code> for details.</p>
<p>Once you've found the lines you were interested in, you might want
-to check the discussion around them. Irssi has /SCROLLBACK (or alias
-/SB) command for jumping around in scrollback buffer. Since /LASTLOG
-prints the timestamp when the message was originally printed, you can
-use /SB GOTO hh:mm to jump directly there. To get back to the bottom of
-scrollback, use /SB END command.</p>
+to check the discussion around them. Irssi has <code>/SCROLLBACK</code> (or
+alias <code>/SB</code>) command for jumping around in scrollback buffer.
+Since <code>/LASTLOG</code> prints the timestamp when the message was
+originally printed, you can use <code>/SB GOTO hh:mm</code> to jump
+directly there. To get back to the bottom of scrollback, use <code>/SB
+END</code> command.</p>
<h3><a id="c8">8. Logging</a></h3>
<p>Irssi can automatically log important messages when you're set away
-(/AWAY reason). When you set yourself unaway (/AWAY), the new messages
-in away log are printed to screen. You can configure it with:</p>
+(<code>/AWAY reason</code>). When you set yourself unaway
+(<code>/AWAY</code>), the new messages in away log are printed to screen.
+You can configure it with:</p>
<pre>
/SET awaylog_level MSGS HILIGHT - Specifies what messages to log
</pre>
<p>By default it logs pretty much everything execept CTCPS or CRAP
-(/WHOIS requests, etc). You can specify the logging level yourself with</p>
+(<code>/WHOIS</code> requests, etc). You can specify the logging level
+yourself with</p>
<pre>
/SET autolog_level ALL -CRAP -CLIENTCRAP -CTCPS (this is the default)
/SET autolog_path ~/irclogs/%Y/$tag/$0.%m-%d.log
</pre>
-<p>For logging only some specific channels or nicks, see /HELP log</p>
+<p>For logging only some specific channels or nicks, see <code>/HELP
+log</code></p>
<h3><a id="c9">9. Changing keyboard bindings</a></h3>
shift-backspace can't be bound unless you modify xterm resources
somehow.</p>
-<p>/HELP bind tells pretty much everything there is to know about
-keyboard bindings. However, there's the problem of how to bind some
-non-standard keys. They might differ a bit with each terminal, so
-you'll need to find out what exactly the keypress produces. Easiest
-way to check that would be to see what it prints in "cat". Here's
-an example for pressing F1 key:</p>
+<p><code>/HELP bind</code> tells pretty much everything there is to know
+about keyboard bindings. However, there's the problem of how to bind some
+non-standard keys. They might differ a bit with each terminal, so you'll
+need to find out what exactly the keypress produces. Easiest way to check
+that would be to see what it prints in <code>cat</code>. Here's an example
+for pressing F1 key:</p>
<pre>
-[cras@hurina] ~% cat
-^[OP
+ [cras@hurina] ~% cat
+ ^[OP
</pre>
-<p>So in irssi you would use /BIND ^[OP /ECHO F1 pressed. If you use
-multiple terminals which have different bindings for the key, it would
-be better to use eg.:</p>
+<p>So in irssi you would use <code>/BIND ^[OP /ECHO F1</code> pressed. If
+you use multiple terminals which have different bindings for the key, it
+would be better to use eg.:</p>
<pre>
-/BIND ^[OP key F1
-/BIND ^[11~ key F1
-/BIND F1 /ECHO F1 pressed.
+ /BIND ^[OP key F1
+ /BIND ^[11~ key F1
+ /BIND F1 /ECHO F1 pressed.
</pre>
<h3><a id="c10">10. Proxies and IRC bouncers</a></h3>
<p>Irssi supports connecting to IRC servers via a proxy. All server
connections are then made through it, and if you've set up everything
-properly, you don't need to do any /QUOTE SERVER commands manually.</p>
+properly, you don't need to do any <code>/QUOTE SERVER</code> commands
+manually.</p>
<p>Here's an example: You have your bouncer (lets say, BNC or BNC-like)
listening in irc.bouncer.org port 5000. You want to use it to connect
/SERVER ADD -auto -ircnet efnet irc.efnet.org
</pre>
-<p>With the proxy /SETs however, irssi now connects to those servers
-through your BNC. All server connections are made through them so you
-can just forget that your bouncer even exists.</p>
+<p>With the proxy <code>/SET</code>s however, irssi now connects to those
+servers through your BNC. All server connections are made through them so
+you can just forget that your bouncer even exists.</p>
-<p>If you don't want to use the proxy for some reason, there's -noproxy
-option which you can give to /SERVER and /SERVER ADD commands.</p>
+<p>If you don't want to use the proxy for some reason, there's
+<code>-noproxy</code> option which you can give to <code>/SERVER</code> and
+<code>/SERVER ADD</code> commands.</p>
<p><strong>Proxy specific settings:</strong></p>
/SERVER ADD -auto -ircnet opn fake.opn 6667 opnpass
</pre>
-<p>So, you'll specify the usernames with /IRCNET ADD command, and the
-user's password with /SERVER ADD.</p>
+<p>So, you'll specify the usernames with <code>/IRCNET ADD</code> command,
+and the user's password with <code>/SERVER ADD</code>.</p>
<p><strong>Irssi proxy</strong></p>
<p>Irssi contains it's own proxy which you can build giving
-<strong>--with-proxy</strong> option to configure. You'll still need to run
+<code>--with-proxy</code> option to configure. You'll still need to run
irssi in a screen to use it though.</p>
<p>Irssi proxy is a bit different than most proxies, normally proxies
create a new connection to IRC server when you connect to it, but
<strong>irssi proxy shares your existing IRC connection(s) to multiple
-clients</strong>.</p>
+clients</strong>. And even more clearly: <strong>You can use only one IRC
+server connection to IRC with as many clients as you want</strong>. Can
+anyone figure out even more easier ways to say this, so I wouldn't need to
+try to explain this thing for minutes every time? :)</p>
<p>Irssi proxy supports sharing multiple server connections in different
ports, like you can share ircnet in port 2777 and efnet in port 2778.</p>
</pre>
<p><strong>NOTE</strong>: you <strong>MUST</strong> add all the servers you
-are using to server and ircnet lists with /SERVER ADD and /IRCNET ADD.
-..Except if you really don't want to for some reason, and you only use
-one server connection, you may simply set:</p>
+are using to server and ircnet lists with <code>/SERVER ADD</code> and
+<code>/IRCNET ADD</code>. ..Except if you really don't want to for some
+reason, and you only use one server connection, you may simply set:</p>
<pre>
/SET irssiproxy_ports *=2777
<p>Usage in client side:</p>
<p>Just connect to the irssi proxy like it is a normal server with password
-specified in /SET irssiproxy_password. For example:</p>
+specified in <code>/SET irssiproxy_password</code>. For example:</p>
<pre>
/SERVER ADD -ircnet ircnet my.irssi-proxy.org 2777 secret
<p><strong>SOCKS</strong></p>
-Irssi can be compiled with socks support (<strong>--with-socks</strong>
-option to configure), but I don't really know how it works, if at all. /SET
-proxy settings don't have anything to do with socks however.
+Irssi can be compiled with socks support (<code>--with-socks</code> option
+to configure), but I don't really know how it works, if at all. <code>/SET
+proxy</code> settings don't have anything to do with socks however.
<p><strong>Others</strong></p>
<dl>
<dt>/SET autocreate_own_query ON</dt>
<dd>Should new query window be created when you send message to someone
- (with /msg).</dd>
+ (with <code>/MSG</code>).</dd>
<dt>/SET autocreate_query_level MSGS</dt>
<dd>New query window should be created when receiving messages with
this level. MSGS, DCCMSGS and NOTICES levels work currently. You can
- disable this with /SET -clear autocrate_query_level.</dd>
+ disable this with <code>/SET -clear autocrate_query_level</code>.</dd>
<dt>/SET autoclose_query 0</dt>
<dd>Query windows can be automatically closed after certain time of
<dt>/SET use_status_window ON</dt>
<dd>Create status window at startup. All messages that don't really
have better place go here, like all /WHOIS replies etc. Status window
- can also be created manually with /WINDOW LEVEL ALL -MSGS, /WINDOW NAME
- (status).</dd>
+ can also be created manually with <code>/WINDOW LEVEL ALL -MSGS</code>,
+ <code>/WINDOW NAME (status)</code>.</dd>
<dt>/SET autocreate_windows ON</dt>
<dd>Should we create new windows for new window items or just place
<dt>/SET autoclose_windows ON</dt>
<dd>Should window be automatically closed when the last item in them is
- removed (ie. /PART, /UNQUERY).</dd>
+ removed (ie. <code>/PART</code>, <code>/UNQUERY</code>).</dd>
<dt>/SET reuse_unused_windows OFF</dt>
<dd>When finding where to place new window item (channel, query) Irssi
ignored if autoclose_windows is set ON.</dd>
<dt>/SET window_auto_change OFF</dt>
- <dd>Should Irssi automatically change to automatically created windows
- - usually queries when someone sends you a message. To prevent
+ <dd>Should Irssi automatically change to automatically created windows -
+ usually queries when someone sends you a message. To prevent
accidentally sending text meant to some other channel/nick, Irssi
clears the input buffer when changing the window. The text is still in
scrollback buffer, you can get it back with pressing arrow up key.</dd>
<dt>/SET print_active_channel OFF</dt>
<dd>When you keep more than one channel in same window, Irssi prints
- the messages coming to active channel as "<nick> text"
- and other channels as "<nick:channel> text". If this
+ the messages coming to active channel as <code><nick> text</code>
+ and other channels as <code><nick:channel> text</code>. If this
setting is set ON, the messages to active channels are also printed in
the latter way.</dd>
<dt>/SET show_nickmode ON</dt>
<dd>Show the nick's mode before nick in channels, ie. ops have
- <@nick>, voices <+nick> and others < nick></dd>
+ <code><@nick></code>, voices <code><+nick></code> and others
+ <code>< nick></code></dd>
<dt>/SET show_nickmode_empty ON</dt>
<dd>If the nick doesn't have a mode, use one space. ie. ON:
- < nick>, OFF: <nick></dd>
+ <code>< nick></code>, OFF: <code><nick></code></dd>
<dt>/SET show_quit_once OFF</dt>
<dd>Show quit message only once in some of the channel windows the
<dd>When lines are longer than screen width they have to be split to
multiple lines. This specifies how much space to put at the beginning
of the line before the text begins. This can be overridden in text
- formats with %| format.</dd>
+ formats with <code>%|</code> format.</dd>
<dt>/SET activity_hide_targets</dt>
<dd>If you don't want to see window activity in some certain channels
- or queries, list them here. For example "#boringchannel =bot1 =bot2".
- If any highlighted text or message for you appears in that window, this
- setting is ignored and the activity is shown.</dd>
+ or queries, list them here. For example <code>#boringchannel =bot1
+ =bot2</code>. If any highlighted text or message for you appears in that
+ window, this setting is ignored and the activity is shown.</dd>
</dl>
<p><strong>Nick completion</strong></p>
<h3><a id="c12">12. Statusbar</a></h3>
-<p><strong>/STATUSBAR</strong> displays a list of statusbars:</p>
+<p><code>/STATUSBAR</code> displays a list of statusbars:</p>
<pre>
-Name Type Placement Position Visible
-window window bottom 0 always
-window_inact window bottom 1 inactive
-prompt root bottom 100 always
-topic root top 1 always
+ Name Type Placement Position Visible
+ window window bottom 0 always
+ window_inact window bottom 1 inactive
+ prompt root bottom 100 always
+ topic root top 1 always
</pre>
-<p><strong>/STATUSBAR <name></strong> prints the statusbar
-settings and it's items. <strong>/STATUSBAR <name>
-ENABLE|DISABLE</strong> enables/disables the statusbar.
-<strong>/STATUSBAR <name> RESET</strong> resets the statusbar to
-it's default settings, or if the statusbar was created by you, it will be
-removed.</p>
+<p><code>/STATUSBAR <name></code> prints the statusbar settings and
+it's items. <code>/STATUSBAR <name> ENABLE|DISABLE</code>
+enables/disables the statusbar. <code>/STATUSBAR <name> RESET</code>
+resets the statusbar to it's default settings, or if the statusbar was
+created by you, it will be removed.</p>
<p>Type can be window or root, meaning if the statusbar should be
created for each split window, or just once. Placement can be top or
useful only with split windows, one split window is active and the rest
are inactive. These settings can be changed with:</p>
-<ul>
-<li>STATUSBAR <name> TYPE window|root</li>
-<li>STATUSBAR <name> PLACEMENT top|bottom</li>
-<li>STATUSBAR <name> POSITION <num></li>
-<li>STATUSBAR <name> VISIBLE always|active|inactive</li>
-</ul>
+<pre>
+ STATUSBAR <name> TYPE window|root
+ STATUSBAR <name> PLACEMENT top|bottom
+ STATUSBAR <name> POSITION <num>
+ STATUSBAR <name> VISIBLE always|active|inactive
+</pre>
<p>When loading a new statusbar scripts, you'll need to also specify
where you want to show it. Statusbar items can be modified with:</p>
-<ul>
-<li>10:52 STATUSBAR <name> ADD [-before | -after <item>] [-priority #] [-alignment left|right] <item></li>
-<li>10:52 STATUSBAR <name> REMOVE <item></li>
-</ul>
+<pre>
+ STATUSBAR <name> ADD [-before | -after <item>] [-priority #] [-alignment left|right] <item>
+ STATUSBAR <name> REMOVE <item>
+</pre>
<p>The item name with statusbar scripts is usually same as the script's
name. Script's documentation should tell if this isn't the case. So, to
add mail.pl before the window activity item (see the list with
-/STATUSBAR window), use: <strong>/STATUSBAR window ADD -before act
-mail</strong>.</p>
+<code>/STATUSBAR</code> window), use: <code>/STATUSBAR window ADD -before
+act mail</code>.</p>
UPTIME = "eval exec - expr `date +%s` - \\$F | awk '{print \"Irssi uptime: \"int(\\\\\\$1/3600/24)\"d \"int(\\\\\\$1/3600%24)\"h \"int(\\\\\\$1/60%60)\"m \"int(\\\\\\$1%60)\"s\" }'";
CALC = "exec - if which bc &>/dev/null\\; then echo '$*' | bc | awk '{print \"$*=\"$$1}'\\; else echo bc was not found\\; fi";
SBAR = "STATUSBAR";
+ Q = "QUERY";
};
#
user = "{sb $cumode$N{sbaway $A}}";
usermode = " {sbusermode $usermode}";
topic = " $topic";
+ topic_empty = " Irssi v$J - http://irssi.org/help/";
# treated specially .. window is printed with non-empty windows,
# window_empty is printed with empty windows
items = {
barstart = { priority = "100"; };
topic = { };
+ topic_empty = { };
barend = { priority = "100"; alignment = "right"; };
};
};
#ifndef __COMMON_H
#define __COMMON_H
-#define IRSSI_AUTHOR "Timo Sirainen <tss@iki.fi>"
+#define IRSSI_AUTHOR "Timo Sirainen <cras@irssi.org>"
#define IRSSI_WEBSITE "http://irssi.org/"
#define IRSSI_DIR_SHORT "~/.silc"
channel->destroying = TRUE;
channels = g_slist_remove(channels, channel);
- if (channel->server != NULL)
+ if (!channel->server->disconnected)
channel->server->channels = g_slist_remove(channel->server->channels, channel);
signal_emit("channel destroyed", 1, channel);
return NULL;
}
-static COMMAND_MODULE_REC *command_module_find_func(COMMAND_REC *rec,
- SIGNAL_FUNC func)
+static COMMAND_MODULE_REC *
+command_module_find_and_remove(COMMAND_REC *rec, SIGNAL_FUNC func)
{
- GSList *tmp;
+ GSList *tmp, *tmp2;
g_return_val_if_fail(rec != NULL, NULL);
g_return_val_if_fail(func != NULL, NULL);
for (tmp = rec->modules; tmp != NULL; tmp = tmp->next) {
COMMAND_MODULE_REC *rec = tmp->data;
- if (g_slist_find(rec->signals, (void *) func) != NULL)
- return rec;
+ for (tmp2 = rec->callbacks; tmp2 != NULL; tmp2 = tmp2->next) {
+ COMMAND_CALLBACK_REC *cb = tmp2->data;
+
+ if (cb->func == func) {
+ rec->callbacks =
+ g_slist_remove(rec->callbacks, cb);
+ return rec;
+ }
+ }
}
return NULL;
return modrec;
}
-void command_bind_to(const char *module, int pos, const char *cmd,
- int protocol, const char *category, SIGNAL_FUNC func)
+void command_bind_full(const char *module, int priority, const char *cmd,
+ int protocol, const char *category, SIGNAL_FUNC func,
+ void *user_data)
{
COMMAND_REC *rec;
- COMMAND_MODULE_REC *modrec;
+ COMMAND_MODULE_REC *modrec;
+ COMMAND_CALLBACK_REC *cb;
char *str;
g_return_if_fail(module != NULL);
}
modrec = command_module_get(rec, module, protocol);
- modrec->signals = g_slist_append(modrec->signals, (void *) func);
+ cb = g_new0(COMMAND_CALLBACK_REC, 1);
+ cb->func = func;
+ cb->user_data = user_data;
+ modrec->callbacks = g_slist_append(modrec->callbacks, cb);
if (func != NULL) {
str = g_strconcat("command ", cmd, NULL);
- signal_add_to(module, pos, str, func);
+ signal_add_full(module, priority, str, func, user_data);
g_free(str);
}
{
rec->modules = g_slist_remove(rec->modules, modrec);
- g_slist_free(modrec->signals);
+ g_slist_foreach(modrec->callbacks, (GFunc) g_free, NULL);
+ g_slist_free(modrec->callbacks);
g_free(modrec->name);
g_free_not_null(modrec->options);
g_free(modrec);
for (tmp = rec->modules; tmp != NULL; tmp = tmp->next) {
COMMAND_MODULE_REC *rec = tmp->data;
- if (rec->signals == NULL)
+ if (rec->callbacks == NULL)
freelist = g_slist_append(freelist, rec);
else {
g_slist_free(freelist);
command_free(rec);
}
-void command_unbind(const char *cmd, SIGNAL_FUNC func)
+void command_unbind_full(const char *cmd, SIGNAL_FUNC func, void *user_data)
{
COMMAND_REC *rec;
- COMMAND_MODULE_REC *modrec;
+ COMMAND_MODULE_REC *modrec;
char *str;
g_return_if_fail(cmd != NULL);
rec = command_find(cmd);
if (rec != NULL) {
- modrec = command_module_find_func(rec, func);
+ modrec = command_module_find_and_remove(rec, func);
g_return_if_fail(modrec != NULL);
- modrec->signals =
- g_slist_remove(modrec->signals, (void *) func);
- if (modrec->signals == NULL)
+ if (modrec->callbacks == NULL)
command_module_destroy(rec, modrec);
}
str = g_strconcat("command ", cmd, NULL);
- signal_remove(str, func);
+ signal_remove_data(str, func, user_data);
g_free(str);
}
{
GSList *tmp, *next;
- for (tmp = modrec->signals; tmp != NULL; tmp = next) {
+ for (tmp = modrec->callbacks; tmp != NULL; tmp = next) {
+ COMMAND_CALLBACK_REC *cb = tmp->data;
next = tmp->next;
- command_unbind(rec->cmd, (SIGNAL_FUNC) tmp->data);
+ command_unbind_full(rec->cmd, cb->func, cb->user_data);
}
if (g_slist_find(commands, rec) != NULL) {
#include "signals.h"
+typedef struct {
+ SIGNAL_FUNC func;
+ void *user_data;
+} COMMAND_CALLBACK_REC;
+
typedef struct {
char *name;
char *options;
int protocol; /* chat protocol required for this command */
- GSList *signals;
+ GSList *callbacks;
} COMMAND_MODULE_REC;
typedef struct {
extern char *current_command; /* the command we're right now. */
/* Bind command to specified function. */
-void command_bind_to(const char *module, int pos, const char *cmd,
- int protocol, const char *category, SIGNAL_FUNC func);
-#define command_bind(a, b, c) command_bind_to(MODULE_NAME, 1, a, -1, b, c)
-#define command_bind_first(a, b, c) command_bind_to(MODULE_NAME, 0, a, -1, b, c)
-#define command_bind_last(a, b, c) command_bind_to(MODULE_NAME, 2, a, -1, b, c)
-
-#define command_bind_proto(a, b, c, d) command_bind_to(MODULE_NAME, 1, a, b, c, d)
-#define command_bind_proto_first(a, b, c, d) command_bind_to(MODULE_NAME, 0, a, b, c, d)
-#define command_bind_proto_last(a, b, c, d) command_bind_to(MODULE_NAME, 2, a, b, c, d)
-
-void command_unbind(const char *cmd, SIGNAL_FUNC func);
+void command_bind_full(const char *module, int priority, const char *cmd,
+ int protocol, const char *category, SIGNAL_FUNC func,
+ void *user_data);
+#define command_bind(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, -1, b, c, NULL)
+#define command_bind_first(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, -1, b, c, NULL)
+#define command_bind_last(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, -1, b, c, NULL)
+
+#define command_bind_data(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, -1, b, c, d)
+#define command_bind_data_first(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, -1, b, c, d)
+#define command_bind_data_last(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, -1, b, c, d)
+
+#define command_bind_proto(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, b, c, d, NULL)
+#define command_bind_proto_first(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, b, c, d, NULL)
+#define command_bind_proto_last(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, b, c, d, NULL)
+
+void command_unbind_full(const char *cmd, SIGNAL_FUNC func, void *user_data);
+#define command_unbind(cmd, func) command_unbind_full(cmd, func, NULL)
/* Run subcommand, `cmd' contains the base command, first word in `data'
contains the subcommand */
func = arg < funccount ? funcs[arg] : NULL;
if (func == NULL) func = funcs[EXPANDO_ARG_NONE];
- signal_add_to_id(MODULE_NAME, 1, rec->signal_ids[n], func);
+ signal_add_full_id(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT,
+ rec->signal_ids[n], func, NULL);
}
}
func = arg < funccount ? funcs[arg] : NULL;
if (func == NULL) func = funcs[EXPANDO_ARG_NONE];
- signal_remove_id(rec->signal_ids[n], func);
+ signal_remove_id(rec->signal_ids[n], func, NULL);
}
}
{
int ret;
+ *wildcards = FALSE;
ret = FALSE;
while (*mask != '\0') {
if (*mask == '!') {
MODULE_DATA_INIT(query);
query->type = module_get_uniq_id_str("WINDOW ITEM TYPE", "QUERY");
query->destroy = (void (*) (WI_ITEM_REC *)) query_destroy;
+ query->createtime = time(NULL);
query->last_unread_msg = time(NULL);
if (query->server_tag != NULL) {
oldnick = query->name;
query->name = g_strdup(nick);
signal_emit("query nick changed", 2, query, oldnick);
+ signal_emit("window item name changed", 1, query);
g_free(oldnick);
}
dest->channels = g_strdup(src->channels);
dest->away_reason = g_strdup(src->away_reason);
+ dest->no_autojoin_channels = src->no_autojoin_channels;
return dest;
}
/* initializes server record but doesn't start connecting */
void server_connect_init(SERVER_REC *server)
{
+ const char *str;
+
g_return_if_fail(server != NULL);
MODULE_DATA_INIT(server);
if (server->connrec->username == NULL || *server->connrec->username == '\0') {
g_free_not_null(server->connrec->username);
- server->connrec->username = g_get_user_name();
- if (*server->connrec->username == '\0') server->connrec->username = "-";
- server->connrec->username = g_strdup(server->connrec->username);
+ str = g_get_user_name();
+ if (*str == '\0') str = "-";
+ server->connrec->username = g_strdup(str);
}
if (server->connrec->realname == NULL || *server->connrec->realname == '\0') {
g_free_not_null(server->connrec->realname);
- server->connrec->realname = g_get_real_name();
- if (*server->connrec->realname == '\0') server->connrec->realname = "-";
- server->connrec->realname = g_strdup(server->connrec->realname);
+ str = g_get_real_name();
+ if (*str == '\0') str = "-";
+ server->connrec->realname = g_strdup(str);
}
server->tag = server_create_tag(server->connrec);
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
CHANNEL_REC *channel = tmp->data;
- channel->server = NULL;
channel_destroy(channel);
found = TRUE;
}
void session_set_binary(const char *path)
{
+ const char *envpath;
char **paths, **tmp;
char *str;
}
/* we'll need to find it from path. */
- str = g_getenv("PATH");
- if (str == NULL) return;
+ envpath = g_getenv("PATH");
+ if (envpath == NULL) return;
- paths = g_strsplit(str, ":", -1);
+ paths = g_strsplit(envpath, ":", -1);
for (tmp = paths; *tmp != NULL; tmp++) {
str = g_strconcat(*tmp, G_DIR_SEPARATOR_S, path, NULL);
if (access(str, X_OK) == 0) {
/*
signals.c : irssi
- Copyright (C) 1999 Timo Sirainen
+ Copyright (C) 1999-2002 Timo Sirainen
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "../common.h"
+#include "module.h"
#include "signals.h"
#include "modules.h"
-#define SIGNAL_LISTS 3
+typedef struct _SignalHook {
+ struct _SignalHook *next;
+
+ int priority;
+ const char *module;
+ SIGNAL_FUNC func;
+ void *user_data;
+} SignalHook;
typedef struct {
int id; /* signal id */
int emitting; /* signal is being emitted */
int stop_emit; /* this signal was stopped */
+ int continue_emit; /* this signal emit was continued elsewhere */
+ int remove_count; /* hooks were removed from signal */
- GPtrArray *modulelist[SIGNAL_LISTS]; /* list of what signals belong
- to which module */
- GPtrArray *siglist[SIGNAL_LISTS]; /* signal lists */
-} SIGNAL_REC;
+ SignalHook *hooks;
+} Signal;
-#define signal_is_emitlist_empty(a) \
- (!(a)->siglist[0] && !(a)->siglist[1] && !(a)->siglist[2])
+void *signal_user_data;
-static GMemChunk *signals_chunk;
static GHashTable *signals;
-static SIGNAL_REC *current_emitted_signal;
+static Signal *current_emitted_signal;
+static SignalHook *current_emitted_hook;
#define signal_ref(signal) ++(signal)->refcount
-#define signal_unref(rec) (signal_unref_full(rec, TRUE))
+#define signal_unref(signal) (signal_unref_full(signal, TRUE))
-static int signal_unref_full(SIGNAL_REC *rec, int remove_hash)
+static int signal_unref_full(Signal *rec, int remove)
{
- if (rec->refcount == 0) {
- g_error("signal_unref(%s) : BUG - reference counter == 0",
- signal_get_id_str(rec->id));
- }
+ g_assert(rec->refcount > 0);
if (--rec->refcount != 0)
- return FALSE;
+ return TRUE;
/* remove whole signal from memory */
- if (!signal_is_emitlist_empty(rec)) {
- g_error("signal_unref(%s) : BUG - emitlist wasn't empty",
+ if (rec->hooks != NULL) {
+ g_error("signal_unref(%s) : BUG - hook list wasn't empty",
signal_get_id_str(rec->id));
}
- if (remove_hash)
+ if (remove)
g_hash_table_remove(signals, GINT_TO_POINTER(rec->id));
- g_mem_chunk_free(signals_chunk, rec);
- return TRUE;
+ g_free(rec);
+
+ return FALSE;
}
-static void signal_unref_count(SIGNAL_REC *rec, int count)
+static void signal_hash_ref(void *key, Signal *rec)
{
- while (count-- > 0)
- signal_unref(rec);
+ signal_ref(rec);
}
-void signal_add_to(const char *module, int pos,
- const char *signal, SIGNAL_FUNC func)
+static int signal_hash_unref(void *key, Signal *rec)
{
- g_return_if_fail(signal != NULL);
+ return !signal_unref_full(rec, FALSE);
+}
- signal_add_to_id(module, pos, signal_get_uniq_id(signal), func);
+void signal_add_full(const char *module, int priority,
+ const char *signal, SIGNAL_FUNC func, void *user_data)
+{
+ signal_add_full_id(module, priority, signal_get_uniq_id(signal),
+ func, user_data);
}
/* bind a signal */
-void signal_add_to_id(const char *module, int pos,
- int signal_id, SIGNAL_FUNC func)
+void signal_add_full_id(const char *module, int priority,
+ int signal_id, SIGNAL_FUNC func, void *user_data)
{
- SIGNAL_REC *rec;
+ Signal *signal;
+ SignalHook *hook, **tmp;
g_return_if_fail(signal_id >= 0);
g_return_if_fail(func != NULL);
- g_return_if_fail(pos >= 0 && pos < SIGNAL_LISTS);
-
- rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
- if (rec == NULL) {
- rec = g_mem_chunk_alloc0(signals_chunk);
- rec->id = signal_id;
- g_hash_table_insert(signals, GINT_TO_POINTER(signal_id), rec);
- }
- if (rec->siglist[pos] == NULL) {
- rec->siglist[pos] = g_ptr_array_new();
- rec->modulelist[pos] = g_ptr_array_new();
+ signal = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
+ if (signal == NULL) {
+ /* new signal */
+ signal = g_new0(Signal, 1);
+ signal->id = signal_id;
+ g_hash_table_insert(signals, GINT_TO_POINTER(signal_id), signal);
}
- g_ptr_array_add(rec->siglist[pos], (void *) func);
- g_ptr_array_add(rec->modulelist[pos], (void *) module);
-
- signal_ref(rec);
-}
-
-static int signal_list_find(GPtrArray *array, void *data)
-{
- unsigned int n;
-
- for (n = 0; n < array->len; n++) {
- if (g_ptr_array_index(array, n) == data)
- return n;
+ hook = g_new0(SignalHook, 1);
+ hook->priority = priority;
+ hook->module = module;
+ hook->func = func;
+ hook->user_data = user_data;
+
+ /* insert signal to proper position in list */
+ for (tmp = &signal->hooks; ; tmp = &(*tmp)->next) {
+ if (*tmp == NULL) {
+ /* last in list */
+ *tmp = hook;
+ break;
+ } else if (priority <= (*tmp)->priority) {
+ /* insert before others with same priority */
+ hook->next = *tmp;
+ *tmp = hook;
+ break;
+ }
}
- return -1;
+ signal_ref(signal);
}
-static void signal_list_free(SIGNAL_REC *rec, int list)
+static void signal_remove_hook(Signal *rec, SignalHook **hook_pos)
{
- g_ptr_array_free(rec->siglist[list], TRUE);
- g_ptr_array_free(rec->modulelist[list], TRUE);
- rec->siglist[list] = NULL;
- rec->modulelist[list] = NULL;
-}
+ SignalHook *hook;
-/* Returns TRUE if the whole signal is removed after this remove */
-static void signal_remove_from_list(SIGNAL_REC *rec, int list, int index)
-{
- g_ptr_array_remove_index(rec->siglist[list], index);
- g_ptr_array_remove_index(rec->modulelist[list], index);
+ hook = *hook_pos;
+ *hook_pos = hook->next;
- if (rec->siglist[list]->len == 0)
- signal_list_free(rec, list);
+ g_free(hook);
signal_unref(rec);
}
-/* Remove signal from emit lists */
-static int signal_remove_from_lists(SIGNAL_REC *rec, SIGNAL_FUNC func)
+/* Remove function from signal's emit list */
+static int signal_remove_func(Signal *rec, SIGNAL_FUNC func, void *user_data)
{
- int n, index;
-
- for (n = 0; n < SIGNAL_LISTS; n++) {
- if (rec->siglist[n] == NULL)
- continue;
-
- index = signal_list_find(rec->siglist[n], (void *) func);
- if (index != -1) {
- /* remove the function from emit list */
- signal_remove_from_list(rec, n, index);
- return 1;
+ SignalHook **hook;
+
+ for (hook = &rec->hooks; *hook != NULL; hook = &(*hook)->next) {
+ if ((*hook)->func == func && (*hook)->user_data == user_data) {
+ if (rec->emitting) {
+ /* mark it removed after emitting is done */
+ (*hook)->func = NULL;
+ rec->remove_count++;
+ } else {
+ /* remove the function from emit list */
+ signal_remove_hook(rec, hook);
+ }
+ return TRUE;
}
}
- return 0;
+ return FALSE;
}
-void signal_remove_id(int signal_id, SIGNAL_FUNC func)
+void signal_remove_id(int signal_id, SIGNAL_FUNC func, void *user_data)
{
- SIGNAL_REC *rec;
+ Signal *rec;
g_return_if_fail(signal_id >= 0);
g_return_if_fail(func != NULL);
rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
if (rec != NULL)
- signal_remove_from_lists(rec, func);
+ signal_remove_func(rec, func, user_data);
}
/* unbind signal */
-void signal_remove(const char *signal, SIGNAL_FUNC func)
+void signal_remove_full(const char *signal, SIGNAL_FUNC func, void *user_data)
{
g_return_if_fail(signal != NULL);
- signal_remove_id(signal_get_uniq_id(signal), func);
+ signal_remove_id(signal_get_uniq_id(signal), func, user_data);
+}
+
+static void signal_hooks_clean(Signal *rec)
+{
+ SignalHook **hook, **next;
+ int count;
+
+ count = rec->remove_count;
+ rec->remove_count = 0;
+
+ for (hook = &rec->hooks; *hook != NULL; hook = next) {
+ next = &(*hook)->next;
+
+ if ((*hook)->func == NULL) {
+ next = hook;
+ signal_remove_hook(rec, hook);
+
+ if (--count == 0)
+ break;
+ }
+ }
}
-static int signal_emit_real(SIGNAL_REC *rec, int params, va_list va)
+static int signal_emit_real(Signal *rec, int params, va_list va,
+ SignalHook *first_hook)
{
- gconstpointer arglist[SIGNAL_MAX_ARGUMENTS];
- SIGNAL_REC *prev_emitted_signal;
- SIGNAL_FUNC func;
- int n, index, stopped, stop_emit_count;
+ const void *arglist[SIGNAL_MAX_ARGUMENTS];
+ Signal *prev_emitted_signal;
+ SignalHook *hook, *prev_emitted_hook;
+ int i, stopped, stop_emit_count, continue_emit_count;
- for (n = 0; n < SIGNAL_MAX_ARGUMENTS; n++)
- arglist[n] = n >= params ? NULL : va_arg(va, gconstpointer);
+ for (i = 0; i < SIGNAL_MAX_ARGUMENTS; i++)
+ arglist[i] = i >= params ? NULL : va_arg(va, const void *);
/* signal_stop_by_name("signal"); signal_emit("signal", ...);
fails if we compare rec->stop_emit against 0. */
stop_emit_count = rec->stop_emit;
+ continue_emit_count = rec->continue_emit;
signal_ref(rec);
stopped = FALSE;
rec->emitting++;
- for (n = 0; n < SIGNAL_LISTS; n++) {
- /* run signals in emit lists */
- if (rec->siglist[n] == NULL)
- continue;
- for (index = rec->siglist[n]->len-1; index >= 0; index--) {
- func = (SIGNAL_FUNC) g_ptr_array_index(rec->siglist[n], index);
+ prev_emitted_signal = current_emitted_signal;
+ prev_emitted_hook = current_emitted_hook;
+ current_emitted_signal = rec;
- prev_emitted_signal = current_emitted_signal;
- current_emitted_signal = rec;
+ for (hook = first_hook; hook != NULL; hook = hook->next) {
+ if (hook->func == NULL)
+ continue; /* removed */
+
+ current_emitted_hook = hook;
#if SIGNAL_MAX_ARGUMENTS != 6
# error SIGNAL_MAX_ARGUMENTS changed - update code
#endif
- func(arglist[0], arglist[1], arglist[2], arglist[3], arglist[4], arglist[5]);
- current_emitted_signal = prev_emitted_signal;
-
- if (rec->stop_emit != stop_emit_count) {
- stopped = TRUE;
- rec->stop_emit--;
- n = SIGNAL_LISTS;
- break;
- }
+ signal_user_data = hook->user_data;
+ hook->func(arglist[0], arglist[1], arglist[2], arglist[3],
+ arglist[4], arglist[5]);
+
+ if (rec->continue_emit != continue_emit_count)
+ rec->continue_emit--;
+
+ if (rec->stop_emit != stop_emit_count) {
+ stopped = TRUE;
+ rec->stop_emit--;
+ break;
}
}
+
+ current_emitted_signal = prev_emitted_signal;
+ current_emitted_hook = prev_emitted_hook;
+
rec->emitting--;
+ signal_user_data = NULL;
if (!rec->emitting) {
- if (rec->stop_emit != 0) {
- /* signal_stop() used too many times */
- rec->stop_emit = 0;
- }
+ g_assert(rec->stop_emit == 0);
+ g_assert(rec->continue_emit == 0);
+
+ if (rec->remove_count > 0)
+ signal_hooks_clean(rec);
}
signal_unref(rec);
int signal_emit(const char *signal, int params, ...)
{
- SIGNAL_REC *rec;
+ Signal *rec;
va_list va;
int signal_id;
rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
if (rec != NULL) {
va_start(va, params);
- signal_emit_real(rec, params, va);
+ signal_emit_real(rec, params, va, rec->hooks);
va_end(va);
}
int signal_emit_id(int signal_id, int params, ...)
{
- SIGNAL_REC *rec;
+ Signal *rec;
va_list va;
g_return_val_if_fail(signal_id >= 0, FALSE);
rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
if (rec != NULL) {
va_start(va, params);
- signal_emit_real(rec, params, va);
+ signal_emit_real(rec, params, va, rec->hooks);
va_end(va);
}
return rec != NULL;
}
+void signal_continue(int params, ...)
+{
+ Signal *rec;
+ va_list va;
+
+ rec = current_emitted_signal;
+ if (rec == NULL || rec->emitting <= rec->continue_emit)
+ g_warning("signal_continue() : no signals are being emitted currently");
+ else {
+ va_start(va, params);
+
+ /* stop the signal */
+ if (rec->emitting > rec->stop_emit)
+ rec->stop_emit++;
+
+ /* re-emit */
+ rec->continue_emit++;
+ signal_emit_real(rec, params, va, current_emitted_hook->next);
+ va_end(va);
+ }
+}
+
/* stop the current ongoing signal emission */
void signal_stop(void)
{
- SIGNAL_REC *rec;
+ Signal *rec;
rec = current_emitted_signal;
if (rec == NULL)
/* stop ongoing signal emission by signal name */
void signal_stop_by_name(const char *signal)
{
- SIGNAL_REC *rec;
+ Signal *rec;
int signal_id;
signal_id = signal_get_uniq_id(signal);
/* return the ID of the signal that is currently being emitted */
int signal_get_emitted_id(void)
{
- SIGNAL_REC *rec;
+ Signal *rec;
rec = current_emitted_signal;
g_return_val_if_fail(rec != NULL, -1);
/* return TRUE if specified signal was stopped */
int signal_is_stopped(int signal_id)
{
- SIGNAL_REC *rec;
+ Signal *rec;
rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
g_return_val_if_fail(rec != NULL, FALSE);
return rec->emitting <= rec->stop_emit;
}
-static void signal_remove_module(void *signal, SIGNAL_REC *rec,
+static void signal_remove_module(void *signal, Signal *rec,
const char *module)
{
- unsigned int index;
- int list;
+ SignalHook **hook, **next;
- for (list = 0; list < SIGNAL_LISTS; list++) {
- if (rec->modulelist[list] == NULL)
- continue;
+ for (hook = &rec->hooks; *hook != NULL; hook = next) {
+ next = &(*hook)->next;
- for (index = rec->modulelist[list]->len; index > 0; index--)
- if (g_strcasecmp(g_ptr_array_index(rec->modulelist[list], index-1), module) == 0)
- signal_remove_from_list(rec, list, index-1);
+ if (strcasecmp((*hook)->module, module) == 0) {
+ next = hook;
+ signal_remove_hook(rec, hook);
+ }
}
}
-static void signal_foreach_ref(void *signal, SIGNAL_REC *rec)
-{
- signal_ref(rec);
-}
-
-static int signal_foreach_unref(void *signal, SIGNAL_REC *rec)
-{
- return signal_unref_full(rec, FALSE);
-}
-
/* remove all signals that belong to `module' */
void signals_remove_module(const char *module)
{
g_return_if_fail(module != NULL);
- g_hash_table_foreach(signals, (GHFunc) signal_foreach_ref, NULL);
- g_hash_table_foreach(signals, (GHFunc) signal_remove_module, (void *) module);
- g_hash_table_foreach_remove(signals, (GHRFunc) signal_foreach_unref, NULL);
+ g_hash_table_foreach(signals, (GHFunc) signal_hash_ref, NULL);
+ g_hash_table_foreach(signals, (GHFunc) signal_remove_module,
+ (void *) module);
+ g_hash_table_foreach_remove(signals, (GHRFunc) signal_hash_unref, NULL);
}
void signals_init(void)
{
- signals_chunk = g_mem_chunk_new("signals", sizeof(SIGNAL_REC),
- sizeof(SIGNAL_REC)*200, G_ALLOC_AND_FREE);
- signals = g_hash_table_new((GHashFunc) g_direct_hash, (GCompareFunc) g_direct_equal);
+ signals = g_hash_table_new(NULL, NULL);
}
-static void signal_free(void *key, SIGNAL_REC *rec)
+static void signal_free(void *key, Signal *rec)
{
- int n;
+ /* refcount-1 because we just referenced it ourself */
+ g_warning("signal_free(%s) : signal still has %d references:",
+ signal_get_id_str(rec->id), rec->refcount-1);
- signal_ref(rec);
-
- for (n = 0; n < SIGNAL_LISTS; n++) {
- if (rec->siglist[n] != NULL) {
- signal_unref_count(rec, rec->siglist[n]->len);
- signal_list_free(rec, n);
- }
- }
+ while (rec->hooks != NULL) {
+ g_warning(" - module '%s' function %p",
+ rec->hooks->module, rec->hooks->func);
- if (!signal_unref_full(rec, FALSE)) {
- g_error("signal_free(%s) : BUG - signal still has %d references",
- signal_get_id_str(rec->id), rec->refcount);
+ signal_remove_hook(rec, &rec->hooks);
}
}
void signals_deinit(void)
{
- g_hash_table_foreach(signals, (GHFunc) signal_free, NULL);
+ g_hash_table_foreach(signals, (GHFunc) signal_hash_ref, NULL);
+ g_hash_table_foreach(signals, (GHFunc) signal_free, NULL);
+ g_hash_table_foreach_remove(signals, (GHRFunc) signal_hash_unref, NULL);
g_hash_table_destroy(signals);
module_uniq_destroy("signals");
- g_mem_chunk_destroy(signals_chunk);
}
#ifndef __SIGNAL_H
#define __SIGNAL_H
+#define SIGNAL_PRIORITY_LOW 100
+#define SIGNAL_PRIORITY_DEFAULT 0
+#define SIGNAL_PRIORITY_HIGH -100
+
#define SIGNAL_MAX_ARGUMENTS 6
-typedef void (*SIGNAL_FUNC) (gconstpointer, gconstpointer,
- gconstpointer, gconstpointer,
- gconstpointer, gconstpointer);
+typedef void (*SIGNAL_FUNC) (const void *, const void *,
+ const void *, const void *,
+ const void *, const void *);
-void signals_init(void);
-void signals_deinit(void);
-
-/* signal name -> ID */
-#define signal_get_uniq_id(signal) \
- module_get_uniq_id_str("signals", signal)
-/* signal ID -> name */
-#define signal_get_id_str(signal_id) \
- module_find_id_str("signals", signal_id)
+extern void *signal_user_data; /* use signal_get_user_data() macro to access */
/* bind a signal */
-void signal_add_to(const char *module, int pos,
- const char *signal, SIGNAL_FUNC func);
-void signal_add_to_id(const char *module, int pos,
- int signal, SIGNAL_FUNC func);
-#define signal_add(a, b) signal_add_to(MODULE_NAME, 1, a, b)
-#define signal_add_first(a, b) signal_add_to(MODULE_NAME, 0, a, b)
-#define signal_add_last(a, b) signal_add_to(MODULE_NAME, 2, a, b)
+void signal_add_full(const char *module, int priority,
+ const char *signal, SIGNAL_FUNC func, void *user_data);
+void signal_add_full_id(const char *module, int priority,
+ int signal, SIGNAL_FUNC func, void *user_data);
+#define signal_add(signal, func) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, (signal), (SIGNAL_FUNC) (func), NULL)
+#define signal_add_first(signal, func) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, (signal), (SIGNAL_FUNC) (func), NULL)
+#define signal_add_last(signal, func) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, (signal), (SIGNAL_FUNC) (func), NULL)
+
+#define signal_add_data(signal, func, data) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, (signal), (SIGNAL_FUNC) (func), data)
+#define signal_add_first_data(signal, func, data) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, (signal), (SIGNAL_FUNC) (func), data)
+#define signal_add_last_data(signal, func, data) \
+ signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, (signal), (SIGNAL_FUNC) (func), data)
/* unbind signal */
-void signal_remove(const char *signal, SIGNAL_FUNC func);
-void signal_remove_id(int signal_id, SIGNAL_FUNC func);
+void signal_remove_full(const char *signal, SIGNAL_FUNC func, void *user_data);
+#define signal_remove(signal, func) \
+ signal_remove_full((signal), (SIGNAL_FUNC) (func), NULL)
+#define signal_remove_data(signal, func, data) \
+ signal_remove_full((signal), (SIGNAL_FUNC) (func), data)
+void signal_remove_id(int signal_id, SIGNAL_FUNC func, void *user_data);
/* emit signal */
int signal_emit(const char *signal, int params, ...);
int signal_emit_id(int signal_id, int params, ...);
+/* continue currently emitted signal with different parameters */
+void signal_continue(int params, ...);
+
/* stop the current ongoing signal emission */
void signal_stop(void);
/* stop ongoing signal emission by signal name */
int signal_get_emitted_id(void);
/* return TRUE if specified signal was stopped */
int signal_is_stopped(int signal_id);
+/* return the user data of the signal function currently being emitted */
+#define signal_get_user_data() signal_user_data
/* remove all signals that belong to `module' */
void signals_remove_module(const char *module);
+/* signal name -> ID */
+#define signal_get_uniq_id(signal) \
+ module_get_uniq_id_str("signals", signal)
+/* signal ID -> name */
+#define signal_get_id_str(signal_id) \
+ module_find_id_str("signals", signal_id)
+
+void signals_init(void);
+void signals_deinit(void);
+
#endif
void *item, int *free_ret)
{
EXPANDO_FUNC func;
- char *ret;
+ const char *ret;
int type;
*free_ret = FALSE;
/* environment variable? */
ret = g_getenv(key);
if (ret != NULL)
- return ret;
+ return (char *) ret;
return NULL;
}
}
}
+static void sig_complete_channel(GList **list, WINDOW_REC *window,
+ const char *word, const char *line,
+ int *want_space)
+{
+ g_return_if_fail(list != NULL);
+ g_return_if_fail(word != NULL);
+
+ *list = completion_get_channels(NULL, word);
+ if (*list != NULL) signal_stop();
+}
+
/* expand \n, \t and \\ */
static char *expand_escapes(const char *line, SERVER_REC *server,
WI_ITEM_REC *item)
signal_add("complete command connect", (SIGNAL_FUNC) sig_complete_connect);
signal_add("complete command server", (SIGNAL_FUNC) sig_complete_connect);
signal_add("complete command topic", (SIGNAL_FUNC) sig_complete_topic);
+ signal_add("complete command window item move", (SIGNAL_FUNC) sig_complete_channel);
signal_add("message public", (SIGNAL_FUNC) sig_message_public);
signal_add("message join", (SIGNAL_FUNC) sig_message_join);
signal_add("message private", (SIGNAL_FUNC) sig_message_private);
signal_remove("complete command connect", (SIGNAL_FUNC) sig_complete_connect);
signal_remove("complete command server", (SIGNAL_FUNC) sig_complete_connect);
signal_remove("complete command topic", (SIGNAL_FUNC) sig_complete_topic);
+ signal_remove("complete command window item move", (SIGNAL_FUNC) sig_complete_channel);
signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
GList *list;
DIR *dirp;
struct dirent *dp;
- char *realpath, *dir, *basename, *name;
+ const char *basename;
+ char *realpath, *dir, *name;
int len;
g_return_val_if_fail(path != NULL, NULL);
signal_add_first("complete erase", (SIGNAL_FUNC) sig_complete_erase);
signal_add("complete command set", (SIGNAL_FUNC) sig_complete_set);
signal_add("complete command toggle", (SIGNAL_FUNC) sig_complete_toggle);
+ signal_add("complete command load", (SIGNAL_FUNC) sig_complete_filename);
signal_add("complete command cat", (SIGNAL_FUNC) sig_complete_filename);
signal_add("complete command save", (SIGNAL_FUNC) sig_complete_filename);
signal_add("complete command reload", (SIGNAL_FUNC) sig_complete_filename);
signal_remove("complete erase", (SIGNAL_FUNC) sig_complete_erase);
signal_remove("complete command set", (SIGNAL_FUNC) sig_complete_set);
signal_remove("complete command toggle", (SIGNAL_FUNC) sig_complete_toggle);
+ signal_remove("complete command load", (SIGNAL_FUNC) sig_complete_filename);
signal_remove("complete command cat", (SIGNAL_FUNC) sig_complete_filename);
signal_remove("complete command save", (SIGNAL_FUNC) sig_complete_filename);
signal_remove("complete command reload", (SIGNAL_FUNC) sig_complete_filename);
window_item_destroy((WI_ITEM_REC *) channel);
if (channel->joined && !channel->left &&
- channel->server != NULL) {
+ !channel->server->disconnected) {
/* kicked out from channel */
window_bind_add(window, channel->server->tag,
channel->name);
if (channel == NULL)
return;
+ /* already joined to channel, set it active */
window = window_item_window(channel);
+ if (window != active_win)
+ window_set_active(window);
- if (window == active_win) {
- /* channel is in active window, set it active */
- window_item_set_active(active_win,
- (WI_ITEM_REC *) channel);
- } else {
- /* notify user how to move the channel to active
- window. this was used to be done automatically
- but it just confused everyone who did it
- accidentally */
- printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
- TXT_CHANNEL_MOVE_NOTIFY, channel->name,
- window->refnum);
- }
+ window_item_set_active(active_win, (WI_ITEM_REC *) channel);
}
static void cmd_wjoin_post(const char *data)
fe_queries_deinit();
fe_messages_deinit();
- fe_ignore_messages_init();
+ fe_ignore_messages_deinit();
theme_unregister();
themes_deinit();
}
if (windows == NULL)
- fprintf(stderr, "GLib %s: %s", reason, message);
+ fprintf(stderr, "GLib %s: %s\n", reason, message);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_GLIB_ERROR, reason, message);
item = g_new0(EXEC_WI_REC, 1);
item->type = module_get_uniq_id_str("WINDOW ITEM TYPE", "EXEC");
item->destroy = (void (*) (WI_ITEM_REC *)) exec_wi_destroy;
- item->name = rec->name != NULL ?
- g_strdup_printf("%%%s", rec->name) :
+ item->name = rec->name != NULL ? g_strdup(rec->name) :
g_strdup_printf("%%%d", rec->id);
item->createtime = time(NULL);
return;
/* common options */
- target_channel = target_nick = FALSE;
+ target_channel = target_nick = FALSE;
if (g_hash_table_lookup(optlist, "out") != NULL) {
/* redirect output to active channel/query */
if (item == NULL)
rec->args = g_strdup(args);
rec->notice = notice;
rec->silent = g_hash_table_lookup(optlist, "-") != NULL;
+ rec->quiet = g_hash_table_lookup(optlist, "quiet") != NULL;
rec->name = g_strdup(g_hash_table_lookup(optlist, "name"));
level = g_hash_table_lookup(optlist, "level");
SERVER_REC *server;
char *str;
+ if (rec->quiet)
+ return;
+
item = NULL;
server = NULL;
void fe_exec_init(void)
{
command_bind("exec", NULL, (SIGNAL_FUNC) cmd_exec);
- command_set_options("exec", "!- interactive nosh +name out +msg +notice +in window close +level");
+ command_set_options("exec", "!- interactive nosh +name out +msg +notice +in window close +level quiet");
signal_exec_input = signal_get_uniq_id("exec input");
signal_add("pidwait", (SIGNAL_FUNC) sig_pidwait);
unsigned int shell:1; /* start the program via /bin/sh */
unsigned int notice:1; /* send text with /notice, not /msg if target is set */
unsigned int silent:1; /* don't print "process exited with level xx" */
+ unsigned int quiet:1; /* don't print process output at all */
unsigned int target_channel:1; /* target is a channel */
unsigned int target_nick:1; /* target is a nick */
};
const char *address, const char *reason)
{
printformat(server, channel, MSGLEVEL_KICKS,
- TXT_KICK, nick, channel, kicker, reason);
+ TXT_KICK, nick, channel, kicker, reason, address);
}
static void print_nick_change_channel(SERVER_REC *server, const char *channel,
printformat(server, channel, level,
ownnick ? TXT_YOUR_NICK_CHANGED : TXT_NICK_CHANGED,
- oldnick, newnick, channel);
+ oldnick, newnick, channel, address);
}
static void print_nick_change(SERVER_REC *server, const char *newnick,
if (!msgprint && ownnick) {
printformat(server, NULL, MSGLEVEL_NICKS,
- TXT_YOUR_NICK_CHANGED, oldnick, newnick, "");
+ TXT_YOUR_NICK_CHANGED, oldnick, newnick, "",
+ address);
}
}
print_nick_change(server, newnick, oldnick, address, TRUE);
else {
printformat(server, NULL, MSGLEVEL_NICKS,
- TXT_YOUR_NICK_CHANGED, oldnick, newnick, "");
+ TXT_YOUR_NICK_CHANGED, oldnick, newnick, "",
+ address);
}
}
str = show_lowascii(channel);
printformat(server, NULL, MSGLEVEL_INVITES,
- TXT_INVITE, nick, str);
+ TXT_INVITE, nick, str, address);
g_free(str);
}
{
printformat(server, channel, MSGLEVEL_TOPICS,
*topic != '\0' ? TXT_NEW_TOPIC : TXT_TOPIC_UNSET,
- nick, channel, topic);
+ nick, channel, topic, address);
}
static int printnick_exists(NICK_REC *first, NICK_REC *ignore,
if (!query->unwanted)
window_auto_destroy(window);
+ else {
+ /* eg. connection lost to dcc chat */
+ window_bind_add(window, query->server->tag, query->name);
+ }
}
static void signal_query_server_changed(QUERY_REC *query)
/* don't print the nick change message if only the case was changed */
if (g_strcasecmp(query->name, oldnick) != 0) {
printformat_dest(&dest, TXT_NICK_CHANGED, oldnick,
- query->name, query->name);
+ query->name, query->name,
+ query->address == NULL ? "" : query->address);
}
signal_emit("window item changed", 2,
query = CHAT_PROTOCOL(server)->
query_create(server->tag, nick, FALSE);
else {
- /* query already exists */
+ /* query already exists, set it active */
WINDOW_REC *window = window_item_window(query);
- if (window == active_win) {
- /* query is in active window, set it active */
- window_item_set_active(active_win,
- (WI_ITEM_REC *) query);
- } else {
- /* notify user how to move the query to active
- window. this was used to be done automatically
- but it just confused everyone who did it
- accidentally */
- printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
- TXT_QUERY_MOVE_NOTIFY, query->name,
- window->refnum);
- }
+ if (window != active_win)
+ window_set_active(window);
+ window_item_set_active(active_win, (WI_ITEM_REC *) query);
}
if (g_hash_table_lookup(optlist, "window") != NULL) {
window->destroying = TRUE;
windows = g_slist_remove(windows, window);
- if (active_win == window && windows != NULL) {
- active_win = NULL; /* it's corrupted */
- window_set_active(windows->data);
+ if (active_win == window) {
+ active_win = NULL; /* it's corrupted */
+ if (windows != NULL)
+ window_set_active(windows->data);
}
while (window->items != NULL)
void window_change_server(WINDOW_REC *window, void *server)
{
- if (server != NULL && SERVER(server)->disconnected)
- return;
+ if (server != NULL && SERVER(server)->disconnected)
+ return;
window->active_server = server;
signal_emit("window server changed", 2, window, server);
void window_set_name(WINDOW_REC *window, const char *name)
{
g_free_not_null(window->name);
- window->name = g_strdup(name);
+ window->name = name == NULL || *name == '\0' ? NULL : g_strdup(name);
signal_emit("window name changed", 1, window);
}
item = server == NULL ? NULL :
window_item_find(server, name);
- if (item == NULL && server == NULL) {
+ if (item == NULL) {
/* not found from the active server - any server? */
item = window_item_find(NULL, name);
}
- if (item == NULL) {
- char *chan;
-
- /* still nothing? maybe user just left the # in front of
- channel, try again with it.. */
- chan = g_strdup_printf("#%s", name);
- item = server == NULL ? NULL :
- window_item_find(server, chan);
- if (item == NULL) item = window_item_find(NULL, chan);
- g_free(chan);
- }
-
if (item == NULL)
return 0;
g_string_append_c(out, 4);
g_string_append_c(out, FORMAT_STYLE_CLRTOEOL);
break;
+ case '#':
+ g_string_append_c(out, 4);
+ g_string_append_c(out, FORMAT_STYLE_MONOSPACE);
+ break;
case '[':
/* code */
format_expand_code(format, out, flags);
case FORMAT_STRING:
arglist[num] = (char *) va_arg(va, char *);
if (arglist[num] == NULL) {
- g_warning("format_read_arglist() : parameter %d is NULL", num);
+ g_warning("format_read_arglist(%s) : parameter %d is NULL", format->tag, num);
arglist[num] = "";
}
break;
signal_emit_id(signal_gui_print_text, 6, window,
GINT_TO_POINTER(-1), GINT_TO_POINTER(-1),
GINT_TO_POINTER(GUI_PRINT_FLAG_NEWLINE),
- "", GINT_TO_POINTER(-1));
+ "", NULL);
}
/* parse ANSI color string */
GINT_TO_POINTER(fgcolor),
GINT_TO_POINTER(bgcolor),
GINT_TO_POINTER(flags), str,
- dest->level);
+ dest);
flags &= ~(GUI_PRINT_FLAG_INDENT|GUI_PRINT_FLAG_CLRTOEOL);
}
case FORMAT_STYLE_REVERSE:
flags ^= GUI_PRINT_FLAG_REVERSE;
break;
+ case FORMAT_STYLE_MONOSPACE:
+ flags ^= GUI_PRINT_FLAG_MONOSPACE;
+ break;
case FORMAT_STYLE_INDENT:
flags |= GUI_PRINT_FLAG_INDENT;
break;
signal_emit_id(signal_gui_print_text, 6,
dest->window, NULL, NULL,
GINT_TO_POINTER(GUI_PRINT_FLAG_INDENT_FUNC),
- str, start, dest->level);
+ str, start, dest);
break;
}
case FORMAT_STYLE_DEFAULTS:
fgcolor = theme->default_color;
bgcolor = -1;
- flags &= GUI_PRINT_FLAG_INDENT;
+ flags &= GUI_PRINT_FLAG_INDENT|GUI_PRINT_FLAG_MONOSPACE;
break;
case FORMAT_STYLE_CLRTOEOL:
break;
/* remove all styling */
fgcolor = theme->default_color;
bgcolor = -1;
- flags &= GUI_PRINT_FLAG_INDENT;
+ flags &= GUI_PRINT_FLAG_INDENT|GUI_PRINT_FLAG_MONOSPACE;
break;
case 22:
/* reverse */
#define GUI_PRINT_FLAG_INDENT_FUNC 0x0040
#define GUI_PRINT_FLAG_NEWLINE 0x0080
#define GUI_PRINT_FLAG_CLRTOEOL 0x0100
+#define GUI_PRINT_FLAG_MONOSPACE 0x0200
#define MAX_FORMAT_PARAMS 10
#define DEFAULT_FORMAT_ARGLIST_SIZE 200
#define PRINT_FLAG_SET_SERVERTAG 0x0010
#define PRINT_FLAG_UNSET_SERVERTAG 0x0020
-typedef struct {
+typedef struct _TEXT_DEST_REC {
WINDOW_REC *window;
SERVER_REC *server;
const char *server_tag; /* if server is non-NULL, must be server->tag */
#define FORMAT_STYLE_INDENT_FUNC (0x06 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_DEFAULTS (0x07 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_CLRTOEOL (0x08 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_MONOSPACE (0x09 + FORMAT_STYLE_SPECIAL)
int format_expand_styles(GString *out, const char **format, int *flags);
void formats_init(void);
static GTree *key_states;
static int key_config_frozen;
-struct KEYBOARD_REC {
+struct _KEYBOARD_REC {
char *key_state; /* the ongoing key combo */
void *gui_data; /* GUI specific data sent in "key pressed" signal */
};
KEY_REC *rec;
KEYINFO_REC *info;
GSList *tmp, *tmp2, *list, *copy, *newout;
- char *str;
+ char *str, *p;
if (start == end) {
/* single key */
if (strcmp(rec->data, str) == 0)
list = g_slist_append(list, rec);
}
- g_free(str);
- if (list == NULL)
- return FALSE;
+ if (list == NULL) {
+ /* unknown keycombo - add it as-is, maybe the GUI will
+ feed it to us as such */
+ for (p = str; *p != '\0'; p++)
+ expand_out_char(*out, *p);
+ g_free(str);
+ return TRUE;
+ }
+ g_free(str);
if (list->next == NULL) {
/* only one way to generate the combo, good */
g_strconcat(keyboard->key_state, "-", key, NULL);
g_free_and_null(keyboard->key_state);
+#if GLIB_MAJOR_VERSION == 2
+# define GSearchFunc GCompareFunc
+#endif
rec = g_tree_search(key_states,
(GSearchFunc) key_states_search,
combo);
GSList *info, *key;
int len;
+ printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_HEADER);
+
len = searchkey == NULL ? 0 : strlen(searchkey);
for (info = keyinfos; info != NULL; info = info->next) {
KEYINFO_REC *rec = info->data;
if ((len == 0 || g_strncasecmp(rec->key, searchkey, len) == 0) &&
(!full || rec->key[len] == '\0')) {
- printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_KEY,
+ printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_LIST,
rec->key, rec->info->id, rec->data == NULL ? "" : rec->data);
}
}
}
+
+ printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_BIND_FOOTER);
}
/* SYNTAX: BIND [-delete] [<key> [<command> [<data>]]] */
void keyboard_deinit(void)
{
+ key_unbind("command", (SIGNAL_FUNC) sig_command);
+ key_unbind("key", (SIGNAL_FUNC) sig_key);
+ key_unbind("multi", (SIGNAL_FUNC) sig_multi);
+ key_unbind("nothing", (SIGNAL_FUNC) sig_nothing);
+
while (keyinfos != NULL)
keyinfo_remove(keyinfos->data);
g_hash_table_destroy(keys);
#include "signals.h"
-typedef struct KEYBOARD_REC KEYBOARD_REC;
+typedef struct _KEYBOARD_REC KEYBOARD_REC;
typedef struct {
char *id;
{ "window_set_immortal", "Window is now immortal", 0 },
{ "window_unset_immortal", "Window isn't immortal anymore", 0 },
{ "window_immortal_error", "Window is immortal, if you really want to close it, say /WINDOW IMMORTAL OFF", 0 },
- { "windowlist_header", "Ref Name Active item Server Level", 0 },
- { "windowlist_line", "$[3]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } },
+ { "windowlist_header", "%#Ref Name Active item Server Level", 0 },
+ { "windowlist_line", "%#$[3]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } },
{ "windowlist_footer", "", 0 },
{ "windows_layout_saved", "Layout of windows is now remembered next time you start irssi", 0 },
{ "windows_layout_reset", "Layout of windows reset to defaults", 0 },
{ "window_info_header", "", 0 },
{ "window_info_footer", "", 0 },
- { "window_info_refnum", "Window : {hilight #$0}", 1, { 1 } },
- { "window_info_refnum_sticky", "Window : {hilight #$0 (sticky)}", 1, { 1 } },
- { "window_info_name", "Name : $0", 1, { 0 } },
- { "window_info_history", "History : $0", 1, { 0 } },
- { "window_info_immortal", "Immortal: yes", 0 },
- { "window_info_size", "Size : $0x$1", 2, { 1, 1 } },
- { "window_info_level", "Level : $0", 1, { 0 } },
- { "window_info_server", "Server : $0", 1, { 0 } },
- { "window_info_server_sticky", "Server : $0 (sticky)", 1, { 0 } },
- { "window_info_theme", "Theme : $0$1", 2, { 0, 0 } },
- { "window_info_bound_items_header", "Bounds : {hilight Name Server tag}", 0 },
- { "window_info_bound_item", " : $[!30]0 $[!15]1 $2", 3, { 0, 0, 0 } },
+ { "window_info_refnum", "%#Window : {hilight #$0}", 1, { 1 } },
+ { "window_info_refnum_sticky", "%#Window : {hilight #$0 (sticky)}", 1, { 1 } },
+ { "window_info_name", "%#Name : $0", 1, { 0 } },
+ { "window_info_history", "%#History : $0", 1, { 0 } },
+ { "window_info_immortal", "%#Immortal: yes", 0 },
+ { "window_info_size", "%#Size : $0x$1", 2, { 1, 1 } },
+ { "window_info_level", "%#Level : $0", 1, { 0 } },
+ { "window_info_server", "%#Server : $0", 1, { 0 } },
+ { "window_info_server_sticky", "%#Server : $0 (sticky)", 1, { 0 } },
+ { "window_info_theme", "%#Theme : $0$1", 2, { 0, 0 } },
+ { "window_info_bound_items_header", "%#Bounds : {hilight Name Server tag}", 0 },
+ { "window_info_bound_item", "%# : $[!30]0 $[!15]1 $2", 3, { 0, 0, 0 } },
{ "window_info_bound_items_footer", "", 0 },
- { "window_info_items_header", "Items : {hilight Name Server tag}", 0 },
- { "window_info_item", " $[7]0: $[!30]1 $2", 3, { 0, 0, 0 } },
+ { "window_info_items_header", "%#Items : {hilight Name Server tag}", 0 },
+ { "window_info_item", "%# $[7]0: $[!30]1 $2", 3, { 0, 0, 0 } },
{ "window_info_items_footer", "", 0 },
/* ---- */
{ "join", "{channick_hilight $0} {chanhost_hilight $1} has joined {channel $2}", 3, { 0, 0, 0 } },
{ "part", "{channick $0} {chanhost $1} has left {channel $2} {reason $3}", 4, { 0, 0, 0, 0 } },
- { "kick", "{channick $0} was kicked from {channel $1} by {nick $2} {reason $3}", 4, { 0, 0, 0, 0 } },
+ { "kick", "{channick $0} was kicked from {channel $1} by {nick $2} {reason $3}", 5, { 0, 0, 0, 0, 0 } },
{ "quit", "{channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } },
{ "quit_once", "{channel $3} {channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } },
- { "invite", "{nick $0} invites you to {channel $1}", 2, { 0, 0 } },
+ { "invite", "{nick $0} invites you to {channel $1}", 3, { 0, 0, 0 } },
{ "not_invited", "You have not been invited to a channel!", 0 },
- { "new_topic", "{nick $0} changed the topic of {channel $1} to: $2", 3, { 0, 0, 0 } },
- { "topic_unset", "Topic unset by {nick $0} on {channel $1}", 2, { 0, 0 } },
- { "your_nick_changed", "You're now known as {nick $1}", 3, { 0, 0, 0 } },
- { "nick_changed", "{channick $0} is now known as {channick_hilight $1}", 3, { 0, 0, 0 } },
+ { "new_topic", "{nick $0} changed the topic of {channel $1} to: $2", 4, { 0, 0, 0, 0 } },
+ { "topic_unset", "Topic unset by {nick $0} on {channel $1}", 4, { 0, 0, 0, 0 } },
+ { "your_nick_changed", "You're now known as {nick $1}", 4, { 0, 0, 0, 0 } },
+ { "nick_changed", "{channick $0} is now known as {channick_hilight $1}", 4, { 0, 0, 0, 0 } },
{ "talking_in", "You are now talking in {channel $0}", 1, { 0 } },
{ "not_in_channels", "You are not on any channels", 0 },
{ "current_channel", "Current channel {channel $0}", 1, { 0 } },
{ "names", "{names_users Users {names_channel $0}}", 6, { 0, 1, 1, 1, 1, 1 } },
- { "names_prefix", "{names_prefix $0}", 1, { 0 } },
+ { "names_prefix", "%#{names_prefix $0}", 1, { 0 } },
{ "names_nick_op", "{names_nick_op $0 $1}", 2, { 0, 0 } },
{ "names_nick_halfop", "{names_nick_halfop $0 $1}", 2, { 0, 0 } },
{ "names_nick_voice", "{names_nick_voice $0 $1}", 2, { 0, 0 } },
{ "names_nick", "{names_nick $0 $1}", 2, { 0, 0 } },
{ "endofnames", "{channel $0}: Total of {hilight $1} nicks {comment {hilight $2} ops, {hilight $3} halfops, {hilight $4} voices, {hilight $5} normal}", 6, { 0, 1, 1, 1, 1, 1 } },
- { "chanlist_header", "You are on the following channels:", 0 },
- { "chanlist_line", "{channel $[-10]0} %|+$1 ($2): $3", 4, { 0, 0, 0, 0 } },
+ { "chanlist_header", "%#You are on the following channels:", 0 },
+ { "chanlist_line", "%#{channel $[-10]0} %|+$1 ($2): $3", 4, { 0, 0, 0, 0 } },
{ "chansetup_not_found", "Channel {channel $0} not found", 2, { 0, 0 } },
{ "chansetup_added", "Channel {channel $0} saved", 2, { 0, 0 } },
{ "chansetup_removed", "Channel {channel $0} removed", 2, { 0, 0 } },
- { "chansetup_header", "Channel Network Password Settings", 0 },
- { "chansetup_line", "{channel $[15]0} %|$[10]1 $[10]2 $3", 4, { 0, 0, 0, 0 } },
+ { "chansetup_header", "%#Channel Network Password Settings", 0 },
+ { "chansetup_line", "%#{channel $[15]0} %|$[10]1 $[10]2 $3", 4, { 0, 0, 0, 0 } },
{ "chansetup_footer", "", 0 },
- { "channel_move_notify", "{channel $0} is already joined in window $1, use \"/WINDOW ITEM MOVE $0\" to move it to this window", 2, { 0, 1 } },
/* ---- */
{ NULL, "Messages", 0 },
{ "query_stop", "Closing query with {nick $0}", 1, { 0 } },
{ "no_query", "No query with {nick $0}", 1, { 0 } },
{ "query_server_changed", "Query with {nick $0} changed to server {server $1}", 2, { 0, 0 } },
- { "query_move_notify", "Query with {nick $0} is already created to window $1, use \"/WINDOW ITEM MOVE $0\" to move it to this window", 2, { 0, 1 } },
/* ---- */
{ NULL, "Highlighting", 0 },
- { "hilight_header", "Highlights:", 0 },
- { "hilight_line", "$[-4]0 $1 $2 $3$4$5", 7, { 1, 0, 0, 0, 0, 0, 0 } },
+ { "hilight_header", "%#Highlights:", 0 },
+ { "hilight_line", "%#$[-4]0 $1 $2 $3$4$5", 7, { 1, 0, 0, 0, 0, 0, 0 } },
{ "hilight_footer", "", 0 },
{ "hilight_not_found", "Highlight not found: $0", 1, { 0 } },
{ "hilight_removed", "Highlight removed: $0", 1, { 0 } },
{ "alias_added", "Alias $0 added", 1, { 0 } },
{ "alias_removed", "Alias $0 removed", 1, { 0 } },
{ "alias_not_found", "No such alias: $0", 1, { 0 } },
- { "aliaslist_header", "Aliases:", 0 },
- { "aliaslist_line", "$[10]0 $1", 2, { 0, 0 } },
+ { "aliaslist_header", "%#Aliases:", 0 },
+ { "aliaslist_line", "%#$[10]0 $1", 2, { 0, 0 } },
{ "aliaslist_footer", "", 0 },
/* ---- */
{ "log_not_open", "Log file {hilight $0} not open", 1, { 0 } },
{ "log_started", "Started logging to file {hilight $0}", 1, { 0 } },
{ "log_stopped", "Stopped logging to file {hilight $0}", 1, { 0 } },
- { "log_list_header", "Logs:", 0 },
- { "log_list", "$0 $1: $2 $3$4", 5, { 1, 0, 0, 0, 0, 0 } },
+ { "log_list_header", "%#Logs:", 0 },
+ { "log_list", "%#$0 $1: $2 $3$4", 5, { 1, 0, 0, 0, 0, 0 } },
{ "log_list_footer", "", 0 },
{ "windowlog_file", "Window LOGFILE set to $0", 1, { 0 } },
{ "windowlog_file_logging", "Can't change window's logfile while log is on", 0 },
/* ---- */
{ NULL, "Modules", 0 },
- { "module_header", "Module Type Submodules", 0, },
- { "module_line", "$[!20]0 $[7]1 $2", 3, { 0, 0, 0 } },
+ { "module_header", "%#Module Type Submodules", 0, },
+ { "module_line", "%#$[!20]0 $[7]1 $2", 3, { 0, 0, 0 } },
{ "module_footer", "", 0, },
{ "module_already_loaded", "Module {hilight $0/$1} already loaded", 2, { 0, 0 } },
{ "module_not_loaded", "Module {hilight $0/$1} is not loaded", 2, { 0, 0 } },
{ "unignored", "Unignored {nick $0}", 1, { 0 } },
{ "ignore_not_found", "{nick $0} is not being ignored", 1, { 0 } },
{ "ignore_no_ignores", "There are no ignores", 0 },
- { "ignore_header", "Ignorance List:", 0 },
- { "ignore_line", "$[-4]0 $1: $2 $3 $4", 4, { 1, 0, 0, 0 } },
+ { "ignore_header", "%#Ignorance List:", 0 },
+ { "ignore_line", "%#$[-4]0 $1: $2 $3 $4", 4, { 1, 0, 0, 0 } },
{ "ignore_footer", "", 0 },
/* ---- */
{ "unknown_chatnet", "Unknown chat network: $0 (create it with /IRCNET ADD)", 1, { 0 } },
{ "not_toggle", "Value must be either ON, OFF or TOGGLE", 0 },
{ "perl_error", "Perl error: $0", 1, { 0 } },
- { "bind_key", "$[!20]0 $1 $2", 3, { 0, 0, 0 } },
+ { "bind_header", "%#Key Action", 0 },
+ { "bind_list", "%#$[!20]0 $1 $2", 3, { 0, 0, 0 } },
+ { "bind_footer", "", 0 },
{ "bind_unknown_id", "Unknown bind action: $0", 1, { 0 } },
{ "config_saved", "Saved configuration to file $0", 1, { 0 } },
{ "config_reloaded", "Reloaded configuration", 1, { 0 } },
{ "config_modified", "Configuration file was modified since irssi was last started - do you want to overwrite the possible changes?", 1, { 0 } },
- { "glib_error", "{error GLib $0} $1", 2, { 0, 0 } },
+ { "glib_error", "{error $0} $1", 2, { 0, 0 } },
{ "overwrite_config", "Overwrite config (y/N)?", 0 },
{ "set_title", "[{hilight $0}]", 1, { 0 } },
{ "set_item", "$0 = $1", 2, { 0, 0 } },
TXT_CHANSETUP_HEADER,
TXT_CHANSETUP_LINE,
TXT_CHANSETUP_FOOTER,
- TXT_CHANNEL_MOVE_NOTIFY,
TXT_FILL_4,
TXT_QUERY_STOP,
TXT_NO_QUERY,
TXT_QUERY_SERVER_CHANGED,
- TXT_QUERY_MOVE_NOTIFY,
TXT_FILL_6,
TXT_UNKNOWN_CHATNET,
TXT_NOT_TOGGLE,
TXT_PERL_ERROR,
- TXT_BIND_KEY,
+ TXT_BIND_HEADER,
+ TXT_BIND_LIST,
+ TXT_BIND_FOOTER,
TXT_BIND_UNKNOWN_ID,
TXT_CONFIG_SAVED,
TXT_CONFIG_RELOADED,
static void cmd_window_item(const char *data, void *server, WI_ITEM_REC *item)
{
- command_runsub("window item", data, server, item);
+ while (*data == ' ') data++;
+
+ if (is_numeric(data, '\0'))
+ signal_emit("command window item goto", 3, data, server, item);
+ else
+ command_runsub("window item", data, server, item);
}
/* SYNTAX: WINDOW ITEM PREV */
window_item_next(active_win);
}
-/* SYNTAX: WINDOW ITEM GOTO <name> */
+/* SYNTAX: WINDOW ITEM GOTO <number>|<name> */
static void cmd_window_item_goto(const char *data, SERVER_REC *server)
{
- WI_ITEM_REC *item;
+ WI_ITEM_REC *item;
+ GSList *tmp;
+
+ if (is_numeric(data, '\0')) {
+ /* change to specified number */
+ tmp = g_slist_nth(active_win->items, atoi(data)-1);
+ item = tmp == NULL ? NULL : tmp->data;
+ } else {
+ item = window_item_find_window(active_win, server, data);
+ }
- item = window_item_find_window(active_win, server, data);
if (item != NULL)
window_item_set_active(active_win, item);
}
{
if (window_find_name(data) == NULL)
window_set_name(active_win, data);
- else {
+ else if (active_win->name == NULL ||
+ strcmp(active_win->name, data) != 0) {
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
TXT_WINDOW_NAME_NOT_UNIQUE, data);
}
}
}
-static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
+static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
+ CONFIG_NODE *node)
{
CONFIG_NODE *subnode;
- GSList *tmp;
const char *type;
- node = config_node_section(node, "items", NODE_TYPE_LIST);
- for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
- WI_ITEM_REC *rec = tmp->data;
- SERVER_REC *server = rec->server;
-
- type = module_find_id_str("WINDOW ITEM TYPE", rec->type);
- if (type == NULL) continue;
+ type = module_find_id_str("WINDOW ITEM TYPE", item->type);
+ if (type == NULL)
+ return;
- subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
- iconfig_node_set_str(subnode, "type", type);
- type = chat_protocol_find_id(rec->chat_type)->name;
- iconfig_node_set_str(subnode, "chat_type", type);
- iconfig_node_set_str(subnode, "name", rec->name);
+ iconfig_node_set_str(subnode, "type", type);
+ type = chat_protocol_find_id(item->chat_type)->name;
+ iconfig_node_set_str(subnode, "chat_type", type);
+ iconfig_node_set_str(subnode, "name", item->name);
- if (server != NULL)
- iconfig_node_set_str(subnode, "tag", server->tag);
- else if (IS_QUERY(rec)) {
- iconfig_node_set_str(subnode, "tag",
- QUERY(rec)->server_tag);
- }
+ if (item->server != NULL)
+ iconfig_node_set_str(subnode, "tag", item->server->tag);
+ else if (IS_QUERY(item)) {
+ iconfig_node_set_str(subnode, "tag", QUERY(item)->server_tag);
}
}
+static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
+{
+ GSList *tmp;
+
+ node = config_node_section(node, "items", NODE_TYPE_LIST);
+ for (tmp = window->items; tmp != NULL; tmp = tmp->next)
+ signal_emit("layout save item", 3, window, tmp->data, node);
+}
+
static void window_save(WINDOW_REC *window, CONFIG_NODE *node)
{
char refnum[MAX_INT_STRLEN];
{
signal_add("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item);
signal_add("layout restore", (SIGNAL_FUNC) sig_layout_restore);
+ signal_add("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
}
void windows_layout_deinit(void)
{
signal_remove("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item);
signal_remove("layout restore", (SIGNAL_FUNC) sig_layout_restore);
+ signal_remove("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
}
static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
void *bgcolor, void *pflags,
- char *str, void *level)
+ char *str, TEXT_DEST_REC *dest)
{
GUI_WINDOW_REC *gui;
TEXT_BUFFER_VIEW_REC *view;
return;
}
- lineinfo.level = GPOINTER_TO_INT(level);
+ lineinfo.level = dest == NULL ? 0 : dest->level;
lineinfo.time = time(NULL);
gui = WINDOW_GUI(window);
/* window managing */
key_bind("previous_window", "Previous window", "^P", NULL, (SIGNAL_FUNC) key_previous_window);
- key_bind("left_window", "Window in left", "meta-left", NULL, (SIGNAL_FUNC) key_left_window);
key_bind("next_window", "Next window", "^N", NULL, (SIGNAL_FUNC) key_next_window);
- key_bind("right_window", "Window in right", "meta-right", NULL, (SIGNAL_FUNC) key_right_window);
key_bind("upper_window", "Upper window", "meta-up", NULL, (SIGNAL_FUNC) key_upper_window);
key_bind("lower_window", "Lower window", "meta-down", NULL, (SIGNAL_FUNC) key_lower_window);
+ key_bind("left_window", "Window in left", "meta-left", NULL, (SIGNAL_FUNC) key_left_window);
+ key_bind("right_window", "Window in right", "meta-right", NULL, (SIGNAL_FUNC) key_right_window);
key_bind("active_window", "Go to next window with the highest activity", "meta-a", NULL, (SIGNAL_FUNC) key_active_window);
key_bind("next_window_item", "Next channel/query", "^X", NULL, (SIGNAL_FUNC) key_next_window_item);
key_bind("previous_window_item", "Previous channel/query", NULL, NULL, (SIGNAL_FUNC) key_previous_window_item);
key_unbind("yank_from_cutbuffer", (SIGNAL_FUNC) key_yank_from_cutbuffer);
key_unbind("transpose_characters", (SIGNAL_FUNC) key_transpose_characters);
+ key_unbind("send_line", (SIGNAL_FUNC) key_send_line);
key_unbind("word_completion", (SIGNAL_FUNC) key_word_completion);
+ key_unbind("erase_completion", (SIGNAL_FUNC) key_erase_completion);
key_unbind("check_replaces", (SIGNAL_FUNC) key_check_replaces);
key_unbind("previous_window", (SIGNAL_FUNC) key_previous_window);
key_unbind("next_window", (SIGNAL_FUNC) key_next_window);
key_unbind("upper_window", (SIGNAL_FUNC) key_upper_window);
key_unbind("lower_window", (SIGNAL_FUNC) key_lower_window);
+ key_unbind("left_window", (SIGNAL_FUNC) key_left_window);
+ key_unbind("right_window", (SIGNAL_FUNC) key_right_window);
key_unbind("active_window", (SIGNAL_FUNC) key_active_window);
key_unbind("next_window_item", (SIGNAL_FUNC) key_next_window_item);
key_unbind("previous_window_item", (SIGNAL_FUNC) key_previous_window_item);
{ "window_not_sticky", "Window is not sticky", 0 },
{ "window_set_sticky", "Window set sticky", 0 },
{ "window_unset_sticky", "Window is not sticky anymore", 0 },
- { "window_info_sticky", "Sticky : $0", 1, { 0 } },
- { "window_info_scroll", "Scroll : $0", 1, { 0 } },
+ { "window_info_sticky", "%#Sticky : $0", 1, { 0 } },
+ { "window_info_scroll", "%#Scroll : $0", 1, { 0 } },
{ "window_scroll", "Window scroll mode is now $0", 1, { 0 } },
{ "window_scroll_unknown", "Unknown scroll mode $0, must be ON, OFF or DEFAULT", 1, { 0 } },
/* ---- */
{ NULL, "Statusbars", 0 },
- { "statusbar_list_header", "Name Type Placement Position Visible", 0 },
+ { "statusbar_list_header", "%#Name Type Placement Position Visible", 0 },
{ "statusbar_list_footer", "", 0 },
- { "statusbar_list", "$[30]0 $[6]1 $[9]2 $[8]3 $4", 5, { 0, 0, 0, 1, 0 } },
- { "statusbar_info_name", "Statusbar: {hilight $0}", 1, { 0 } },
- { "statusbar_info_type", "Type : $0", 1, { 0 } },
- { "statusbar_info_placement", "Placement: $0", 1, { 0 } },
- { "statusbar_info_position", "Position : $0", 1, { 1 } },
- { "statusbar_info_visible", "Visible : $0", 1, { 0 } },
- { "statusbar_info_item_header", "Items : Name Priority Alignment", 0 },
+ { "statusbar_list", "%#$[30]0 $[6]1 $[9]2 $[8]3 $4", 5, { 0, 0, 0, 1, 0 } },
+ { "statusbar_info_name", "%#Statusbar: {hilight $0}", 1, { 0 } },
+ { "statusbar_info_type", "%#Type : $0", 1, { 0 } },
+ { "statusbar_info_placement", "%#Placement: $0", 1, { 0 } },
+ { "statusbar_info_position", "%#Position : $0", 1, { 1 } },
+ { "statusbar_info_visible", "%#Visible : $0", 1, { 0 } },
+ { "statusbar_info_item_header", "%#Items : Name Priority Alignment", 0 },
{ "statusbar_info_item_footer", "", 0 },
- { "statusbar_info_item_name", " : $[35]0 $[9]1 $2", 3, { 0, 1, 0 } },
+ { "statusbar_info_item_name", "%# : $[35]0 $[9]1 $2", 3, { 0, 1, 0 } },
{ "statusbar_not_found", "Statusbar doesn't exist: $0", 1, { 0 } },
{ "statusbar_not_found", "Statusbar doesn't exist: $0", 1, { 0 } },
{ "statusbar_item_not_found", "Statusbar item doesn't exist: $0", 1, { 0 } },
func = NULL;
break;
}
- if (func != NULL)
- signal_add_to_id(MODULE_NAME, 1, *pos, func);
+ if (func != NULL) {
+ signal_add_full_id(MODULE_NAME,
+ SIGNAL_PRIORITY_DEFAULT,
+ *pos, func, NULL);
+ }
}
if (g_slist_find(list, item) == NULL)
static void statusbar_signal_remove(int signal_id)
{
- signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_item);
- signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_server);
- signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_window);
- signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_window_item);
+ signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_item, NULL);
+ signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_server, NULL);
+ signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_window, NULL);
+ signal_remove_id(signal_id, (SIGNAL_FUNC) statusbar_update_window_item, NULL);
}
static void statusbar_item_remove_signal(SBAR_ITEM_REC *item, int signal_id)
vcx += count;
while (vcx >= term_width) {
vcx -= term_width;
- if (vcy < term_height) vcy++;
+ if (vcy < term_height-1) vcy++;
if (vcx > 0) term_lines_empty[vcy] = FALSE;
}
}
g_string_free(format, TRUE);
signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
- signal_remove("print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
+ signal_remove("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}
hv = hvref(sv);
hv_iterinit(hv);
while ((he = hv_iternext(hv)) != NULL)
- perl_signal_add_to(hv_iterkey(he, &len), HeVAL(he), priority);
+ perl_signal_add_full(hv_iterkey(he, &len), HeVAL(he), priority);
}
static void perl_command_bind_add_hash(int priority, SV *sv, char *category)
}
signal_emit(signal, items-1, p[0], p[1], p[2], p[3], p[4], p[5]);
+void
+signal_continue(...)
+CODE:
+ void *p[SIGNAL_MAX_ARGUMENTS];
+ int n;
+
+ memset(p, 0, sizeof(p));
+ for (n = 0; n < items && n < SIGNAL_MAX_ARGUMENTS; n++) {
+ if (SvPOKp(ST(n)))
+ p[n] = SvPV(ST(n), PL_na);
+ else if (irssi_is_ref_object(ST(n)))
+ p[n] = irssi_ref_object(ST(n));
+ else if (SvROK(ST(n)))
+ p[n] = (void *) SvIV((SV*)SvRV(ST(n)));
+ else
+ p[n] = NULL;
+ }
+ signal_continue(items, p[0], p[1], p[2], p[3], p[4], p[5]);
+
void
signal_add(...)
CODE:
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add(signal, func)");
if (items == 2)
- perl_signal_add((char *)SvPV(ST(0),PL_na), ST(1));
+ perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
+ SIGNAL_PRIORITY_DEFAULT);
else
- perl_signal_add_hash(1, ST(0));
+ perl_signal_add_hash(SIGNAL_PRIORITY_DEFAULT, ST(0));
void
signal_add_first(...)
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_first(signal, func)");
if (items == 2)
- perl_signal_add_first((char *)SvPV(ST(0),PL_na), ST(1));
+ perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
+ SIGNAL_PRIORITY_HIGH);
else
- perl_signal_add_hash(0, ST(0));
+ perl_signal_add_hash(SIGNAL_PRIORITY_HIGH, ST(0));
void
signal_add_last(...)
if (items != 1 && items != 2)
croak("Usage: Irssi::signal_add_last(signal, func)");
if (items == 2)
- perl_signal_add_last((char *)SvPV(ST(0),PL_na), ST(1));
+ perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1),
+ SIGNAL_PRIORITY_LOW);
else
- perl_signal_add_hash(2, ST(0));
+ perl_signal_add_hash(SIGNAL_PRIORITY_LOW, ST(0));
+
+void
+signal_add_priority(...)
+CODE:
+ if (items != 2 && items != 3)
+ croak("Usage: Irssi::signal_add_priority(signal, func, priority)");
+ if (items == 3)
+ perl_signal_add_full((char *)SvPV(ST(0),PL_na), ST(1), SvIV(ST(2)));
+ else
+ perl_signal_add_hash(SvIV(ST(0)), ST(1));
+
+int
+SIGNAL_PRIORITY_LOW()
+CODE:
+ RETVAL = SIGNAL_PRIORITY_LOW;
+OUTPUT:
+ RETVAL
+
+int
+SIGNAL_PRIORITY_DEFAULT()
+CODE:
+ RETVAL = SIGNAL_PRIORITY_DEFAULT;
+OUTPUT:
+ RETVAL
+
+int
+SIGNAL_PRIORITY_HIGH()
+CODE:
+ RETVAL = SIGNAL_PRIORITY_HIGH;
+OUTPUT:
+ RETVAL
void
signal_remove(signal, func)
SV *func
SV *data
CODE:
- RETVAL = perl_timeout_add(msecs, func, data);
+ if (msecs < 10) {
+ croak("Irssi::timeout() : msecs must be >= 10");
+ RETVAL = -1;
+ } else {
+ RETVAL = perl_timeout_add(msecs, func, data);
+ }
OUTPUT:
RETVAL
void
command_bind_first(...)
CODE:
- handle_command_bind(0, items, ST(0), ST(1), ST(2));
+ handle_command_bind(SIGNAL_PRIORITY_HIGH, items, ST(0), ST(1), ST(2));
void
command_bind(...)
CODE:
- handle_command_bind(1, items, ST(0), ST(1), ST(2));
+ handle_command_bind(SIGNAL_PRIORITY_DEFAULT, items, ST(0), ST(1), ST(2));
void
command_bind_last(...)
CODE:
- handle_command_bind(2, items, ST(0), ST(1), ST(2));
+ handle_command_bind(SIGNAL_PRIORITY_LOW, items, ST(0), ST(1), ST(2));
void
command_runsub(cmd, data, server, item)
push @EXPORT_OK, $_ if /[a-z]/ && defined *{$_}{CODE};
}
}
- select CLIENTCRAP;
+
+ tie *DEFAULT, __PACKAGE__, MSGLEVEL_CLIENTCRAP();
+ select DEFAULT;
}
sub in_irssi {
{ "script_loaded", "Loaded script {hilight $0}", 2, { 0, 0 } },
{ "script_unloaded", "Unloaded script {hilight $0}", 1, { 0 } },
{ "no_scripts_loaded", "No scripts are loaded", 0 },
- { "script_list_header", "Loaded scripts:", 0 },
- { "script_list_line", "$[!15]0 $1", 2, { 0, 0 } },
+ { "script_list_header", "%#Loaded scripts:", 0 },
+ { "script_list_line", "%#$[!15]0 $1", 2, { 0, 0 } },
{ "script_list_footer", "", 0 },
{ "script_error", "{error Error in script {hilight $0}:}", 1, { 0 } },
hv_store(hv, "name", 4, new_pv(item->name), 0);
hv_store(hv, "createtime", 10, newSViv(item->createtime), 0);
- hv_store(hv, "data_level", 8, newSViv(item->data_level), 0);
- hv_store(hv, "hilight_color", 10, new_pv(item->hilight_color), 0);
+ hv_store(hv, "data_level", 10, newSViv(item->data_level), 0);
+ hv_store(hv, "hilight_color", 13, new_pv(item->hilight_color), 0);
}
void perl_channel_fill_hash(HV *hv, CHANNEL_REC *channel)
perl_window_item_fill_hash(hv, (WI_ITEM_REC *) query);
+ hv_store(hv, "last_unread_msg", 15, newSViv(query->last_unread_msg), 0);
hv_store(hv, "address", 7, new_pv(query->address), 0);
hv_store(hv, "server_tag", 10, new_pv(query->server_tag), 0);
hv_store(hv, "unwanted", 8, newSViv(query->unwanted), 0);
hv_store(hv, "level", 5, newSViv(ignore->level), 0);
- hv_store(hv, "exception", 6, newSViv(ignore->exception), 0);
+ hv_store(hv, "exception", 9, newSViv(ignore->exception), 0);
hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0);
hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0);
}
{ "query created", { "iobject", "int", NULL } },
{ "query destroyed", { "iobject", NULL } },
{ "query nick changed", { "iobject", "string", NULL } },
+ { "window item name changed", { "iobject", NULL } },
{ "query address changed", { "iobject", NULL } },
{ "query server changed", { "iobject", "iobject", NULL } },
{ "rawlog", { "RAWIrssi::Log", "string", NULL } },
{ "massjoin", { "iobject", "gslist_iobject", NULL } },
{ "ban new", { "iobject", "Irssi::Irc::Ban", NULL } },
{ "ban remove", { "iobject", "Irssi::Irc::Ban", NULL } },
- { "channel mode changed", { "iobject", NULL } },
- { "nick mode changed", { "iobject", "iobject", NULL } },
+ { "channel mode changed", { "iobject", "string", NULL } },
+ { "nick mode changed", { "iobject", "iobject", "string", NULL } },
{ "user mode changed", { "iobject", "string", NULL } },
{ "away mode changed", { "iobject", NULL } },
{ "netsplit server new", { "iobject", "NETSPLIT_iobject", NULL } },
{ "notifylist left", { "iobject", "string", "string", "string", "string", "string", NULL } },
{ "proxy client connected", { "CLIENT_REC", NULL } },
{ "proxy client disconnected", { "CLIENT_REC", NULL } },
- { "gui print text", { "Irssi::UI::Window", "int", "int", "int", "string", "int", NULL } },
+ { "gui print text", { "Irssi::UI::Window", "int", "int", "int", "string", "Irssi::UI::TextDest", NULL } },
{ "gui print text finished", { "Irssi::UI::Window", NULL } },
{ "complete word", { "glistptr_char*", "Irssi::UI::Window", "string", "string", "intptr", NULL } },
{ "exec new", { "Irssi::UI::Process", NULL } },
{ "message irc notice", { "iobject", "string", "string", "string", "string", NULL } },
{ "message irc own_ctcp", { "iobject", "string", "string", "string", NULL } },
{ "message irc ctcp", { "iobject", "string", "string", "string", "string", "string", NULL } },
+ { "message irc mode", { "iobject", "string", "string", "string", "string", NULL } },
{ "message dcc own", { "siobject", "string", NULL } },
{ "message dcc own_action", { "siobject", "string", NULL } },
{ "message dcc own_ctcp", { "siobject", "string", "string", NULL } },
PERL_SCRIPT_REC *script;
int signal_id;
char *signal;
-
SV *func;
- int priority;
} PERL_SIGNAL_REC;
typedef struct {
#include "perl-signals-list.h"
-static GHashTable *signals[3];
+static GHashTable *signals;
static GHashTable *perl_signal_args_hash;
static GSList *perl_signal_args_partial;
LEAVE;
}
-static void sig_func(int priority, gconstpointer *args)
+static void sig_func(const void *p1, const void *p2,
+ const void *p3, const void *p4,
+ const void *p5, const void *p6)
{
- GSList **list, *tmp, *next;
- int signal_id;
-
- signal_id = signal_get_emitted_id();
- list = g_hash_table_lookup(signals[priority],
- GINT_TO_POINTER(signal_id));
- for (tmp = list == NULL ? NULL : *list; tmp != NULL; tmp = next) {
- PERL_SIGNAL_REC *rec = tmp->data;
+ PERL_SIGNAL_REC *rec;
+ const void *args[6];
- next = tmp->next;
- perl_call_signal(rec->script, rec->func, signal_id, args);
- if (signal_is_stopped(signal_id))
- break;
- }
-}
+ args[0] = p1; args[1] = p2; args[2] = p3;
+ args[3] = p4; args[4] = p5; args[5] = p6;
-#define SIG_FUNC_DECL(priority, priority_name) \
-static void sig_func_##priority_name(gconstpointer p1, gconstpointer p2, \
- gconstpointer p3, gconstpointer p4, \
- gconstpointer p5, gconstpointer p6) \
-{ \
- gconstpointer args[6]; \
- args[0] = p1; args[1] = p2; args[2] = p3; \
- args[3] = p4; args[4] = p5; args[5] = p6; \
- sig_func(priority, args); \
+ rec = signal_get_user_data();
+ perl_call_signal(rec->script, rec->func, signal_get_emitted_id(), args);
}
-SIG_FUNC_DECL(0, first);
-SIG_FUNC_DECL(1, default);
-SIG_FUNC_DECL(2, last);
-
-#define priority_get_func(priority) \
- (priority == 0 ? sig_func_first : \
- priority == 1 ? sig_func_default : sig_func_last)
-
-#define perl_signal_get_func(rec) \
- (priority_get_func((rec)->priority))
-
-static void perl_signal_add_to_int(const char *signal, SV *func,
- int priority, int command)
+static void perl_signal_add_full_int(const char *signal, SV *func,
+ int priority, int command,
+ const char *category)
{
PERL_SCRIPT_REC *script;
PERL_SIGNAL_REC *rec;
- GHashTable *table;
GSList **siglist;
void *signal_idp;
g_return_if_fail(signal != NULL);
g_return_if_fail(func != NULL);
- g_return_if_fail(priority >= 0 && priority <= 2);
script = perl_script_find_package(perl_get_package());
g_return_if_fail(script != NULL);
- if (!command && strncmp(signal, "command ", 8) == 0) {
- /* we used Irssi::signal_add() instead of
- Irssi::command_bind() - oh well, allow this.. */
- command_bind_to(MODULE_NAME, priority, signal+8, -1,
- NULL, priority_get_func(priority));
- command = TRUE;
- }
-
rec = g_new(PERL_SIGNAL_REC, 1);
rec->script = script;
rec->signal_id = signal_get_uniq_id(signal);
rec->signal = g_strdup(signal);
rec->func = perl_func_sv_inc(func, perl_get_package());
- rec->priority = priority;
- table = signals[priority];
- signal_idp = GINT_TO_POINTER(rec->signal_id);
+ if (command || strncmp(signal, "command ", 8) == 0) {
+ /* we used Irssi::signal_add() instead of
+ Irssi::command_bind() - oh well, allow this.. */
+ command_bind_full(MODULE_NAME, priority, signal+8, -1,
+ category, sig_func, rec);
+ } else {
+ signal_add_full_id(MODULE_NAME, priority, rec->signal_id,
+ sig_func, rec);
+ }
- siglist = g_hash_table_lookup(table, signal_idp);
+ signal_idp = GINT_TO_POINTER(rec->signal_id);
+ siglist = g_hash_table_lookup(signals, signal_idp);
if (siglist == NULL) {
siglist = g_new0(GSList *, 1);
- g_hash_table_insert(table, signal_idp, siglist);
-
- if (!command) {
- signal_add_to_id(MODULE_NAME, priority, rec->signal_id,
- perl_signal_get_func(rec));
- }
+ g_hash_table_insert(signals, signal_idp, siglist);
}
*siglist = g_slist_append(*siglist, rec);
}
-void perl_signal_add_to(const char *signal, SV *func, int priority)
+void perl_signal_add_full(const char *signal, SV *func, int priority)
{
- perl_signal_add_to_int(signal, func, priority, FALSE);
+ perl_signal_add_full_int(signal, func, priority, FALSE, NULL);
}
static void perl_signal_destroy(PERL_SIGNAL_REC *rec)
{
if (strncmp(rec->signal, "command ", 8) == 0)
- command_unbind(rec->signal+8, perl_signal_get_func(rec));
+ command_unbind_full(rec->signal+8, sig_func, rec);
+ else
+ signal_remove_id(rec->signal_id, sig_func, rec);
SvREFCNT_dec(rec->func);
g_free(rec->signal);
static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec)
{
- void *signal_idp;
-
- g_return_if_fail(rec != NULL);
-
- signal_idp = GINT_TO_POINTER(rec->signal_id);
-
*siglist = g_slist_remove(*siglist, rec);
if (*siglist == NULL) {
- signal_remove_id(rec->signal_id, perl_signal_get_func(rec));
g_free(siglist);
- g_hash_table_remove(signals[rec->priority], signal_idp);
+ g_hash_table_remove(signals, GINT_TO_POINTER(rec->signal_id));
}
perl_signal_destroy(rec);
{
GSList *tmp;
- g_return_if_fail(list != NULL);
-
for (tmp = *list; tmp != NULL; tmp = tmp->next) {
PERL_SIGNAL_REC *rec = tmp->data;
{
GSList **list;
void *signal_idp;
- int n;
signal_idp = GINT_TO_POINTER(signal_get_uniq_id(signal));
+ list = g_hash_table_lookup(signals, signal_idp);
- func = perl_func_sv_inc(func, perl_get_package());
- for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
- list = g_hash_table_lookup(signals[n], signal_idp);
- if (list != NULL)
- perl_signal_remove_list(list, func);
+ if (list != NULL) {
+ func = perl_func_sv_inc(func, perl_get_package());
+ perl_signal_remove_list(list, func);
+ SvREFCNT_dec(func);
}
- SvREFCNT_dec(func);
}
void perl_command_bind_to(const char *cmd, const char *category,
{
char *signal;
- command_bind_to(MODULE_NAME, priority, cmd, -1,
- category, priority_get_func(priority));
-
signal = g_strconcat("command ", cmd, NULL);
- perl_signal_add_to_int(signal, func, priority, TRUE);
+ perl_signal_add_full_int(signal, func, priority, TRUE, category);
g_free(signal);
}
next = tmp->next;
if (script == NULL || rec->script == script) {
*list = g_slist_remove(*list, rec);
- if (*list == NULL) {
- signal_remove_id(rec->signal_id,
- perl_signal_get_func(rec));
- }
perl_signal_destroy(rec);
}
}
/* destroy all signals used by script */
void perl_signal_remove_script(PERL_SCRIPT_REC *script)
{
- int n;
-
- for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
- g_hash_table_foreach_remove(signals[n],
- (GHRFunc) signal_destroy_hash,
- script);
- }
+ g_hash_table_foreach_remove(signals, (GHRFunc) signal_destroy_hash,
+ script);
}
void perl_signals_start(void)
{
- int n;
-
- for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
- signals[n] = g_hash_table_new((GHashFunc) g_direct_hash,
- (GCompareFunc) g_direct_equal);
- }
+ signals = g_hash_table_new(NULL, NULL);
}
void perl_signals_stop(void)
{
- int n;
-
- for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
- g_hash_table_foreach(signals[n],
- (GHFunc) signal_destroy_hash, NULL);
- g_hash_table_destroy(signals[n]);
- signals[n] = NULL;
- }
+ g_hash_table_foreach(signals, (GHFunc) signal_destroy_hash, NULL);
+ g_hash_table_destroy(signals);
+ signals = NULL;
}
void perl_signals_init(void)
#ifndef __PERL_SIGNALS_H
#define __PERL_SIGNALS_H
-void perl_signal_add_to(const char *signal, SV *func, int priority);
-#define perl_signal_add_first(signal, func) \
- perl_signal_add_to(signal, func, 0)
-#define perl_signal_add(signal, func) \
- perl_signal_add_to(signal, func, 1)
-#define perl_signal_add_last(signal, func) \
- perl_signal_add_to(signal, func, 2)
+void perl_signal_add_full(const char *signal, SV *func, int priority);
void perl_signal_remove(const char *signal, SV *func);
/* remove all signals used by script */
char *target
int formatnum
PREINIT:
+ TEXT_DEST_REC dest;
+ THEME_REC *theme;
char **charargs;
char *ret;
int n;
PPCODE:
charargs = g_new0(char *, items-5+1);
- charargs[items-5] = NULL;
for (n = 5; n < items; n++) {
charargs[n-5] = (char *)SvPV(ST(n), PL_na);
}
- ret = format_get_text(module, window, server, target, formatnum, charargs);
+
+ format_create_dest(&dest, server, target, 0, window);
+ theme = window_get_theme(dest.window);
+
+ ret = format_get_text_theme_charargs(theme, module, &dest, formatnum, charargs);
g_free(charargs);
XPUSHs(sv_2mortal(new_pv(ret)));
}
XPUSHs(sv_2mortal(new_pv(ret)));
g_free_not_null(ret);
+
+char *
+theme_get_format(theme, module, tag)
+ Irssi::UI::Theme theme
+ char *module
+ char *tag
+PREINIT:
+ MODULE_THEME_REC *modtheme;
+ FORMAT_REC *formats;
+ char *ret;
+ int i;
+CODE:
+ formats = g_hash_table_lookup(default_formats, module);
+ if (formats == NULL)
+ croak("Unknown module: %s", module);
+
+ for (i = 0; formats[i].def != NULL; i++) {
+ if (formats[i].tag != NULL &&
+ g_strcasecmp(formats[i].tag, tag) == 0)
+ break;
+ }
+
+ if (formats[i].def == NULL)
+ croak("Unknown format tag: %s", tag);
+
+ modtheme = g_hash_table_lookup(theme->modules, module);
+ RETVAL = modtheme == NULL ? NULL : modtheme->formats[i];
+ if (RETVAL == NULL)
+ RETVAL = formats[i].def;
+OUTPUT:
+ RETVAL
{
if (!IS_SILC_CHANNEL(channel))
return;
+ if (channel->server && channel->server->disconnected)
+ return;
if (channel->server != NULL && !channel->left && !channel->kicked) {
/* destroying channel record without actually
if (idletag != -1) {
signal_emit("chat protocol deinit", 1,
chat_protocol_find("SILC"));
+ signal_remove("irssi init read settings",
+ (SIGNAL_FUNC) sig_init_read_settings);
silc_server_deinit();
silc_channels_deinit();
touch draft-riikonen-silc-ke-auth-05.txt
touch draft-riikonen-silc-commands-03.txt
touch draft-riikonen-silc-flags-payloads-00.txt
+ touch draft-riikonen-presence-attrs-00.txt
if SILC_DIST_CLIENT
dist-hook:
touch draft-riikonen-silc-ke-auth-05.txt
touch draft-riikonen-silc-commands-03.txt
touch draft-riikonen-silc-flags-payloads-00.txt
+ touch draft-riikonen-presence-attrs-00.txt
else
if SILC_DIST_TOOLKIT
dist-hook:
touch draft-riikonen-silc-ke-auth-05.txt
touch draft-riikonen-silc-commands-03.txt
touch draft-riikonen-silc-flags-payloads-00.txt
+ touch draft-riikonen-presence-attrs-00.txt
$(makerfc) draft-riikonen-silc-spec-05.nroff \
draft-riikonen-silc-spec-05.txt
$(makerfc) draft-riikonen-silc-pp-05.nroff \
draft-riikonen-silc-commands-03.txt
$(makerfc) draft-riikonen-silc-flags-payloads-00.nroff \
draft-riikonen-silc-flags-payloads-00.txt
+ $(makerfc) draft-riikonen-presence-attrs-00.nroff \
+ draft-riikonen-presence-attrs-00.txt
else
dist-hook:
touch draft-riikonen-silc-spec-05.txt
touch draft-riikonen-silc-ke-auth-05.txt
touch draft-riikonen-silc-commands-03.txt
touch draft-riikonen-silc-flags-payloads-00.txt
+ touch draft-riikonen-presence-attrs-00.txt
$(makerfc) draft-riikonen-silc-spec-05.nroff \
draft-riikonen-silc-spec-05.txt
$(makerfc) draft-riikonen-silc-pp-05.nroff \
draft-riikonen-silc-ke-auth-05.txt
$(makerfc) draft-riikonen-silc-commands-03.nroff \
draft-riikonen-silc-commands-03.txt
- $(makerfc) draft-riikonen-silc-flags-payloads-00.nroff \
- draft-riikonen-silc-flags-payloads-00.txt
+ $(makerfc) draft-riikonen-presence-attrs-00.nroff \
+ draft-riikonen-presence-attrs-00.txt
endif
endif
4 References
[SILC1] Riikonen, P., "Secure Internet Live Conferencing (SILC),
- Protocol Specification", Internet Draft, April 2001.
+ Protocol Specification", Internet Draft, May 2002.
[SILC2] Riikonen, P., "SILC Packet Protocol", Internet Draft,
- April 2001.
+ May 2002.
[SILC3] Riikonen, P., "SILC Key Exchange and Authentication
- Protocols", Internet Draft, April 2001.
+ Protocols", Internet Draft, May 2002.
[IRC] Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
RFC 1459, May 1993.
[RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
10646", RFC 2279, January 1998.
-
-
+[ATTRS] Riikonen, P., "User Online Presence and Information
+ Attributes", Internet Draft, May 2002.
.ti 0
5 References
[SILC1] Riikonen, P., "Secure Internet Live Conferencing (SILC),
- Protocol Specification", Internet Draft, April 2001.
+ Protocol Specification", Internet Draft, May 2002.
[SILC2] Riikonen, P., "SILC Packet Protocol", Internet Draft,
- April 2001.
+ May 2002.
[RFC2045] Freed, N., et al., "Multipurpose Internet Mail Extensions
(MIME) Part One: Format of Internet Message Bodies",
5 References
[SILC1] Riikonen, P., "Secure Internet Live Conferencing (SILC),
- Protocol Specification", Internet Draft, April 2001.
+ Protocol Specification", Internet Draft, May 2002.
[SILC2] Riikonen, P., "SILC Packet Protocol", Internet Draft,
- April 2001.
+ May 2002.
-[SILC4] Riikonen, P., "SILC Commands", Internet Draft, April 2001.
+[SILC4] Riikonen, P., "SILC Commands", Internet Draft, May 2002.
[IRC] Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
RFC 1459, May 1993.
4 References
[SILC1] Riikonen, P., "Secure Internet Live Conferencing (SILC),
- Protocol Specification", Internet Draft, April 2001.
+ Protocol Specification", Internet Draft, May 2002.
[SILC3] Riikonen, P., "SILC Key Exchange and Authentication
- Protocols", Internet Draft, April 2001.
+ Protocols", Internet Draft, May 2002.
-[SILC4] Riikonen, P., "SILC Commands", Internet Draft, April 2001.
+[SILC4] Riikonen, P., "SILC Commands", Internet Draft, May 2002.
[IRC] Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
RFC 1459, May 1993.
6 References
[SILC2] Riikonen, P., "SILC Packet Protocol", Internet Draft,
- April 2001.
+ May 2002.
[SILC3] Riikonen, P., "SILC Key Exchange and Authentication
- Protocols", Internet Draft, April 2001.
+ Protocols", Internet Draft, May 2002.
-[SILC4] Riikonen, P., "SILC Commands", Internet Draft, April 2001.
+[SILC4] Riikonen, P., "SILC Commands", Internet Draft, May 2002.
[IRC] Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
RFC 1459, May 1993.
# SILC Distribution versions. Set here or give the version on the command
# line as argument.
#
-SILC_VERSION=0.8.2 # Base version
+SILC_VERSION=0.9 # Base version
#############################################################################