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