Added SILC Thread Queue API
[crypto.git] / apps / irssi / docs / perl.txt
1  Installation problems
2  ---------------------
3
4 You'll need to have perl support compiled with irssi. If "/LOAD"
5 doesn't show perl in list of loaded modules, you have a problem. See
6 INSTALL file for information about perl problems.
7
8
9  Running scripts
10  ---------------
11
12 Scripts are run with /SCRIPT LOAD command, or the default /RUN alias.
13 "/SCRIPT" shows list of running script, and /SCRIPT UNLOAD can unload
14 scripts.
15
16 Scripts should be placed to ~/.irssi/scripts/ or
17 /usr/local/lib/irssi/scripts/ (or depending on where irssi was
18 installed) directories. After that /RUN script_name should work, you
19 don't need to add the .pl prefix.
20
21
22  Irssi's signals
23  ---------------
24
25 Irssi is pretty much based on sending and handling different signals.
26 Like when you receive a message from server, say
27
28   :nick!user@there.org PRIVMSG you :blahblah
29
30 Irssi will first send a signal:
31
32   "server incoming", SERVER_REC, "nick!user@there PRIVMSG ..."
33
34 You probably don't want to use this signal. Default handler for this
35 signal interprets the header and sends a signal:
36
37   "server event", SERVER_REC, "PRIVMSG ...", "nick", "user@there.org"
38
39 You probably don't want to use this either, since this signal's default
40 handler parses the event string and sends a signal:
41
42   "event privmsg", SERVER_REC, "you :blahblah", "nick", "user@there.org"
43
44 You can at any point grab the signal, do whatever you want to do with
45 it and optionally stop it from going any further by calling
46 Irssi::signal_stop();
47
48 For example:
49
50   sub event_privmsg {
51     # $data = "nick/#channel :text"
52     my ($server, $data, $nick, $address) = @_;
53     my ($target, $text) = split(/ :/, $data, 2);
54
55     Irssi::signal_stop() if ($text =~ /free.*porn/ || $nick =~ /idiot/);
56   }
57
58 Irssi::signal_add("event privmsg", "event_privmsg")
59
60 This will hide all public or private messages that match the regexp
61 "free.*porn" or the sender's nick contain the word "idiot". Yes, you
62 could use /IGNORE instead for both of these :)
63
64 You can also use signal_add_last() if you wish to let the Irssi's internal
65 functions be run before yours.
66
67 A list of signals that irssi sends can be found from signals.txt file.
68
69
70  Creating/replacing /COMMANDS
71  ----------------------------
72
73 You can create your own commands, or replace existing ones with
74 Irssi::command_bind(). The command handling work internally pretty much
75 the same as signal handlers, so if you replace existing command and don't
76 wish to let it run, call Irssi::signal_stop().
77
78 Here's an example:
79
80   # Usage: /HELLO [<nick>]
81   sub cmd_hello {
82     # data - contains the parameters for /HELLO
83     # server - the active server in window
84     # witem - the active window item (eg. channel, query)
85     #         or undef if the window is empty
86     my ($data, $server, $witem) = @_;
87
88     if (!$server || !$server->{connected}) {
89       Irssi::print("Not connected to server");
90       return;
91     }
92
93     if ($data) {
94       $server->command("MSG $data Hello!");
95     } elsif ($witem && ($witem->{type} eq "CHANNEL" ||
96                         $witem->{type} eq "QUERY")) {
97       # there's query/channel active in window
98       $witem->command("MSG ".$witem->{name}." Hello!");
99     } else {
100       Irssi::print("Nick not given, and no active channel/query in window");
101     }
102   }
103
104   Irssi::command_bind('hello', 'cmd_hello');
105
106
107  Message levels
108  --------------
109
110 Several functions expect message levels. They're used to roughly
111 classify messages. They're used by a lot of things including logging,
112 ignoring, highlighting, etc. so you should use as good level as
113 possible. It's possible to have several levels in one message, like
114 ACTIONS+PUBLIC or ACTIONS+MSGS.
115
116 Here's all the levels that irssi supports currently:
117
118   CRAP, MSGS, PUBLIC, NOTICES, SNOTES, CTCPS, ACTIONS, JOINS, PARTS
119   QUITS, KICKS, MODES, TOPICS, WALLOPS, INVITES, NICKS, DCC, DCCMSGS,
120   CLIENTNOTICE, CLIENTCRAP, CLIENTERROR
121
122 And a few special ones that could be included with the levels above:
123
124   HILIGHT - text is highlighted
125   NOHILIGHT - don't check highlighting for this message
126   NO_ACT - don't trigger channel activity when printing this message
127   NEVER - never ignore or log this message (not a good idea usually)
128
129 You can use them with a MSGLEVEL_ prefix, for example:
130
131   $server->print("#channel", 'Hello, world', MSGLEVEL_CLIENTCRAP);
132
133 Writes text to #channel window with CLIENTCRAP level.
134
135
136  Window items
137  ------------
138
139 Meaning of "window" should be pretty clear, but "window item" is
140 something I couldn't really figure out a better name for :) They're
141 simply something that's inside a window, a channel or a query usually.
142 Windows can have multiple items inside them. It's possible to create
143 non-channel/query window items too, currently the third possible window
144 item is created by /EXEC -interactive.
145
146 In scripts, I think you can quite safely assume that the window item is
147 query or channel if the script is intended to be run in one of them.
148 Stupid users won't probably have other window items, and smart users
149 know where to run the script, or at least later figure out why it
150 didn't work :)
151
152
153  Functions that you can use in Irssi's Perl scripts
154  --------------------------------------------------
155
156 If there's a "Xxxx::" text before the command, it means that it belongs to
157 that package. Like "Server::command" means that you should either call it as
158   Irssi::Server::command($server, $cmd);
159 or more easily:
160   $server->command($cmd);
161
162 Commands that don't have the Xxxx prefix are called as Irssi::command();
163
164 Information from most objects can be fetched with $object->{data}, for
165 example current nick in server could be read with $server->{nick}. List
166 of all the information that are in objects are in "Object->{}" sections
167 below.
168
169 Commands are split in two groups, generic ones that could be used with
170 any chat protocol, and IRC specific commands. If you want to use IRC
171 specific commands, or use IRC specific ->{data} in your scripts, you'll
172 need to add "use Irssi::Irc" to your scripts. IRC specific commands are
173 listed after the generic ones.
174
175
176  *** General
177
178 Window active_win() - return active window
179 Server active_server() - return server in active window
180
181 windows() - return list of all windows
182 servers() - return list of all servers
183 reconnects() - return list of all server reconnections
184 channels() - return list of all channels
185 queries() - return list of all queries
186 commands() - return list of all commands
187 logs() - return list of all log files
188 ignores() - returns list of all ignores
189
190 Server::channels() - return list of channels in server
191 Server::queries() - return list of queries in server
192
193 print(str[, level])
194 Server::print(channel, str[, level])
195 Window::print(str[, level])
196 Windowitem::print(str[, level])
197   Print `str'. Default level is MSGLEVEL_CLIENTNOTICE.
198
199 command(cmd)
200 Server::command(cmd)
201 Window::command(cmd)
202 Windowitem::command(cmd)
203   Send a command `cmd' (in current channel). The '/' char isn't needed.
204
205
206  *** Themes
207
208 You can have user configurable texts in scripts that work just like
209 irssi's internal texts that can be changed in themes.
210
211 First you'll have to register the formats:
212
213 Irssi::theme_register([
214   'format_name', '{hilight my perl format!}',
215   'format2', 'testing.. nick = $0, channel = $1'
216 ]);
217
218 Printing happens with one of the functions:
219
220 printformat(level, format, ...)
221 Window::printformat(level, format, ...)
222 Server::printformat(target, level, format, ...)
223 Windowitem::printformat(level, format, ...)
224
225 For example:
226
227   $channel->printformat(MSGLEVEL_CRAP, 'format2',
228                         'nick', $channel->{name});
229
230
231  *** Settings
232
233 settings_get_str(key)
234 settings_get_int(key)
235 settings_get_bool(key)
236 settings_get_time(key)
237 settings_get_level(key)
238 settings_get_size(key)
239   Return value for setting.
240
241 settings_set_str(key, value)
242 settings_set_int(key, value)
243 settings_set_bool(key, value)
244 settings_set_time(key, value)
245 settings_set_level(key, value)
246 settings_set_size(key, value)
247   Set value for setting.
248   If you change the settings of another module/script with one of these, you
249   must emit a "setup changed" signal afterwards.
250
251 settings_add_str(section, key, def)
252 settings_add_int(section, key, def)
253 settings_add_bool(section, key, def)
254 settings_add_time(section, key, def)
255 settings_add_level(section, key, def)
256 settings_add_size(section, key, def)
257   Create new setting.
258
259 settings_remove(key)
260   Remove a setting.
261
262
263  *** Signals
264
265 signal_emit(signal, ...)
266   Send signal `signal'. You can give 6 parameters at maximum.
267
268 signal_add(signal, func)
269   Bind `signal' to function `func'.
270
271 signal_add_first(signal, func)
272   Bind `signal' to function `func'. Call `func' as soon as possible.
273
274 signal_add_last(signal, func)
275   Bind `signal' to function `func'. Call `func' as late as possible.
276
277 signal_remove(signal, func)
278   Unbind `signal' from function `func'.
279
280 signal_stop()
281   Stop the signal that's currently being emitted.
282
283 signal_stop_by_name(signal)
284   Stop the signal with name `signal' that's currently being emitted.
285
286
287   *** timeouts / IO listener
288
289 timeout_add(msecs, func, data)
290   Call `func' every `msecs' milliseconds (1000 = 1 second) with
291   parameter `data'. Returns tag which can be used to stop the timeout.
292
293 timeout_add_once(msecs, func, data);
294   Call 'func' once after `msecs' milliseconds (1000 = 1 second)
295   with parameter `data'. Returns tag which can be used to stop the timeout.
296
297 timeout_remove(tag)
298   Remove timeout with tag.
299
300 input_add(source, condition, func, data)
301   Call `func' with parameter `data' when specified IO happens.
302   `source' is the file handle that is being listened. `condition' can
303   be INPUT_READ, INPUT_WRITE or both. Returns tag which can be used to
304   remove the listener.
305
306 input_remove(tag)
307   Remove listener with tag.
308
309
310  *** Message levels
311
312 level2bits(level)
313   Level string -> number
314
315 bits2level(bits)
316   Level number -> string
317
318 combine_level(level, str)
319   Combine level number to level string ("+level -level").
320   Return new level number.
321
322
323  *** Commands
324
325 Command->{}
326   cmd - Command name
327   category - Category
328
329 command_bind(cmd, func[, category])
330   Bind command `cmd' to call function `func'. `category' is the
331   category where the command is displayed in /HELP.
332
333 command_runsub(cms, data, server, item)
334   Run subcommands for `cmd'. First word in `data' is parsed as
335   subcommand. `server' is Irssi::Server rec for current
336   Irssi::Windowitem `item'.
337   
338   Call command_runsub in handler function for `cmd' and bind
339   with command_bind("`cmd' `subcmd'", subcmdfunc[, category]);
340
341 command_unbind(cmd, func)
342   Unbind command `cmd' from function 'func.
343
344
345  *** Windows
346
347 UI::Window->{}
348   refnum - Reference number
349   name - Name
350
351   width - Width
352   height - Height
353
354   history_name - Name of named historylist for this window
355
356   active - Active window item
357   active_server - Active server
358
359   servertag - active_server must be either undef or have this same tag
360               (unless there's items in this window). This is used by
361               /WINDOW SERVER -sticky
362   level - Current window level
363
364   sticky_refnum - 1 if reference number is sticky
365
366   data_level - Current data level
367   hilight_color - Current activity hilight color
368
369   last_timestamp - Last time timestamp was written in window
370   last_line - Last time text was written in window
371
372   theme_name - Active theme in window, undef = default
373
374 UI::TextDest->{}
375   window - Window where the text will be written
376   server - Target server
377   target - Target channel/query/etc name
378   level - Text level
379
380   hilight_priority - Priority for the hilighted text
381   hilight_color - Color for the hilighted text
382
383
384 Window::items()
385   Return a list of items in window.
386
387 Window
388 window_create(automatic)
389 Windowitem::window_create(automatic)
390   Create a new window.
391
392 Window::destroy()
393   Destroy the window.
394
395 Irssi::Window
396 Windowitem::window()
397   Returns parent window for window item.
398
399 Window
400 window_find_name(name)
401   Find window with name.
402
403 Window
404 window_find_refnum(refnum)
405   Find window with reference number.
406
407 Window
408 window_find_level(level)
409 Server::window_find_level(level)
410   Find window with level.
411
412 Window
413 window_find_closest(name, level)
414 Server::window_find_closest(name, level)
415   Find window that matches best to given arguments. `name' can be either
416   window name or name of one of the window items.
417
418 Window
419 window_find_item(name)
420 Server::window_find_item(name)
421   Find window which contains window item with specified name/server.
422
423 Windowitem
424 window_item_find(name)
425 Server::window_item_find(name)
426 Window::item_find(server, name)
427   Find window item that matches best to given arguments.
428
429 window_refnum_prev(refnum, wrap)
430 window_refnum_next(refnum, wrap)
431   Return refnum for window that's previous/next in windows list.
432
433 windows_refnum_last()
434   Return refnum for last window.
435
436 Window::item_add(item, automatic)
437 Window::item_remove(item)
438 Window::item_destroy(item)
439   Add/remove/destroy window item
440
441 Window::set_active()
442   Set window active.
443
444 Window::change_server(server)
445 Window::set_refnum(refnum)
446 Window::set_name(name)
447 Window::set_history(name)
448 Window::set_level(level)
449   Change server/refnum/name/history/level in window.
450
451 Windowitem::set_active()
452   Change window item active in parent window.
453
454 Window::item_prev()
455 Window::item_next()
456   Change to previous/next window item.
457
458 Windowitem::change_server(server)
459   Change server in window item.
460
461 Windowitem::is_active()
462   Returns 1 if window item is the active item in parent window.
463
464 Window::get_active_name()
465   Return active item's name, or if none is active, window's name
466
467
468  *** Server Connects
469
470 Connect->{}
471   type - "SERVER CONNECT" text
472   chat_type - String ID of chat protocol, for example "IRC"
473
474   address - Address where we connected (irc.blah.org)
475   port - Port where we connected
476   chatnet - Chat network
477
478   password - Password we used in connection.
479   wanted_nick - Nick which we would prefer to use
480   username - User name
481   realname - Real name
482
483 Connect
484 server_create_conn(address[, port=6667[, password=''[, nick=''[, channels='']]]])
485   Create new server connection.
486
487
488  *** Server functions
489
490 Server->{}
491   type - "SERVER" text
492   chat_type - String ID of chat protocol, for example "IRC"
493
494   (..contains all the same data as Connect above..)
495
496   connect_time - Time when connect() to server finished
497   real_connect_time - Time when server sent "connected" message
498
499   tag - Unique server tag
500   nick - Current nick
501
502   connected - Is connection finished? 1|0
503   connection_lost - Did we lose the connection (1) or was
504                     the connection just /DISCONNECTed (0)
505
506   rawlog - Rawlog object for the server
507
508   version - Server version
509   last_invite - Last channel we were invited to
510   server_operator - Are we server operator (IRC op) 1|0
511   usermode_away - Are we marked as away? 1|0
512   away_reason - Away reason message
513   banned - Were we banned from this server? 1|0
514   lag - Current lag to server in milliseconds
515
516 Server
517 Connect::connect()
518   Connect to server.
519
520 Server::disconnect()
521   Disconnect from server.
522
523 Server
524 server_find_tag(tag)
525   Find server with tag
526
527 Server
528 server_find_chatnet(chatnet)
529   Find first server that is in `chatnet'
530
531 Server::isnickflag(flag)
532   Returns 1 if flag is a nick mode flag (@, + or % in IRC)
533
534 Server::ischannel(data)
535   Returns 1 if start of `data' seems to mean channel.
536
537 Server::get_nick_flags()
538   Returns nick flag characters in order: op, voice, halfop ("@+%" in IRC).
539
540 Server::send_message(target, msg, target_type)
541   Sends a message to nick/channel. target_type 0 = channel, 1 = nick
542
543
544  *** Server reconnections
545
546 Reconnect->{}
547   type - "RECONNECT" text
548   chat_type - String ID of chat protocol, for example "IRC"
549
550   (..contains all the same data as Connect above..)
551
552   tag - Unique numeric tag
553   next_connect - Unix time stamp when the next connection occurs
554
555
556  *** Chat networks
557
558 Chatnet->{}
559   type - "CHATNET" text
560   chat_type - String ID of chat protocol, for example "IRC"
561
562   name - name of chat network
563
564   nick - if not empty, nick preferred in this network
565   username - if not empty, username preferred in this network
566   realname - if not empty, realname preferred in this network
567
568   own_host - address to use when connecting this network
569   autosendcmd - command to send after connecting to this network
570
571 chatnet_find(name)
572   Find chat network with name.
573
574
575  *** Server redirections
576
577 This is a powerful feature of Irssi that I haven't seen in other IRC
578 clients. You can EASILY grab the server's reply for a command you send
579 to server without any horrible kludges.
580
581 redirect_register(command, remote, timeout, start, stop, opt)
582    Register new redirection command. By default irssi has already
583    registered at least: whois, whowas, who, list, ison, userhost, ping,
584    "mode channel" (/MODE #channel), "mode b" (/MODE #channel b), "mode e"
585    and "mode I".
586
587    `command' specifies the name of the command to register, it doesn't
588    have to be a real command name, but something you just specify to
589    redirect_event() when using this redirection.
590
591    `remote' specifies if the command is by default a remote command
592    (eg. sent to another server). redirect_event() may override this.
593
594    `timeout' - If remote is TRUE, specifies how many seconds to wait for
595    reply before aborting.
596
597    `start', `stop', `opt' - hash references with "event" => argpos entries.
598    List of events that start and stop this redirection.
599    Start event list may be empty, but there must be at least one
600    stop event. Optional events are checked only if they are received
601    immediately after one of the stop-events. `argpos' specifies the
602    word number in event string which is compared to wanted argument,
603    -1 = don't compare, TRUE always.
604
605   Example (already done by irssi):
606
607   Irssi::redirect_register('mode channel', 0, 0,
608         undef, # no start events
609         { # stop events
610           "event 324" => 1, # MODE-reply
611           "event 403" => 1, # no such channel
612           "event 442" => 1, # "you're not on that channel"
613           "event 479" => 1  # "Cannot join channel (illegal name)"
614         }, { # optional events
615           "event 329", 1 # Channel create time
616         } );
617
618 Server::redirect_event(command, count, arg, remote, failure_signal, signals)
619    Specify that the next command sent to server will be redirected.
620    NOTE: This command MUST be called before sending the command to server.
621
622    `command' - Name of the registered redirection that we're using.
623
624    `count' - How many times to execute the redirection. Some commands may
625    send multiple stop events, like MODE #a,#b.
626
627    `arg' - The argument to be compared in event strings. You can give multiple
628    arguments separated with space.
629
630    `remote' - Specifies if the command is a remote command, -1 = use default.
631
632    `failure_signal' - If irssi can't find the stop signal for the redirection,
633    this signal is called.
634
635    `signals' - hash reference with "event" => "redir signal" entries.
636    If the event is "", all the events belonging to the redirection but not
637    specified here, will be sent there.
638
639   Example:
640
641   # ignore all events generated by whois query, except 311.
642   $server->redirect_event("whois", 1, "cras", 0, undef, {
643                           "event 311" => "redir whois",
644                           "" => "event empty" });
645   $server->send_raw("WHOIS :cras");
646
647
648  *** Window items
649
650 Windowitem->{}
651   type - Type of the window item, for example "CHANNEL" or "QUERY"
652   chat_type - String ID of chat protocol, for example "IRC"
653
654   server - Active server for item
655   name - Name of the item
656
657   createtime - Time the window item was created
658   data_level - 0=no new data, 1=text, 2=msg, 3=highlighted text
659   hilight_color - Color of the last highlighted text
660
661
662  *** Channels
663
664 Channel->{}
665   type - "CHANNEL" text
666   chat_type - String ID of chat protocol, for example "IRC"
667
668   (..contains all the same data as Windowitem above..)
669
670   topic - Channel topic
671   topic_by - Nick who set the topic
672   topic_time - Timestamp when the topic was set
673
674   no_modes - Channel is modeless
675   mode - Channel mode
676   limit - Max. users in channel (+l mode)
677   key - Channel key (password)
678
679   chanop - You are channel operator
680   names_got - /NAMES list has been received
681   wholist - /WHO list has been received
682   synced - Channel is fully synchronized
683
684   joined - JOIN event for this channel has been received
685   left - You just left the channel (for "channel destroyed" event)
686   kicked - You was just kicked out of the channel (for
687            "channel destroyed" event)
688
689 Server::channels_join(channels, automatic)
690   Join to channels in server. `channels' may also contain keys for
691   channels just like with /JOIN command. `automatic' specifies if this
692   channel was joined "automatically" or if it was joined because join
693   was requested by user. If channel join is "automatic", irssi doesn't
694   jump to the window where the channel was joined.
695
696
697 Channel::destroy()
698   Destroy channel.
699
700 Channel
701 channel_find(channel)
702   Find channel from any server.
703
704 Channel
705 Server::channel_find(channel)
706   Find channel from specified server.
707
708
709  *** Nick list
710
711 Nick->{}
712   type - "NICK" text
713   chat_type - String ID of chat protocol, for example "IRC"
714
715   nick - Plain nick
716   host - Host address
717   realname - Real name
718   hops - Hop count to the server the nick is using
719
720   gone, serverop - User status, 1 or 0
721   op, voice, halfop - Channel status, 1 or 0
722
723   last_check - timestamp when last checked gone/ircop status.
724   send_massjoin - Waiting to be sent in a "massjoin" signal, 1 or 0
725
726 Nick
727 Channel::nick_insert(nick, op, voice, send_massjoin)
728   Add nick to nicklist.
729
730 Channel::nick_remove(nick)
731   Remove nick from nicklist.
732
733 Nick
734 Channel::nick_find(nick)
735   Find nick from nicklist.
736
737 Nick
738 Channel::nick_find_mask(mask)
739   Find nick mask from nicklist, wildcards allowed.
740
741 Channel::nicks()
742   Return a list of all nicks in channel.
743
744 Server::nicks_get_same(nick)
745   Return all nick objects in all channels in server. List is in format:
746   Channel, Nick, Channel, ...
747
748
749  *** Queries
750
751 Query->{}
752   type - "QUERY" text
753   chat_type - String ID of chat protocol, for example "IRC"
754
755   (..contains all the same data as Windowitem above..)
756
757   address - Host address of the queries nick
758   server_tag - Server tag used for this nick (doesn't get erased if
759                server gets disconnected)
760   unwanted - 1 if the other side closed or some error occured (DCC chats)
761
762 Query
763 query_create(chat_type, server_tag, nick, automatic)
764   Create a new query.
765
766 Query::destroy()
767   Destroy the query.
768
769 Query::query_change_server(server)
770   Change the active server of the query.
771
772 Query
773 query_find(nick)
774   Find query from any server.
775
776 Query
777 Server::query_find(nick)
778   Find query from specified server.
779
780
781  *** Masks
782
783 You should use the Server version of the function if possible, since
784 with different chat protocols the mask matching could be different.
785
786 mask_match(mask, nick, user, host)
787 Server::mask_match(mask, nick, user, host)
788   Return 1 if `mask' matches nick!user@host.
789
790 mask_match_address(mask, nick, address)
791 Server::mask_match_address(mask, nick, address)
792   Return 1 if `mask' matches nick!address.
793
794 masks_match(masks, nick, address)
795 Server::masks_match(masks, nick, address)
796   Return 1 if any mask in the `masks' (string separated with spaces)
797   matches nick!address.
798
799
800  *** Rawlog
801
802 Rawlog->{}
803   logging - The rawlog is being written to file currently
804   nlines - Number of lines in rawlog
805
806 Rawlog
807 rawlog_create()
808   Create a new rawlog.
809
810 Rawlog::destroy()
811   Destroy the rawlog.
812
813 Rawlog::get_lines()
814   Returns all lines in rawlog.
815
816 rawlog_set_size(lines)
817   Set the default rawlog size for new rawlogs.
818
819 Rawlog::open(filename)
820   Start logging new messages in rawlog to specified file.
821
822 Rawlog::close()
823   Stop logging to file.
824
825 Rawlog::save(filename)
826   Save the current rawlog history to specified file.
827
828 Rawlog::input(str)
829   Send `str' to raw log as input text.
830
831 Rawlog::output(str)
832   Send `str' to raw log as output text.
833
834 Rawlog::redirect(str)
835   Send `str' to raw log as redirection text.
836
837
838  *** Logging
839
840 Log->{}
841   fname - Log file name
842   real_fname - The actual opened log file (after %d.%m.Y etc. are expanded)
843   opened - Log file is open
844   level - Log only these levels
845   last - Timestamp when last message was written
846   autoopen - Automatically open log at startup
847   failed - Opening log failed last time
848   temp - Log isn't saved to config file
849   items - List of log items
850
851 Logitem->{}
852   type - 0=target, 1=window refnum
853   name - Name
854   servertag - Server tag
855
856 Log
857 log_create_rec(fname, level)
858   Create log file.
859
860 Log::update()
861   Add log to list of logs / save changes to config file.
862
863 Log
864 log_find(fname)
865   Find log with file name.
866
867 Log::close()
868   Destroy log file.
869
870 Log::start_logging()
871   Open log file and start logging.
872
873 Log::stop_logging()
874   Close log file.
875
876 Log::item_add(type, name, server)
877   Add log item to log.
878
879 Log::item_destroy(item)
880   Remove log item from log.
881
882 Logitem
883 Log::item_find(type, item, server)
884   Find item from log.
885
886
887  *** Ignores
888
889 Ignore->{}
890   mask - Ignore mask
891   servertag - Ignore only in server
892   channels - Ignore only in channels (list of names)
893   pattern - Ignore text pattern
894
895   level - Ignore level
896
897   exception - This is an exception ignore
898   regexp - Regexp pattern matching
899   fullword - Pattern matches only full words
900
901 ignore_add_rec(ignore)
902   Add ignore record.
903
904 ignore_update_rec(ignore)
905   Update ignore record in configuration
906
907 ignore_check(nick, host, channel, text, level)
908 Server::ignore_check(nick, host, channel, text, level)
909   Return 1 if ignoring matched.
910
911
912  ***
913  *** IRC specific functions. All objects below this are prefixed with Irc::
914  ***
915
916  *** IRC servers
917
918 Irc::Server->{}
919   (..contains all the same data as core Server object..)
920   real_address - Address the IRC server gives
921   usermode - User mode in server
922   userhost - Your user host in server
923
924 Irc::Connect->{}
925   (..contains all the same data as core Connect object..)
926   alternate_nick - Alternate nick to use if default nick is taken.
927
928 Connect::connect()
929   Connect to IRC server.
930
931 Server::get_channels(server)
932   Return a string of all channels (and keys, if any have them) in server,
933   like "#a,#b,#c,#d x,b_chan_key,x,x" or just "#e,#f,#g"
934
935 Server::send_raw(cmd)
936   Send raw message to server, it will be flood protected so you
937   don't need to worry about it.
938
939 Server::send_raw_now(cmd)
940   Send raw message to server immediately without flood protection.
941
942 Server::send_raw_split(cmd, nickarg, max_nicks)
943   Split the `cmd' into several commands so `nickarg' argument has only
944   `max_nicks' number of nicks.
945
946   Example:
947     $server->send_raw_split("KICK #channel nick1,nick2,nick3 :byebye", 3, 2);
948
949   Irssi will send commands "KICK #channel nick1,nick2 :byebye" and
950   "KICK #channel nick3 :byebye" to server.
951
952 Server::ctcp_send_reply(data)
953   Send CTCP reply. This will be "CTCP flood protected" so if there's too
954   many CTCP requests in buffer, this reply might not get sent. The data
955   is the full raw command to be sent to server, like
956     "NOTICE nick :\001VERSION irssi\001"
957
958 Server::isupport(name)
959   Returns the value of the named item in the ISUPPORT (005) numeric to the
960   script. If the item is not present returns undef, if the item has no value
961   then "" is returned use defined $server->isupport("name") if you need to
962   check whether a property is present.
963   See http://www.ietf.org/internet-drafts/draft-brocklesby-irc-isupport-01.txt
964   for more information on the ISUPPORT numeric.
965
966  *** IRC channels
967
968 Ban->{}
969   ban - The ban
970   setby - Nick of who set the ban
971   time - Timestamp when ban was set
972
973 Channel::bans()
974   Return a list of bans in channel.
975
976 Channel::ban_get_mask(nick)
977   Get ban mask for `nick'.
978
979 Channel::banlist_add(ban, nick, time)
980    Add a new ban to channel.
981
982 Channel::banlist_remove(ban)
983    Remove a ban from channel.
984
985
986  *** DCC
987
988 Dcc->{}
989   type - Type of the DCC: chat, send, get
990   orig_type - Original DCC type that was sent to us - same as type except
991               GET and SEND are swapped
992   created - Time stamp when the DCC record was created
993
994   server - Server record where the DCC was initiated.
995   servertag - Tag of the server where the DCC was initiated.
996   mynick - Our nick to use in DCC chat.
997   nick - Other side's nick name.
998
999   chat - Dcc chat record if the request came through DCC chat
1000   target - Who the request was sent to - your nick, channel or empty
1001            if you sent the request
1002   arg - Given argument .. file name usually
1003
1004   addr - Other side's IP address.
1005   port - Port we're connecting in.
1006
1007   starttime - Unix time stamp when the DCC transfer was started
1008   transfd - Bytes transferred
1009
1010 Dcc::Chat->{}
1011   id - Unique identifier - usually same as nick
1012   mirc_ctcp - Send CTCPs without the CTCP_MESSAGE prefix
1013   connection_lost - Other side closed connection
1014
1015 Dcc::Get->{}
1016   (..contains all the same data as core Dcc object..)
1017   size - File size
1018   skipped - Bytes skipped from start (resuming file)
1019
1020   get_type - What to do if file exists? 0=default, 1=rename, 2=overwrite,
1021              3=resume
1022   file - The real file name which we use.
1023   file_quoted - 1 if file name was received quoted ("file name")
1024
1025 Dcc::Send->{}
1026   (..contains all the same data as core Dcc object..)
1027   size - File size
1028   skipped - Bytes skipped from start (resuming file)
1029
1030   file_quoted - 1 if file name was received quoted ("file name")
1031   waitforend - File is sent, just wait for the replies from the other side
1032   gotalldata - Got all acks from the other end
1033
1034
1035 dccs() - return list of all dcc connections
1036
1037 Dcc::destroy()
1038   Destroy DCC connection.
1039
1040 Dcc
1041 dcc_find_item(type, nick, arg)
1042   Find DCC connection.
1043
1044 Dcc
1045 dcc_find_by_port(nick, port)
1046   Find DCC connection by port.
1047
1048 Dcc
1049 Windowitem::get_dcc(item)
1050   If `item' is a query of a =nick, return DCC chat record of nick.
1051
1052 Dcc::chat_send(data)
1053   Send `data' to dcc chat.
1054
1055 Server::dcc_ctcp_message(target, notice, msg)
1056 Dcc::ctcp_message(target, notice, msg)
1057   Send a CTCP message/notify to target.
1058
1059
1060  *** Netsplits
1061
1062 Netsplit->{}
1063   nick - Nick
1064   address - Nick's host
1065   destroy - Timestamp when this record should be destroyed
1066   server - Netsplitserver object
1067   channels - list of channels (Netsplitchannel objects) the nick was in
1068
1069 Netsplitserver->{}
1070   server - The server nick was in
1071   destserver - The other server where split occured.
1072   count - Number of splits in server
1073
1074 Netsplitchannel->{}
1075   name - Channel name
1076   nick - Nick object
1077
1078 Netsplit
1079 Server::netsplit_find(nick, address)
1080   Check if nick!address is on the other side of netsplit. Netsplit records
1081   are automatically removed after 30 minutes (current default)..
1082
1083 Nick
1084 Server::netsplit_find_channel(nick, address, channel)
1085   Find nick record for nick!address in channel `channel'.
1086
1087
1088  *** Notify list
1089
1090 Notifylist->{}
1091   mask - Notify nick mask
1092   away_check - Notify away status changes
1093   idle_check_time - Notify when idle time is reset and idle was bigger
1094                     than this (seconds)
1095   ircnets - List of ircnets (strings) the notify is checked
1096
1097 notifies() - Return list of all notifies
1098
1099 Notifylist
1100 notifylist_add(mask, ircnets, away_check, idle_check_time)
1101   Add new item to notify list.
1102
1103 notifylist_remove(mask)
1104   Remove item from notify list.
1105
1106 Notifylist
1107 notifylist_find(mask, ircnet)
1108   Find notify.
1109
1110 Server
1111 notifylist_ison(nick, serverlist)
1112   Check if `nick' is in IRC. `serverlist' is a space separated
1113   list of server tags. If it's empty string, all servers will be checked.
1114
1115 Server::notifylist_ison_server(nick)
1116   Check if `nick' is on IRC server.
1117
1118 Notifylist::ircnets_match(ircnet)
1119   Returns 1 if notify is checked in `ircnet'.
1120
1121
1122  *** /EXEC processes
1123
1124 Process->{}
1125   id - ID for the process
1126   name - Name for the process (if given)
1127   args - The command that is being executed
1128
1129   pid - PID for the executed command
1130   target - send text with /msg <target> ...
1131   target_win - print text to this window
1132
1133   shell - start the program via /bin/sh
1134   notice - send text with /notice, not /msg if target is set
1135   silent - don't print "process exited with level xx"