# Get help for the epic client from the wiki. # 2009 Jul 17 skullY@EFnet package help ### Variables @help.server = "help.epicsol.org" #@help.server = "darkstar.frop.org" @help.baseuri = "/doku.php?do=export_irc&id=" @help.headers.1 = "Host: $help.server" @help.headers.2 = "Accept: text/plain" @help.headers.3 = "User-Agent: ircII $J [$V] [$info(i)] [$info(r)]" @help.headers.4 = "Connection: Close" @help.prompt="'q' to quit, 'n' to stop prompting, or any other key to continue" ### End user aliases alias help (page default "new_user") {help.get $page} ### Useful aliases # help.sendline: Send a line terminated with CRLF to the specified connection. alias help.sendline (refnum, line default "") { msg =$refnum ${line}$chr(13) #xecho -b help: help.sendline: $refnum $line } # help.get: Fetch a help page alias help.get (page default "new_user") { xecho -b Fetching help page ${page}, one moment please... @help.conn = connect($help.server 80) if (help.conn == "") { xecho -b Help: Could not connect to $help.server return } @help.state[$help.conn][headers] = 1; @help.state[$help.conn][line] = 0; @help.state[$help.conn][paginateoutput] = 1; @help.state[$help.conn][stopoutput] = 0; @help.state[$help.conn][page] = "${help.baseuri}$page"; ^on ^dcc_raw "$help.conn $help.server E 80" { help.sendline $0 GET $help.state[$0][page] HTTP/1.1 foreach help.headers xx { help.sendline $0 $help.headers[$xx] } # FIXME: should be able to do this through help.sendline msg =$0 $chr(13) } ^on ^dcc_raw "$help.conn $help.server D *" { @:line = "$3-" if (help.state[$0][headers]) { if (line == "") { @help.state[$0][headers] = 0 } return } if (line == "The end!") { return } /* # Store the line in the array @setitem(help_$0 $help.state[$help.conn][line] $line) @help.state[$help.conn][line]++ */ xecho -v -- $line } ^on ^dcc_raw "$help.conn $help.server C" { @numlines = help.state[$0][line] - 4 # Show the help page help.display $0 0 $numlines # FIXME 2014-03-10: Is this needed? The last time I touched this was 5 years ago and I left it commented out. Was it to get back to it later or because I was checking to see if I really needed it? # Cleanup #^on dcc_raw -"$0 $1 E 80" #^on dcc_raw -"$0 $1 D *" #^on dcc_raw -"$0 $1 C" #foreach help.state[$0] xx { # ^assign -help.state[$0][$xx] #} #@delarray(help_$0) } } alias help.display (page, start, total) { @height = windowctl(get 0 display_size) if (start < total) { /* I think this whole section is moot for now. xecho -b help.display: page: $page xecho -b help.display: start: $start xecho -b help.display: total: $total @end = (start + height) if (end > total) { @end = total } for i from $start to $end { */ for i from $start to $total { xecho -v -- $getitem(help_$page $i) } /* input_char -noecho "$help.prompt" { @next=$end+1 help.display $page $next $total } */ } }