summaryrefslogtreecommitdiffstats
path: root/quotepass.tcl
blob: 0e35d9c43f6026ae426bbb1ad7e534dc382bd3e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# quotepass.tcl
#   written by simple, [sL], and guppy
#
# Some servers on the Undernet will make you send 'PASS <numbers>' before you
# can connect if you did not return an identd response. This script will
# handle sending that for you.
#
# updates
# -------
#  10Feb08: initial version
#
# $Id: quotepass.tcl,v 1.3 2008/02/11 02:28:41 guppy Exp $

set quotepass_resyntax "must type /QUOTE PASS (\[^\" \]*)"

bind evnt - init-server quotepass_unbind
bind evnt - disconnect-server quotepass_unbind
bind evnt - connect-server quotepass_bind

proc quotepass_notice {from cmd text} {
  global quotepass_resyntax
  if {[regexp -nocase $quotepass_resyntax $text - pass]} {
    putlog "Got a QUOTE PASS request from the server, sending \"PASS $pass\"" 
    putserv "PASS $pass"
  }
  return 0
}

proc quotepass_unbind {type} {
  # Try to unbind our raw NOTICE bind once we are connected since it will
  # never be needed again 
  catch {
    unbind raw - NOTICE quotepass_notice
  }
}

proc quotepass_bind {type} {
  bind raw - NOTICE quotepass_notice
}