updates.
[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). This will work just as if you
204   had typed `cmd' in command line, so you'll need to use /COMMANDS or the
205   text will be sent to the channel.
206
207   Just like above, except different calling method.
208
209
210  *** Themes
211
212 You can have user configurable texts in scripts that work just like
213 irssi's internal texts that can be changed in themes.
214
215 First you'll have to register the formats:
216
217 Irssi::theme_register([
218   'format_name', '{hilight my perl format!}',
219   'format2', 'testing.. nick = $0, channel = $1'
220 ]);
221
222 Printing happens with one of the functions:
223
224 printformat(level, format, ...)
225 Window::printformat(level, format, ...)
226 Server::printformat(target, level, format, ...)
227 Windowitem::printformat(level, format, ...)
228
229 For example:
230
231   $channel->printformat(MSGLEVEL_CRAP, 'format2',
232                         'nick', $channel->{name});
233
234
235  *** Settings
236
237 settings_get_str(key)
238 settings_get_int(key)
239 settings_get_bool(key)
240   Return value for setting.
241
242 settings_add_str(section, key, def)
243 settings_add_int(section, key, def)
244 settings_add_bool(section, key, def)
245   Create new setting.
246
247 settings_remove(key)
248   Remove a setting.
249
250
251  *** Signals
252
253 signal_emit(signal, ...)
254   Send signal `signal'. You can give 6 parameters at maximum.
255
256 signal_add(signal, func)
257   Bind `signal' to function `func'.
258
259 signal_add_first(signal, func)
260   Bind `signal' to function `func'. Call `func' as soon as possible.
261
262 signal_add_last(signal, func)
263   Bind `signal' to function `func'. Call `func' as late as possible.
264
265 signal_remove(signal, func)
266   Unbind `signal' from function `func'.
267
268 signal_stop()
269   Stop the signal that's currently being emitted.
270
271 signal_stop_by_name(signal)
272   Stop the signal with name `signal' that's currently being emitted.
273
274
275   *** timeouts / IO listener
276
277 timeout_add(msecs, func, data)
278   Call `func' every `msecs' milliseconds (1000 = 1 second) with
279   parameter `data'. Returns tag which can be used to stop the timeout.
280
281 timeout_remove(tag)
282   Remove timeout with tag.
283
284 input_add(source, condition, func, data)
285   Call `func' with parameter `data' when specified IO happens.
286   `source' is the file handle that is being listened. `condition' can
287   be INPUT_READ, INPUT_WRITE or both. Returns tag which can be used to
288   remove the listener.
289
290 input_remove(tag)
291   Remove listener with tag.
292
293
294  *** Message levels
295
296 level2bits(level)
297   Level string -> number
298
299 bits2level(bits)
300   Level number -> string
301
302 combine_level(level, str)
303   Combine level number to level string ("+level -level").
304   Return new level number.
305
306
307  *** Commands
308
309 Command->{}
310   cmd - Command name
311   category - Category
312
313 command_bind(cmd, func[, category])
314   Bind command `cmd' to call function `func'. `category' is the
315   category where the command is displayed in /HELP.
316
317 command_runsub(cms, data, server, item)
318   Run subcommands for `cmd'. First word in `data' is parsed as
319   subcommand. `server' is Irssi::Server rec for current
320   Irssi::Windowitem `item'.
321   
322   Call command_runsub in handler function for `cmd' and bind
323   with command_bind("`cmd' `subcmd'", subcmdfunc[, category]);
324
325 command_unbind(cmd, func)
326   Unbind command `cmd' from function 'func.
327
328
329  *** Windows
330
331 UI::Window->{}
332   refnum - Reference number
333   name - Name
334
335   width - Width
336   height - Height
337
338   history_name - Name of named historylist for this window
339
340   active - Active window item
341   active_server - Active server
342
343   servertag - active_server must be either undef or have this same tag
344               (unless there's items in this window). This is used by
345               /WINDOW SERVER -sticky
346   level - Current window level
347
348   sticky_refnum - 1 if reference number is sticky
349
350   data_level - Current data level
351   hilight_color - Current activity hilight color
352
353   last_timestamp - Last time timestamp was written in window
354   last_line - Last time text was written in window
355
356   theme_name - Active theme in window, undef = default
357
358 UI::TextDest->{}
359   window - Window where the text will be written
360   server - Target server
361   target - Target channel/query/etc name
362   level - Text level
363
364   hilight_priority - Priority for the hilighted text
365   hilight_color - Color for the hilighted text
366
367
368 Window::items()
369   Return a list of items in window.
370
371 Window
372 window_create(automatic)
373 Windowitem::window_create(automatic)
374   Create a new window.
375
376 Window::destroy()
377   Destroy the window.
378
379 Irssi::Window
380 Windowitem::window()
381   Returns parent window for window item.
382
383 Window
384 window_find_name(name)
385   Find window with name.
386
387 Window
388 window_find_refnum(refnum)
389   Find window with reference number.
390
391 Window
392 window_find_level(level)
393 Server::window_find_level(level)
394   Find window with level.
395
396 Window
397 window_find_closest(name, level)
398 Server::window_find_closest(name, level)
399   Find window that matches best to given arguments. `name' can be either
400   window name or name of one of the window items.
401
402 Window
403 window_find_item(name)
404 Server::window_find_item(name)
405   Find window which contains window item with specified name/server.
406
407 Windowitem
408 window_item_find(name)
409 Server::window_item_find(name)
410 Window::item_find(server, name)
411   Find window item that matches best to given arguments.
412
413 window_refnum_prev(refnum, wrap)
414 window_refnum_next(refnum, wrap)
415   Return refnum for window that's previous/next in windows list.
416
417 windows_refnum_last()
418   Return refnum for last window.
419
420 Window::item_add(item, automatic)
421 Window::item_remove(item)
422 Window::item_destroy(item)
423   Add/remove/destroy window item
424
425 Window::set_active()
426   Set window active.
427
428 Window::change_server(server)
429 Window::set_refnum(refnum)
430 Window::set_name(name)
431 Window::set_history(name)
432 Window::set_level(level)
433   Change server/refnum/name/history/level in window.
434
435 Windowitem::set_active()
436   Change window item active in parent window.
437
438 Window::item_prev()
439 Window::item_next()
440   Change to previous/next window item.
441
442 Windowitem::change_server(server)
443   Change server in window item.
444
445 Windowitem::is_active()
446   Returns 1 if window item is the active item in parent window.
447
448 Window::get_active_name()
449   Return active item's name, or if none is active, window's name
450
451
452  *** Server Connects
453
454 Connect->{}
455   type - "SERVER CONNECT" text
456   chat_type - String ID of chat protocol, for example "IRC"
457
458   address - Address where we connected (irc.blah.org)
459   port - Port where we connected
460   chatnet - Chat network
461
462   password - Password we used in connection.
463   wanted_nick - Nick which we would prefer to use
464   username - User name
465   realname - Real name
466
467 Connect
468 server_create_conn(address[, port=6667[, password=''[, nick=''[, channels='']]]])
469   Create new server connection.
470
471
472  *** Server functions
473
474 Server->{}
475   type - "SERVER" text
476   chat_type - String ID of chat protocol, for example "IRC"
477
478   (..contains all the same data as Connect above..)
479
480   connect_time - Time when connect() to server finished
481   real_connect_time - Time when server sent "connected" message
482
483   tag - Unique server tag
484   nick - Current nick
485
486   connected - Is connection finished? 1|0
487   connection_lost - Did we lose the connection (1) or was
488                     the connection just /DISCONNECTed (0)
489
490   rawlog - Rawlog object for the server
491
492   version - Server version
493   last_invite - Last channel we were invited to
494   server_operator - Are we server operator (IRC op) 1|0
495   usermode_away - Are we marked as away? 1|0
496   away_reason - Away reason message
497   banned - Were we banned from this server? 1|0
498   lag - Current lag to server in milliseconds
499
500 Server
501 Connect::connect()
502   Connect to server.
503
504 Server::disconnect()
505   Disconnect from server.
506
507 Server
508 server_find_tag(tag)
509   Find server with tag
510
511 Server
512 server_find_chatnet(chatnet)
513   Find first server that is in `chatnet'
514
515 Server::isnickflag(flag)
516   Returns 1 if flag is a nick mode flag (@, + or % in IRC)
517
518 Server::ischannel(data)
519   Returns 1 if start of `data' seems to mean channel.
520
521 Server::get_nick_flags()
522   Returns nick flag characters in order: op, voice, halfop ("@+%" in IRC).
523
524 Server::send_message(target, msg, target_type)
525   Sends a message to nick/channel. target_type 0 = channel, 1 = nick
526
527
528  *** Server reconnections
529
530 Reconnect->{}
531   type - "RECONNECT" text
532   chat_type - String ID of chat protocol, for example "IRC"
533
534   (..contains all the same data as Connect above..)
535
536   tag - Unique numeric tag
537   next_connect - Unix time stamp when the next connection occurs
538
539
540  *** Chat networks
541
542 Chatnet->{}
543   type - "CHATNET" text
544   chat_type - String ID of chat protocol, for example "IRC"
545
546   name - name of chat network
547
548   nick - if not empty, nick preferred in this network
549   username - if not empty, username preferred in this network
550   realname - if not empty, realname preferred in this network
551
552   own_host - address to use when connecting this network
553   autosendcmd - command to send after connecting to this network
554
555 chatnet_find(name)
556   Find chat network with name.
557
558
559  *** Server redirections
560
561 This is a powerful feature of Irssi that I haven't seen in other IRC
562 clients. You can EASILY grab the server's reply for a command you send
563 to server without any horrible kludges.
564
565 redirect_register(command, remote, timeout, start, stop, opt)
566    Register new redirection command. By default irssi has already
567    registered at least: whois, whowas, who, list, ison, userhost, ping,
568    "mode channel" (/MODE #channel), "mode b" (/MODE #channel b), "mode e"
569    and "mode I".
570
571    `command' specifies the name of the command to register, it doesn't
572    have to be a real command name, but something you just specify to
573    redirect_event() when using this redirection.
574
575    `remote' specifies if the command is by default a remote command
576    (eg. sent to another server). redirect_event() may override this.
577
578    `timeout' - If remote is TRUE, specifies how many seconds to wait for
579    reply before aborting.
580
581    `start', `stop', `opt' - hash references with "event" => argpos entries.
582    List of events that start and stop this redirection.
583    Start event list may be empty, but there must be at least one
584    stop event. Optional events are checked only if they are received
585    immediately after one of the stop-events. `argpos' specifies the
586    word number in event string which is compared to wanted argument,
587    -1 = don't compare, TRUE always.
588
589   Example (already done by irssi):
590
591   Irssi::redirect_register('mode channel', 0, 0,
592         undef, # no start events
593         { # stop events
594           "event 324" => 1, # MODE-reply
595           "event 403" => 1, # no such channel
596           "event 442" => 1, # "you're not on that channel"
597           "event 479" => 1  # "Cannot join channel (illegal name)"
598         }, { # optional events
599           "event 329", 1 # Channel create time
600         } );
601
602 Server::redirect_event(command, count, arg, remote, failure_signal, signals)
603    Specify that the next command sent to server will be redirected.
604    NOTE: This command MUST be called before sending the command to server.
605
606    `command' - Name of the registered redirection that we're using.
607
608    `count' - How many times to execute the redirection. Some commands may
609    send multiple stop events, like MODE #a,#b.
610
611    `arg' - The argument to be compared in event strings. You can give multiple
612    arguments separated with space.
613
614    `remote' - Specifies if the command is a remote command, -1 = use default.
615
616    `failure_signal' - If irssi can't find the stop signal for the redirection,
617    this signal is called.
618
619    `signals' - hash reference with "event" => "redir signal" entries.
620    If the event is "", all the events belonging to the redirection but not
621    specified here, will be sent there.
622
623   Example:
624
625   # ignore all events generated by whois query, except 311.
626   $server->redirect_event("whois", 1, "cras", 0, undef, {
627                           "event 311" => "redir whois",
628                           "" => "event empty" });
629   $server->send_raw("WHOIS :cras");
630
631
632  *** Window items
633
634 Windowitem->{}
635   type - Type of the window item, for example "CHANNEL" or "QUERY"
636   chat_type - String ID of chat protocol, for example "IRC"
637
638   server - Active server for item
639   name - Name of the item
640
641   createtime - Time the window item was created
642   data_level - 0=no new data, 1=text, 2=msg, 3=highlighted text
643   hilight_color - Color of the last highlighted text
644
645
646  *** Channels
647
648 Channel->{}
649   type - "CHANNEL" text
650   chat_type - String ID of chat protocol, for example "IRC"
651
652   (..contains all the same data as Windowitem above..)
653
654   topic - Channel topic
655   topic_by - Nick who set the topic
656   topic_time - Timestamp when the topic was set
657
658   no_modes - Channel is modeless
659   mode - Channel mode
660   limit - Max. users in channel (+l mode)
661   key - Channel key (password)
662
663   chanop - You are channel operator
664   names_got - /NAMES list has been received
665   wholist - /WHO list has been received
666   synced - Channel is fully synchronized
667
668   joined - JOIN event for this channel has been received
669   left - You just left the channel (for "channel destroyed" event)
670   kicked - You was just kicked out of the channel (for
671            "channel destroyed" event)
672
673 Server::channels_join(channels, automatic)
674   Join to channels in server. `channels' may also contain keys for
675   channels just like with /JOIN command. `automatic' specifies if this
676   channel was joined "automatically" or if it was joined because join
677   was requested by user. If channel join is "automatic", irssi doesn't
678   jump to the window where the channel was joined.
679
680 Channel
681 Server::channel_create(name, automatic)
682   Create new channel.
683
684 Channel
685 channel_create(chat_type, name, automatic)
686   Create new channel with specified chat type.
687   FIXME: should this be removed? is this useful for anything?
688
689 Channel::destroy()
690   Destroy channel.
691
692 Channel
693 channel_find(channel)
694   Find channel from any server.
695
696 Channel
697 Server::channel_find(channel)
698   Find channel from specified server.
699
700
701  *** Nick list
702
703 Nick->{}
704   type - "NICK" text
705   chat_type - String ID of chat protocol, for example "IRC"
706
707   nick - Plain nick
708   host - Host address
709   realname - Real name
710   hops - Hop count to the server the nick is using
711
712   gone, serverop - User status, 1 or 0
713   op, voice, halfop - Channel status, 1 or 0
714
715   last_check - timestamp when last checked gone/ircop status.
716   send_massjoin - Waiting to be sent in a "massjoin" signal, 1 or 0
717
718 Nick
719 Channel::nick_insert(nick, op, voice, send_massjoin)
720   Add nick to nicklist.
721
722 Channel::nick_remove(nick)
723   Remove nick from nicklist.
724
725 Nick
726 Channel::nick_find(mask)
727   Find nick from nicklist.
728
729 Channel::nicks(channel)
730   Return a list of all nicks in channel.
731
732 Server::nicks_get_same(nick)
733   Return all nick objects in all channels in server. List is in format:
734   Channel, Nick, Channel, ...
735
736
737  *** Queries
738
739 Query->{}
740   type - "QUERY" text
741   chat_type - String ID of chat protocol, for example "IRC"
742
743   (..contains all the same data as Windowitem above..)
744
745   address - Host address of the queries nick
746   server_tag - Server tag used for this nick (doesn't get erased if
747                server gets disconnected)
748   unwanted - 1 if the other side closed or some error occured (DCC chats)
749
750 Query
751 query_create(chat_type, server_tag, nick, automatic)
752   Create a new query.
753
754 Query::destroy()
755   Destroy the query.
756
757 Query::query_change_server(server)
758   Change the active server of the query.
759
760 Query
761 query_find(nick)
762   Find query from any server.
763
764 Query
765 Server::query_find(nick)
766   Find query from specified server.
767
768
769  *** Masks
770
771 You should use the Server version of the function if possible, since
772 with different chat protocols the mask matching could be different.
773
774 mask_match(mask, nick, user, host)
775 Server::mask_match(mask, nick, user, host)
776   Return 1 if `mask' matches nick!user@host.
777
778 mask_match_address(mask, nick, address)
779 Server::mask_match_address(mask, nick, address)
780   Return 1 if `mask' matches nick!address.
781
782 masks_match(masks, nick, address)
783 Server::masks_match(masks, nick, address)
784   Return 1 if any mask in the `masks' (string separated with spaces)
785   matches nick!address.
786
787
788  *** Rawlog
789
790 Rawlog->{}
791   logging - The rawlog is being written to file currently
792   nlines - Number of lines in rawlog
793
794 Rawlog
795 rawlog_create()
796   Create a new rawlog.
797
798 Rawlog::destroy()
799   Destroy the rawlog.
800
801 Rawlog::get_lines()
802   Returns all lines in rawlog.
803
804 rawlog_set_size(lines)
805   Set the default rawlog size for new rawlogs.
806
807 Rawlog::open(filename)
808   Start logging new messages in rawlog to specified file.
809
810 Rawlog::close()
811   Stop logging to file.
812
813 Rawlog::save(filename)
814   Save the current rawlog history to specified file.
815
816 Rawlog::input(str)
817   Send `str' to raw log as input text.
818
819 Rawlog::output(str)
820   Send `str' to raw log as output text.
821
822 Rawlog::redirect(str)
823   Send `str' to raw log as redirection text.
824
825
826  *** Logging
827
828 Log->{}
829   fname - Log file name
830   real_fname - The actual opened log file (after %d.%m.Y etc. are expanded)
831   opened - Log file is open
832   level - Log only these levels
833   last - Timestamp when last message was written
834   autoopen - Automatically open log at startup
835   failed - Opening log failed last time
836   temp - Log isn't saved to config file
837   items - List of log items
838
839 Logitem->{}
840   type - 0=target, 1=window refnum
841   name - Name
842   servertag - Server tag
843
844 Log
845 log_create_rec(fname, level)
846   Create log file.
847
848 Log::update()
849   Add log to list of logs / save changes to config file.
850
851 Log
852 log_find(fname)
853   Find log with file name.
854
855 Log::close()
856   Destroy log file.
857
858 Log::start_logging()
859   Open log file and start logging.
860
861 Log::stop_logging()
862   Close log file.
863
864 Log::item_add(type, name, server)
865   Add log item to log.
866
867 Log::item_destroy(item)
868   Remove log item from log.
869
870 Logitem
871 Log::item_find(type, item, server)
872   Find item from log.
873
874
875  *** Ignores
876
877 Ignore->{}
878   mask - Ignore mask
879   servertag - Ignore only in server
880   channels - Ignore only in channels (list of names)
881   pattern - Ignore text pattern
882
883   level - Ignore level
884
885   exception - This is an exception ignore
886   regexp - Regexp pattern matching
887   fullword - Pattern matches only full words
888
889 ignore_add_rec(ignore)
890   Add ignore record.
891
892 ignore_update_rec(ignore)
893   Update ignore record in configuration
894
895 ignore_check(nick, host, channel, text, level)
896 Server::ignore_check(nick, host, channel, text, level)
897   Return 1 if ignoring matched.
898
899
900  ***
901  *** IRC specific functions. All objects below this are prefixed with Irc::
902  ***
903
904  *** IRC servers
905
906 Irc::Server->{}
907   (..contains all the same data as core Server object..)
908   real_address - Address the IRC server gives
909   usermode - User mode in server
910   userhost - Your user host in server
911
912 Irc::Connect->{}
913   (..contains all the same data as core Connect object..)
914   alternate_nick - Alternate nick to use if default nick is taken.
915
916 Connect::connect()
917   Connect to IRC server.
918
919 Server::get_channels(server)
920   Return a string of all channels (and keys, if any have them) in server,
921   like "#a,#b,#c,#d x,b_chan_key,x,x" or just "#e,#f,#g"
922
923 Server::send_raw(cmd)
924   Send raw message to server, it will be flood protected so you
925   don't need to worry about it.
926
927 Server::send_raw_now(cmd)
928   Send raw message to server immediately without flood protection.
929
930 Server::send_raw_split(cmd, nickarg, max_nicks)
931   Split the `cmd' into several commands so `nickarg' argument has only
932   `max_nicks' number of nicks.
933
934   Example:
935     $server->send_raw_split("KICK #channel nick1,nick2,nick3 :byebye", 3, 2);
936
937   Irssi will send commands "KICK #channel nick1,nick2 :byebye" and
938   "KICK #channel nick3 :byebye" to server.
939
940 Server::ctcp_send_reply(data)
941   Send CTCP reply. This will be "CTCP flood protected" so if there's too
942   many CTCP requests in buffer, this reply might not get sent. The data
943   is the full raw command to be sent to server, like
944     "NOTICE nick :\001VERSION irssi\001"
945
946
947  *** IRC channels
948
949 Ban->{}
950   ban - The ban
951   setby - Nick of who set the ban
952   time - Timestamp when ban was set
953
954 Channel
955 Server::channel_create(name, automatic)
956   Create new channel.
957
958 Channel::bans()
959   Return a list of bans in channel.
960
961 Channel::ebans()
962   Return a list of ban exceptions in channel.
963
964 Channel::invites()
965   Return invite list (+I) of channel.
966
967 Channel::ban_get_mask(nick)
968   Get ban mask for `nick'.
969
970 Channel::banlist_add(ban, nick, time)
971    Add a new ban to channel.
972
973 Channel::banlist_remove(ban)
974    Remove a ban from channel.
975
976 Channel::banlist_exception_add(ban, nick, time)
977    Add a new ban exception to channel.
978
979 Channel::banlist_exception_remove(ban)
980    Remove a ban exception from channel.
981
982 Channel::invitelist_add(mask)
983    Add a new invite mask to channel.
984
985 Channel::invitelist_remove(mask)
986    Remove invite mask from channel.
987
988 modes_join(old, mode, channel)
989   Add `mode' to `old' - return newly allocated mode. If `channel' is 1,
990   we're parsing channel mode and we should try to join mode arguments too.
991
992
993  *** DCC
994
995 Dcc->{}
996   type - Type of the DCC: chat, send, get
997   orig_type - Original DCC type that was sent to us - same as type except
998               GET and SEND are swapped
999   created - Time stamp when the DCC record was created
1000
1001   server - Server record where the DCC was initiated.
1002   servertag - Tag of the server where the DCC was initiated.
1003   mynick - Our nick to use in DCC chat.
1004   nick - Other side's nick name.
1005
1006   chat - Dcc chat record if the request came through DCC chat
1007   target - Who the request was sent to - your nick, channel or empty
1008            if you sent the request
1009   arg - Given argument .. file name usually
1010
1011   addr - Other side's IP address.
1012   port - Port we're connecting in.
1013
1014   starttime - Unix time stamp when the DCC transfer was started
1015   transfd - Bytes transferred
1016
1017 Dcc::Chat->{}
1018   id - Unique identifier - usually same as nick
1019   mirc_ctcp - Send CTCPs without the CTCP_MESSAGE prefix
1020   connection_lost - Other side closed connection
1021
1022 Dcc::Get->{}
1023   (..contains all the same data as core Dcc object..)
1024   size - File size
1025   skipped - Bytes skipped from start (resuming file)
1026
1027   get_type - What to do if file exists? 0=default, 1=rename, 2=overwrite,
1028              3=resume
1029   file - The real file name which we use.
1030   file_quoted - 1 if file name was received quoted ("file name")
1031
1032 Dcc::Send->{}
1033   (..contains all the same data as core Dcc object..)
1034   size - File size
1035   skipped - Bytes skipped from start (resuming file)
1036
1037   file_quoted - 1 if file name was received quoted ("file name")
1038   waitforend - File is sent, just wait for the replies from the other side
1039   gotalldata - Got all acks from the other end
1040
1041
1042 dccs() - return list of all dcc connections
1043
1044 Dcc::destroy()
1045   Destroy DCC connection.
1046
1047 Dcc
1048 dcc_find_item(type, nick, arg)
1049   Find DCC connection.
1050
1051 Dcc
1052 dcc_find_by_port(nick, port)
1053   Find DCC connection by port.
1054
1055 Dcc
1056 Windowitem::get_dcc(item)
1057   If `item' is a query of a =nick, return DCC chat record of nick.
1058
1059 Dcc::chat_send(data)
1060   Send `data' to dcc chat.
1061
1062 Server::dcc_ctcp_message(target, notice, msg)
1063 Dcc::ctcp_message(target, notice, msg)
1064   Send a CTCP message/notify to target.
1065
1066
1067  *** Netsplits
1068
1069 Netsplit->{}
1070   nick - Nick
1071   address - Nick's host
1072   destroy - Timestamp when this record should be destroyed
1073   server - Netsplitserver object
1074   channels - list of channels (Netsplitchannel objects) the nick was in
1075
1076 Netsplitserver->{}
1077   server - The server nick was in
1078   destserver - The other server where split occured.
1079   count - Number of splits in server
1080
1081 Netsplitchannel->{}
1082   name - Channel name
1083   nick - Nick object
1084
1085 Netsplit
1086 Server::netsplit_find(nick, address)
1087   Check if nick!address is on the other side of netsplit. Netsplit records
1088   are automatically removed after 30 minutes (current default)..
1089
1090 Nick
1091 Server::netsplit_find_channel(nick, address, channel)
1092   Find nick record for nick!address in channel `channel'.
1093
1094
1095  *** Notify list
1096
1097 Notifylist->{}
1098   mask - Notify nick mask
1099   away_check - Notify away status changes
1100   idle_check_time - Notify when idle time is reset and idle was bigger
1101                     than this (seconds)
1102   ircnets - List of ircnets (strings) the notify is checked
1103
1104 notifies() - Return list of all notifies
1105
1106 Notifylist
1107 notifylist_add(mask, ircnets, away_check, idle_check_time)
1108   Add new item to notify list.
1109
1110 notifylist_remove(mask)
1111   Remove item from notify list.
1112
1113 Notifylist
1114 notifylist_find(mask, ircnet)
1115   Find notify.
1116
1117 Server
1118 notifylist_ison(nick, serverlist)
1119   Check if `nick' is in IRC. `serverlist' is a space separated
1120   list of server tags. If it's empty string, all servers will be checked.
1121
1122 Server::notifylist_ison_server(nick)
1123   Check if `nick' is on IRC server.
1124
1125 Notifylist::ircnets_match(ircnet)
1126   Returns 1 if notify is checked in `ircnet'.
1127
1128
1129  *** /EXEC processes
1130
1131 Process->{}
1132   id - ID for the process
1133   name - Name for the process (if given)
1134   args - The command that is being executed
1135
1136   pid - PID for the executed command
1137   target - send text with /msg <target> ...
1138   target_win - print text to this window
1139
1140   shell - start the program via /bin/sh
1141   notice - send text with /notice, not /msg if target is set
1142   silent - don't print "process exited with level xx"