[3374] | 1 | # irkstate.tcl: |
---|
| 2 | # |
---|
| 3 | # This file defines the contents of the ::irk::state array |
---|
| 4 | |
---|
| 5 | namespace eval ::irk { |
---|
| 6 | |
---|
| 7 | # The state array contains all the state for the IRK package: |
---|
| 8 | # |
---|
| 9 | # These options can be configured with irk::config: |
---|
| 10 | # |
---|
| 11 | # state(-useragent) Name of this IRK user agent. |
---|
| 12 | # state(-version) Version of this IRK user agent. |
---|
| 13 | # |
---|
| 14 | # state(-sockproxy) Name of SOCKS5 proxy to use (optional). |
---|
| 15 | # state(-socksport) Port on which SOCKS5 server accepts |
---|
| 16 | # connections (optional). |
---|
| 17 | # |
---|
| 18 | # state(-$symsrv,nick) If set and connect is called without giving |
---|
| 19 | # a nick, use this as the nickname. |
---|
| 20 | # state(-$symsrv,user) If set and connect is called without giving |
---|
| 21 | # a user, this is used. Otherwise, if it's not |
---|
| 22 | # set when connect is called without a user, |
---|
| 23 | # it is set to the given nickname (and used). |
---|
| 24 | # state(-$symsrv,pass) If set, and connect is called without giving |
---|
| 25 | # a password, this is used. |
---|
| 26 | # |
---|
| 27 | # state(-quitmessage) If set, the message is sent when a connection |
---|
| 28 | # is closed, as part of a QUIT command. |
---|
| 29 | # |
---|
| 30 | # These options cannot be configured with irk::config: |
---|
| 31 | # |
---|
| 32 | # state(connections) A list of all active connections. |
---|
| 33 | # state(dispatcher) The default command dispatcher (must be set). |
---|
| 34 | # state(action) The default action (must be set). |
---|
| 35 | # state(servers) List of known servers (further described in |
---|
| 36 | # the symsrv array below). |
---|
| 37 | # |
---|
| 38 | # The following state is kept per connection (identified by $contok): |
---|
| 39 | # |
---|
| 40 | # state($contok,socket) The socket for a given connection |
---|
| 41 | # state($contok,port) The port of a given connection |
---|
| 42 | # state($contok,host) The host of a given connection |
---|
| 43 | # state($contok,symsrv) The symbolic name of the server for |
---|
| 44 | # this connection. |
---|
| 45 | # state($contok,nick) The nick name used on a given connection |
---|
| 46 | # state($contok,user) The real user used on a given connection |
---|
| 47 | # state($contok,pass) The password used on a given connection |
---|
| 48 | # state($contok,disp) The command dispatcher for the connection |
---|
| 49 | # |
---|
| 50 | # Depending on the dispatcher associated with each connection, there |
---|
| 51 | # may be many more settings of the general form: |
---|
| 52 | # |
---|
| 53 | # state($contok,action,...) |
---|
| 54 | # |
---|
| 55 | # System wide responses to common commands are handled by |
---|
| 56 | # special actions, stored in the state array: |
---|
| 57 | # |
---|
| 58 | # state(PRIVMSG,unsolicited) |
---|
| 59 | # Action that responds to unsolicited private |
---|
| 60 | # messages directed at this user's nickname. |
---|
| 61 | # state(special,PING) Responds to PING messages. |
---|
| 62 | # state(special,NOTICE) Responds to NOTICE messages. |
---|
| 63 | # state(special,ERROR) Responds to ERROR messages. |
---|
| 64 | # |
---|
| 65 | # The IRK library provides a unified authorization mechanism, implemented |
---|
| 66 | # in irkauth.tcl. The state array contains two settings that affect the |
---|
| 67 | # behavior of the authorization mechanism: |
---|
| 68 | # |
---|
| 69 | # state(auth,save,file) Name of a file to save the authorization |
---|
| 70 | # information in. Defaults to auth.dat in the |
---|
| 71 | # directory containing the IRK package. |
---|
| 72 | # state(auth,save,interval) The number of milliseconds that pass between |
---|
| 73 | # autosaves of the authorization data. |
---|
| 74 | |
---|
| 75 | variable state |
---|
| 76 | array set state { |
---|
| 77 | -useragent "Tcl IRK Library" |
---|
| 78 | -version 0.1 |
---|
| 79 | -quitmessage "gives up the ghost" |
---|
| 80 | |
---|
| 81 | dispatcher ::irk::defaultDispatcher |
---|
| 82 | action ::irk::defaultAction |
---|
| 83 | |
---|
| 84 | cmd,QUIT ::irk::RECV,QUIT |
---|
| 85 | cmd,JOIN ::irk::RECV,JOIN |
---|
| 86 | cmd,PART ::irk::RECV,PART |
---|
| 87 | cmd,MODE ::irk::RECV,MODE |
---|
| 88 | cmd,NICK ::irk::RECV,NICK |
---|
| 89 | cmd,PONG ::irk::RECV,PONG |
---|
| 90 | cmd,PRIVMSG ::irk::RECV,PRIVMSG |
---|
| 91 | cmd,NOTICE ::irk::RECV,NOTICE,USER |
---|
| 92 | cmd,KICK ::irk::RECV,KICK |
---|
| 93 | cmd,001 ::irk::RECV,MOTD |
---|
| 94 | cmd,002 ::irk::RECV,MOTD |
---|
| 95 | cmd,003 ::irk::RECV,MOTD |
---|
| 96 | cmd,004 ::irk::RECV,MOTD |
---|
| 97 | cmd,005 ::irk::RECV,MOTD |
---|
| 98 | cmd,250 ::irk::RECV,MOTD |
---|
| 99 | cmd,251 ::irk::RECV,MOTD |
---|
| 100 | cmd,252 ::irk::RECV,MOTD |
---|
| 101 | cmd,253 ::irk::RECV,MOTD |
---|
| 102 | cmd,254 ::irk::RECV,MOTD |
---|
| 103 | cmd,255 ::irk::RECV,MOTD |
---|
| 104 | cmd,265 ::irk::RECV,MOTD |
---|
| 105 | cmd,266 ::irk::RECV,MOTD |
---|
| 106 | cmd,301 ::irk::RECV,AWAY |
---|
| 107 | cmd,307 ::irk::RECV,WHOIS,NICK,IDENT |
---|
| 108 | cmd,311 ::irk::RECV,WHOIS,NICK,USER |
---|
| 109 | cmd,312 ::irk::RECV,WHOIS,NICK,SERVER |
---|
| 110 | cmd,317 ::irk::RECV,WHOIS,NICK,CONNECTTIME |
---|
| 111 | cmd,318 ::irk::RECV,WHOIS,NICK,END |
---|
| 112 | cmd,319 ::irk::RECV,WHOIS,NICK,CHANNELS |
---|
| 113 | cmd,372 ::irk::RECV,MOTD |
---|
| 114 | cmd,375 ::irk::RECV,MOTD |
---|
| 115 | cmd,376 ::irk::RECV,MOTD |
---|
| 116 | cmd,332 ::irk::RECV,CHANNEL,TOPIC |
---|
| 117 | cmd,333 ::irk::RECV,CHANNEL,SETBY |
---|
| 118 | cmd,353 ::irk::RECV,CHANNEL,NAMELIST |
---|
| 119 | cmd,366 ::irk::RECV,CHANNEL,NAMELIST,END |
---|
| 120 | |
---|
| 121 | cmd,513 ::irk::RECV,PONG,REQUEST |
---|
| 122 | |
---|
| 123 | special,PING ::irk::RECV,PING |
---|
| 124 | special,NOTICE ::irk::RECV,NOTICE |
---|
| 125 | special,ERROR ::irk::RECV,ERROR |
---|
| 126 | |
---|
| 127 | PRIVMSG,unsolicited ::irk::RECV,PRIVMSG,unsolicited |
---|
| 128 | |
---|
| 129 | errorhandler ::irk::echoerror |
---|
| 130 | |
---|
| 131 | auth,save,file [file join [file dir [info script]] auth.dat] |
---|
| 132 | auth,save,interval 300000 |
---|
| 133 | } |
---|
| 134 | } |
---|