Skip to content
ailin-nemui edited this page Jan 21, 2014 · 5 revisions

Irssi::Irc::Server

Home | Irssi | Irc

ATTRIBUTES

METHODS

Many of these methods take $server as a first argument. These are intended to be called as $server->method(@args). Therefore, the $server argument will not be elaborated on in the following descriptions.

Event Redirection

redirect_event $server, $cmd, $count, $arg, $remote, $failure_sig, $signals

This method sets up an event redirection for a given server and event. $cmd is the command in question. $count is the number of times to execute the redirection. This is useful for commands which may send multiple stop events.

$arg is a string which will be compared to the event result strings. Multiple arguments can be given, separated by spaces.

$remote is a flag indicating whether the command is run remotely. A value of -1 causes the redirection to fall back to the original value specified when the redirect was registered.

$failure_sig is a string containing the name of a signal to emit if the stop signal(s) cannot be called, for whatever reason. Most likely, this will be due to a timeout occuring.

$signals is a hashref containing "event <num>" => "redir <signal-name>" pairs.

For a more complete example, see the Guide/Redirection

redirect_register $cmd, $remote, $timeout, $start_sigs, $stop_sigs, $opt_sigs

This method registers a new command specified in $cmd and makes it available for redirecting with redirect_event.

$cmd is the name of the command, $remote is a flag indicating if the command is by default run on a remote server. Its value can be overridden by the $remote value passed in redirect_event.

$timeout specifies the default number of seconds to wait before assuming the command failed. The timeout is only valid if the $remote flag is true.

$start_sigs is a hashref, the keys of which are the signals which cause the redirection to begin. $end_sigs is another hashref, this time containing signals which indicate the redirection is complete.

$opt_sigs is another hashref containing optional signals, which will be redirected if they are received immediately after one of the stop events.

For each of the above 3 hashes, the signal name is used as a key, and the corresponding value is an integer which specifies the "argument position." Argument position selects the nth word of the response for matching against the $arg value passed into redirect_event.

The following list shows the redirects which are registered by default on Irssi startup:

whois
whowas
who
list
ison
userhost
mode user
mode channel
mode b

Bans.

mode e

Ban Exceptions

mode I

Invite list

ping

TODO: Untested, info gathered from src/irc/core/servers-redirect.c and src/irc/core/servers-redirect.h. See servers-redirect.c for an online version.

redirect_get_signal $server, $prefix, $event, $args

TODO

It appears $prefix is typically the server (maybe network sometimes) name. Event is the name of the event being listened for(?) e.g. 'event 311'.

redirect_peek_signal $server, $prefix, $event, $args

TODO Probably quite similar to redirect_get_signal()

Netsplits

netsplit_find
netsplit_find_channel

Misc

ctcp_send_reply

TODO

get_channels $server

Returns a list of channels you are joined to on this server.

isupport $server, $name

This method allows you to query the server to determine what features it supports (assuming it at least supports isupport). $name is the name of the parameter you wish to query. Details on the isupport parameters can be found [[in the original draft proposal|http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt]] or a slightly easier to read version

notifylist_ison_server $server, $nick

TODO

query_create

TODO

Sending Raw Data

send_raw $server, $cmd

Sends the command specified in $cmd to $server. Despite the name, it does not send a "raw" string, but instead truncates it to 510 bytes, and appends a CRLF line-ending to it. The command is not necessarily sent immediately. If the current time is less than one cmd_queue_speed duration since the last command, or if there are more than cmds_max_at_once in the queue, it is queued for later sending.

TODO: What's the difference between the queue orderings in irc/core/irc.c:90?

send_raw_now $server, $cmd

Sends the command $cmd to $server, bypassing the send queue in order to send it immediately.

send_raw_first $server, $cmd

Sends $cmd to $server as fast as possible whilst maintaining flood protection. It does this by inserting it at the head of the send queue, so it will be dispatched first.

send_raw_split $server, $cmd, $nick_arg, $max_nicks

Sends $cmd to $server. $nick_arg is an integer, as is $max_nicks. It appears to be used for breaking long commands, or commands that may only act on a certain number of nicks into smaller chunks, and sending them individually.

TODO: clarify what the last 2 arguments actually do.

Clone this wiki locally