aboutsummaryrefslogtreecommitdiffstats
path: root/docs/perl.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/perl.txt')
-rw-r--r--docs/perl.txt424
1 files changed, 0 insertions, 424 deletions
diff --git a/docs/perl.txt b/docs/perl.txt
index dd72623..309a808 100644
--- a/docs/perl.txt
+++ b/docs/perl.txt
@@ -1,27 +1,3 @@
-
-
- * bugs
- * support
- * news
- * documentation
- * download
- * about
- * themes
- * scripts
-
-What's this?
-
-You are visiting the official website for the IRC client Irssi, for more information see the about section.
-Search this site
-
-Search function coming soon!
-
-
-What's new?
-
-Irssi 0.8.15 has been released and the new website will be released in a few weeks!
-Perl Scripting Reference
-
Installation problems
---------------------
@@ -43,54 +19,6 @@ installed) directories. After that /RUN script_name should work, you
don't need to add the .pl suffix.
- Irssi's signals
- ---------------
-
-Irssi is pretty much based on sending and handling different signals.
-Like when you receive a message from server, say
-
- :nick!user@there.org PRIVMSG you :blahblah
-
-Irssi will first send a signal:
-
- "server incoming", SERVER_REC, "nick!user@there PRIVMSG ..."
-
-You probably don't want to use this signal. Default handler for this
-signal interprets the header and sends a signal:
-
- "server event", SERVER_REC, "PRIVMSG ...", "nick", "user@there.org"
-
-You probably don't want to use this either, since this signal's default
-handler parses the event string and sends a signal:
-
- "event privmsg", SERVER_REC, "you :blahblah", "nick", "user@there.org"
-
-You can at any point grab the signal, do whatever you want to do with
-it and optionally stop it from going any further by calling
-Irssi::signal_stop();
-
-For example:
-
- sub event_privmsg {
- # $data = "nick/#channel :text"
- my ($server, $data, $nick, $address) = @_;
- my ($target, $text) = split(/ :/, $data, 2);
-
- Irssi::signal_stop() if ($text =~ /free.*porn/ || $nick =~ /idiot/);
- }
-
-Irssi::signal_add("event privmsg", "event_privmsg")
-
-This will hide all public or private messages that match the regexp
-"free.*porn" or the sender's nick contain the word "idiot". Yes, you
-could use /IGNORE instead for both of these :)
-
-You can also use signal_add_last() if you wish to let the Irssi's internal
-functions be run before yours.
-
-A list of signals that irssi sends can be found from signals.txt file.
-
-
Creating/replacing /COMMANDS
----------------------------
@@ -157,21 +85,6 @@ You can use them with a MSGLEVEL_ prefix, for example:
Writes text to #channel window with CLIENTCRAP level.
- Window items
- ------------
-
-Meaning of "window" should be pretty clear, but "window item" is
-something I couldn't really figure out a better name for :) They're
-simply something that's inside a window, a channel or a query usually.
-Windows can have multiple items inside them. It's possible to create
-non-channel/query window items too, currently the third possible window
-item is created by /EXEC -interactive.
-
-In scripts, I think you can quite safely assume that the window item is
-query or channel if the script is intended to be run in one of them.
-Stupid users won't probably have other window items, and smart users
-know where to run the script, or at least later figure out why it
-didn't work :)
Functions that you can use in Irssi's Perl scripts
@@ -199,289 +112,40 @@ listed after the generic ones.
*** General
-Window active_win() - return active window
-Server active_server() - return server in active window
-
-windows() - return list of all windows
-servers() - return list of all servers
-reconnects() - return list of all server reconnections
-channels() - return list of all channels
-queries() - return list of all queries
-commands() - return list of all commands
-logs() - return list of all log files
-ignores() - returns list of all ignores
-Server::channels() - return list of channels in server
-Server::queries() - return list of queries in server
print(str[, level])
-Server::print(channel, str[, level])
-Window::print(str[, level])
-Windowitem::print(str[, level])
Print `str'. Default level is MSGLEVEL_CLIENTNOTICE.
command(cmd)
-Server::command(cmd)
-Window::command(cmd)
-Windowitem::command(cmd)
Send a command `cmd' (in current channel). The '/' char isn't needed.
*** Themes
-You can have user configurable texts in scripts that work just like
-irssi's internal texts that can be changed in themes.
-
-First you'll have to register the formats:
-
-Irssi::theme_register([
- 'format_name', '{hilight my perl format!}',
- 'format2', 'testing.. nick = $0, channel = $1'
-]);
-
-Printing happens with one of the functions:
-
-printformat(level, format, ...)
-Window::printformat(level, format, ...)
-Server::printformat(target, level, format, ...)
-Windowitem::printformat(level, format, ...)
-
-For example:
-
- $channel->printformat(MSGLEVEL_CRAP, 'format2',
- 'nick', $channel->{name});
*** Settings
-settings_get_str(key)
-settings_get_int(key)
-settings_get_bool(key)
-settings_get_time(key)
-settings_get_level(key)
-settings_get_size(key)
- Return value for setting.
-
-settings_set_str(key, value)
-settings_set_int(key, value)
-settings_set_bool(key, value)
-settings_set_time(key, value)
-settings_set_level(key, value)
-settings_set_size(key, value)
- Set value for setting.
- If you change the settings of another module/script with one of these, you
- must emit a "setup changed" signal afterwards.
-
-settings_add_str(section, key, def)
-settings_add_int(section, key, def)
-settings_add_bool(section, key, def)
-settings_add_time(section, key, def)
-settings_add_level(section, key, def)
-settings_add_size(section, key, def)
- Create new setting.
-
-settings_remove(key)
- Remove a setting.
-
*** Signals
-signal_emit(signal, ...)
- Send signal `signal'. You can give 6 parameters at maximum.
-
-signal_continue(...)
- Continue currently emitted signal with different parameters.
-
-signal_add(signal, func)
- Bind `signal' to function `func'.
-
-signal_add_first(signal, func)
- Bind `signal' to function `func'. Call `func' as soon as possible.
-
-signal_add_last(signal, func)
- Bind `signal' to function `func'. Call `func' as late as possible.
-
-signal_remove(signal, func)
- Unbind `signal' from function `func'.
-
-signal_stop()
- Stop the signal that's currently being emitted.
-
-signal_stop_by_name(signal)
- Stop the signal with name `signal' that's currently being emitted.
-
-signal_register(hash)
- Register parameter types for one or more signals.
- `hash' must map one or more signal names to references to arrays
- containing 0 to 6 type names. Some recognized type names include
- int for integers, intptr for references to integers and string for
- strings. For all standard signals see src/perl/perl-signals-list.h
- in the source code (this is generated by src/perl/get-signals.pl).
-
- Any signals that were already registered are unaffected.
-
- Registration is required to get any parameters to signals written in
- Perl and to emit and continue signals from Perl.
-
*** timeouts / IO listener / pidwait
-timeout_add(msecs, func, data)
- Call `func' every `msecs' milliseconds (1000 = 1 second) with
- parameter `data'. Returns tag which can be used to stop the timeout.
-
-timeout_add_once(msecs, func, data);
- Call `func' once after `msecs' milliseconds (1000 = 1 second)
- with parameter `data'. Returns tag which can be used to stop the timeout.
-
-timeout_remove(tag)
- Remove timeout with tag.
-
-input_add(source, condition, func, data)
- Call `func' with parameter `data' when specified IO happens.
- `source' is the file handle that is being listened. `condition' can
- be INPUT_READ, INPUT_WRITE or both. Returns tag which can be used to
- remove the listener.
-
-input_remove(tag)
- Remove listener with tag.
-
-pidwait_add(pid)
- Adds `pid' to the list of processes to wait for. The pid must identify
- a child process of the irssi process. When the process terminates, a
- "pidwait" signal will be sent with the pid and the status from
- waitpid(). This is useful to avoid zombies if your script forks.
-pidwait_remove(pid)
- Removes `pid' from the list of processes to wait for. Terminated
- processes are removed automatically, so it is usually not necessary
- to call this function.
*** Message levels
-level2bits(level)
- Level string -> number
-
-bits2level(bits)
- Level number -> string
-
-combine_level(level, str)
- Combine level number to level string ("+level -level").
- Return new level number.
*** Commands
-Command->{}
- cmd - Command name
- category - Category
-
-command_bind(cmd, func[, category])
- Bind command `cmd' to call function `func'. `category' is the
- category where the command is displayed in /HELP.
-
-command_runsub(cmd, data, server, item)
- Run subcommands for `cmd'. First word in `data' is parsed as
- subcommand. `server' is Irssi::Server rec for current
- Irssi::Windowitem `item'.
-
- Call command_runsub in handler function for `cmd' and bind
- with command_bind("`cmd' `subcmd'", subcmdfunc[, category]);
-
-command_unbind(cmd, func)
- Unbind command `cmd' from function `func'.
-
-command_set_options(cmd, data)
- Set options for command `cmd' to `data'. `data' is a string of
- space separated words which specify the options. Each word can be
- optionally prefixed with one of the following character:
-
- '-': optional argument
- '+': argument required
- '@': optional numeric argument
-command_parse_options(cmd, data)
- Parse options for command `cmd' in `data'. It returns a reference to
- an hash table with the options and a string with the remaining part
- of `data'. On error it returns the undefined value.
*** Windows
-UI::Window->{}
- refnum - Reference number
- name - Name
-
- width - Width
- height - Height
-
- history_name - Name of named historylist for this window
-
- active - Active window item
- active_server - Active server
-
- servertag - active_server must be either undef or have this same tag
- (unless there's items in this window). This is used by
- /WINDOW SERVER -sticky
- level - Current window level
-
- sticky_refnum - 1 if reference number is sticky
-
- data_level - Current data level
- hilight_color - Current activity hilight color
- last_timestamp - Last time timestamp was written in window
- last_line - Last time text was written in window
-
- theme_name - Active theme in window, undef = default
-
-UI::TextDest->{}
- window - Window where the text will be written
- server - Target server
- target - Target channel/query/etc name
- level - Text level
-
- hilight_priority - Priority for the hilighted text
- hilight_color - Color for the hilighted text
-
-
-Window::items()
- Return a list of items in window.
-
-Window
-window_create(automatic)
-Windowitem::window_create(automatic)
- Create a new window.
-
-Window::destroy()
- Destroy the window.
-
-Irssi::Window
-Windowitem::window()
- Returns parent window for window item.
-
-Window
-window_find_name(name)
- Find window with name.
-
-Window
-window_find_refnum(refnum)
- Find window with reference number.
-
-Window
-window_find_level(level)
-Server::window_find_level(level)
- Find window with level.
-
-Window
-window_find_closest(name, level)
-Server::window_find_closest(name, level)
- Find window that matches best to given arguments. `name' can be either
- window name or name of one of the window items.
-
-Window
-window_find_item(name)
-Server::window_find_item(name)
- Find window which contains window item with specified name/server.
Windowitem
window_item_find(name)
@@ -496,27 +160,9 @@ window_refnum_next(refnum, wrap)
windows_refnum_last()
Return refnum for last window.
-Window::item_add(item, automatic)
-Window::item_remove(item)
-Window::item_destroy(item)
- Add/remove/destroy window item
-
-Window::set_active()
- Set window active.
-
-Window::change_server(server)
-Window::set_refnum(refnum)
-Window::set_name(name)
-Window::set_history(name)
-Window::set_level(level)
- Change server/refnum/name/history/level in window.
-
Windowitem::set_active()
Change window item active in parent window.
-Window::item_prev()
-Window::item_next()
- Change to previous/next window item.
Windowitem::change_server(server)
Change server in window item.
@@ -550,70 +196,10 @@ server_create_conn(address[, port=6667[, password=''[, nick=''[, channels='']]]]
*** Server functions
-Server->{}
- type - "SERVER" text
- chat_type - String ID of chat protocol, for example "IRC"
-
- (..contains all the same data as Connect above..)
-
- connect_time - Time when connect() to server finished
- real_connect_time - Time when server sent "connected" message
-
- tag - Unique server tag
- nick - Current nick
-
- connected - Is connection finished? 1|0
- connection_lost - Did we lose the connection (1) or was
- the connection just /DISCONNECTed (0)
-
- rawlog - Rawlog object for the server
-
- version - Server version
- last_invite - Last channel we were invited to
- server_operator - Are we server operator (IRC op) 1|0
- usermode_away - Are we marked as away? 1|0
- away_reason - Away reason message
- banned - Were we banned from this server? 1|0
- lag - Current lag to server in milliseconds
-
-Server
-Connect::connect()
- Connect to server.
-
-Server::disconnect()
- Disconnect from server.
-
-Server
-server_find_tag(tag)
- Find server with tag
-
-Server
-server_find_chatnet(chatnet)
- Find first server that is in `chatnet'
-
-Server::isnickflag(flag)
- Returns 1 if flag is a nick mode flag (@, + or % in IRC)
-
-Server::ischannel(data)
- Returns 1 if start of `data' seems to mean channel.
-
-Server::get_nick_flags()
- Returns nick flag characters in order: op, voice, halfop ("@+%" in IRC).
-
-Server::send_message(target, msg, target_type)
- Sends a message to nick/channel. target_type 0 = channel, 1 = nick
*** Server reconnections
-Reconnect->{}
- type - "RECONNECT" text
- chat_type - String ID of chat protocol, for example "IRC"
-
- (..contains all the same data as Connect above..)
-
- tag - Unique numeric tag
- next_connect - Unix time stamp when the next connection occurs
*** Chat networks
@@ -710,16 +296,6 @@ Server::redirect_event(command, count, arg, remote, failure_signal, signals)
*** Window items
-Windowitem->{}
- type - Type of the window item, for example "CHANNEL" or "QUERY"
- chat_type - String ID of chat protocol, for example "IRC"
-
- server - Active server for item
- name - Name of the item
-
- createtime - Time the window item was created
- data_level - 0=no new data, 1=text, 2=msg, 3=highlighted text
- hilight_color - Color of the last highlighted text
*** Channels