#  .ebrc: the configuration file for edbrowse version 3.7.3
#  This is a sample file.
#  This file contains passwords - make sure it is not readable by others.
#  chmod 600 .ebrc
#  (Of course this public file has no real passwords, but yours will.)

#  First the email accounts; I have several.
#  My primary account, from my ISP.
#  Access this account via -m1.
#  The next account is -m2, and so on.
mail {
# Do not fetch from this account when -f is used to fetch from all accounts.
nofetch
#  The pop3 server and the smtp server, they need not be the same.
inserver = mail.comcast.net
outserver = smtp.comcast.net
#  login and password
login = kdahlke189603
password = elephant
#  Who is this mail from?  Your name, and a reply address.
#  Note, it is now illegal to forge email, so make sure your name
#  is really yours, or your business, and make sure the reply address
#  is one of your email accounts, or is forwarded to you.
from = Karl Dahlke
reply = kdahlke189603@comcast.net
}

#  My personal email account.
#  This is a subaccount under my primary ISP account.
mail {
inserver = mail.comcast.net
outserver = smtp.comcast.net
#  When I send mail out, this is the default account.
default
login = eklhad
password = zebra
from = Karl Dahlke
reply = eklhad@comcast.net
}

#  My wife's account.
#  I check on it once in a while, with her permission of course.
mail {
#  I totally shouldn't be fetching from this account by default.
nofetch
inserver = mail.comcast.net
outserver = smtp.comcast.net
login = kdwife
password = kangaroo
from = Wendy Dahlke
reply = kdwife@comcast.net
}

#  My work account.
mail {
#  The shortcut eyemail is defined in /etc/hosts.
#  You can do it this way, or use a full domain name,
#  as I did with comcast.
inserver = eyemail
outserver = eyemail
login = karl.dahlke@my-work-domain.com
password = cheetah
from = Karl Dahlke
reply = karl.dahlke@my-work-domain.com
}

#  a gmail account, most people have one of these now adays.
mail {
inserver = pop.gmail.com
outserver = smtp.gmail.com
secure
login = eklhad
password = rhinoceros
from = Karl Dahlke
reply = eklhad@gmail.com
}

#  That's all the mail accounts.
#  Here is my address book.
#  Format    is alias:email:other fields that we don't care about
adbook=/home/mylogin/outside/adbook

#  Move to this directory when fetching mail. Should be an absolute path.
maildir = /home/mylogin/mbox

#  Place downloaded files here. Should be an absolute path.
downdir = /home/mylogin/downloads

#  The cookie jar - where we store the http cookies.
#  This file contains passwords, make sure it is 0600.
#  Do not hand edit the cookie file, unless you know what you are doing!
jar = /home/mylogin/outside/cookies

#  wait 30 seconds for a response from a web server
webtimer = 30
#  wait 3 minutes for a response from a mail server
mailtimer = 180

#  Redirect mail based on the sender, or the destination account.
fromfilter {
fred flintstone > fredmail
fred.flintstone@bedrock.us > fredmail
jerk@hotmail.com > x
word@m-w.com > -wod
}

tofilter {
support@my-side-business.com > support
sales@my-side-business.com > sales
@my-side-business.com > business
me@my-regular-dayjob.com > work
}

#  Describe the file types and the plugins to run them.
plugin {
type = audio/basic
desc = audio file in a wave format
suffix = wav,voc,au
content = audio/x-wav
#  %i is the input file or input stream from the internet
program = play -q %i
}

#  you can use mplayer or mpv for the program; arguments are the same.
plugin {
type = audio/x-pn-realaudio
desc = streaming audio
protocol = rtsp,pnm,sdp,pls
suffix = rm,ra,ram,ogg,mp3,mp4,m3u,m3u8
urlmatch = .youtube.com/watch?
content = audio/x-scpls,audio/mpeg,application/pls+xml
program = /usr/bin/mpv --really-quiet %i
}

#  Some plugins play the file, others convert it for readability.
#  The outtype parameter indicates the latter.
#  Set outtype = h for html or t for text.
#  This plugin is called by the browse command to render pdf.
plugin {
type = pdf
desc = pdf file
suffix = pdf
content = application/pdf
#  program cannot access a stream, files must be downloaded from the internet
down_url
#  %o is the temp output file generated by the program
program = pdftohtml -i -noframes %i %o >/dev/null
outtype = H
}

plugin {
type = Word doc
desc = Microsoft Word document, not docx
suffix = doc
content = application/msword
down_url
#  without %o, the output is piped directly into the buffer.
program = catdoc %i
outtype = T
}

#  See the edbrowse wiki for plugins and scripts to access
#  the files and directories within a zip archive.

#  Proxy servers, scan through these entries in order.
#  Three fields: protocol domain server
#  mycompany.com allows direct access to their hr machine;
#  all other requests go through their proxy.
proxy = http|https hr.mycompany.com direct
proxy = http|https|ftp * proxy.mycompany.com

#  Database access - specify the datasource, login, and password.
datasource = retail,mylogin,mypassword

#  Sections of the customers table in the retail database.
#  See the edbrowse documentation for more details.
table {
    tname = customers
#  cnm is my cryptic shorthand for customer name
#  I want to be cryptic here, cause I'm going to be typing this a lot.
    tshort = cnm
    cols = custnum,firstname,lastname
#  Specify the primary key, in this case, the first column selected.
    keycol = 1
}

table {
    tname = customers
#  All I care about here is customer and birthdate.
    tshort = cbd
    cols = birthdate,custnum
    keycol = 2
}


#  Plenty of sites use javascript solely for visual effect.
#  And this javascript tends to be complicated, which means I usually
#  don't parse it properly, and you get lots of annoying errors.
#  You can disable it per site.
#  Note, better to say space.com, instead of www.space.com,
#  unless there is a foo.space.com where you really need the javascript.
nojs = space.com
nojs = nasa.gov
nojs = paypal.com

#  Every time you fetch a web page from the internet,
#  your browser identifies itself to the host.
#  This is done automatically.
#  Edbrowse identifies itself as "edbrowse/3.4.8",
#  where the number after the slash indicates the current version of edbrowse.
#  All well and good, but some websites have no respect for edbrowse.
#  You can specify different agents in this config file,
#  and activate them with the `ua' (user agent) command.
#  With the following lines in your config file,
#  you can type ua1 to pretend to bee lynx, and ua2 to pretend to be IE7.
#  Type ua0 to resurrect the standard edbrowse identification.

agent = Lynx/2.8.4rel.1 libwww-FM/2.14
agent = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)

#  Ok, we're ready to write our first script.
#  Let's start out with something simple, undos a file.
function+undos {
,s/\r$//
}

#  How about a function to access google.
#  That's something everybody does all the time.
#  This is not guaranteed to be up-to-date;
#  Google changes its web interface from time to time.
#  In fact any web-accessing script requires maintenance,
#  as the website in question evolves.
#  ~0 stands for all the arguments, in other words, the rest of the line.
#  So   <gg elephants tigers   will call up google,
#  looking for elephants and tigers together.
function+gg {
b http://www.google.com
/<>/ i=~0
/</ i1*
/^About/+2
#  If you want to step through the google results by h3 heading, you need ua2,
#  that is, spoof to IE7. This became necessary on 05/25/2019.
#  It's a good idea to spoof something; nobody knows who edbrowse is.
}

#  mariam-webster dictionary lookup, ~1 is parameter 1, the word to look up.
#  <mw elephant
function+mw {
b http://www.merriam-webster.com/dictionary/~1
}

