diff options
31 files changed, 0 insertions, 2985 deletions
diff --git a/lib/rbot/plugins/autoop.rb b/lib/rbot/plugins/autoop.rb deleted file mode 100644 index fdbcf6e0..00000000 --- a/lib/rbot/plugins/autoop.rb +++ /dev/null @@ -1,68 +0,0 @@ -class AutoOP < Plugin - @@handlers = { - "addop" => "handle_addop", - "rmop" => "handle_rmop", - "listop" => "handle_listop" - } - - def help(plugin, topic="") - "perform autoop based on hostmask - usage: addop <hostmask>, rmop <hostmask>, listop" - end - - def join(m) - if(!m.address?) - @registry.each { |mask,channels| - if(Irc.netmaskmatch(mask, m.source) && channels.include?(m.channel)) - @bot.mode(m.channel, "+o", m.sourcenick) - end - } - end - end - - def privmsg(m) - if(m.private?) - if (!m.params || m.params == "list") - handle_listop(m) - elsif (m.params =~ /^add\s+(.+)$/) - handle_addop(m, $1) - elsif (m.params =~ /^rm\s+(.+)$/) - handle_rmop(m, $1) - end - end - end - - def handle_addop(m, params) - ma = /^(.+?)(\s+(.+))?$/.match(params) - channels = ma[2] ? ma[2] : @bot.config['JOIN_CHANNELS'] - if(ma[1] && channels) - @registry[ma[1]] = channels.split(/,\s*/).collect { |x| - x.strip - } - m.okay - else - m.reply @bot.lang.get('dunno') - end - end - - def handle_rmop(m, params) - if(!@registry.delete(params)) - m.reply @bot.lang.get('dunno') - else - m.okay - end - end - - def handle_listop(m) - if(@registry.length) - @registry.each { |mask,channels| - m.reply "#{mask} in #{channels.join(', ')}" - } - else - m.reply "No entrys" - end - end -end - -plugin = AutoOP.new -plugin.register("autoop") - diff --git a/lib/rbot/plugins/autorejoin.rb b/lib/rbot/plugins/autorejoin.rb deleted file mode 100644 index aba46507..00000000 --- a/lib/rbot/plugins/autorejoin.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AutoRejoinPlugin < Plugin - def help(plugin, topic="") - "performs an automatic rejoin if the bot is kicked from a channel" - end - def kick(m) - if m.address? - @bot.timer.add_once(10, m) {|m| - @bot.join m.channel - @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick - } - end - end -end - -plugin = AutoRejoinPlugin.new -plugin.register("autorejoin") diff --git a/lib/rbot/plugins/cal.rb b/lib/rbot/plugins/cal.rb deleted file mode 100644 index 4f28310b..00000000 --- a/lib/rbot/plugins/cal.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CalPlugin < Plugin - def help(plugin, topic="") - "cal [options] => show current calendar [unix cal options]" - end - def cal(m, params) - if params.has_key?(:month) - m.reply Utils.safe_exec("cal", params[:month], params[:year]) - else - m.reply Utils.safe_exec("cal") - end - end -end -plugin = CalPlugin.new -plugin.map 'cal :month :year', :requirements => {:month => /^\d+$/, :year => /^\d+$/} -plugin.map 'cal' diff --git a/lib/rbot/plugins/dice.rb b/lib/rbot/plugins/dice.rb deleted file mode 100644 index a09d2b1a..00000000 --- a/lib/rbot/plugins/dice.rb +++ /dev/null @@ -1,81 +0,0 @@ -################## -# Filename: dice.rb -# Description: Rbot plugin. Rolls rpg style dice -# Author: David Dorward (http://david.us-lot.org/ - you might find a more up to date version of this plugin there) -# Version: 0.3.2 -# Date: Sat 6 Apr 2002 -# -# You can get rbot from: http://ruby-rbot.org -# -# Changelog -# 0.1 - Initial release -# 0.1.1 - bug fix, only 1 digit for number of dice sides on first roll -# 0.3.0 - Spelling correction on changelog 0.1.1 -# - Return results of each roll -# 0.3.1 - Minor documentation update -# 0.3.2 - Bug fix, could not subtract numbers (String can't be coerced into Fixnum) -# -# TODO: Test! Test! Test! -# Comment! -# Fumble/Critical counter (1's and x's where x is sides on dice) -#################################################### - -class DiceDisplay - attr_reader :total, :view - def initialize(view, total) - @total = total - @view = view - end -end - -class DicePlugin < Plugin - def help(plugin, topic="") - "dice <string> (where <string> is something like: d6 or 2d6 or 2d6+4 or 2d6+1d20 or 2d6+1d5+4d7-3d4-6) => Rolls that set of virtual dice" - end - - def rolldice(d) - dice = d.split(/d/) - r = 0 - unless dice[0] =~ /^[0-9]+/ - dice[0] = 1 - end - for i in 0...dice[0].to_i - r = r + rand(dice[1].to_i) + 1 - end - return r - end - - def iddice(d) - porm = d.slice!(0,1) - if d =~ /d/ - r = rolldice(d) - else - r = d - end - if porm == "-" - r = 0 - r.to_i - end - viewer = DiceDisplay.new("[" + porm.to_s + d.to_s + "=" + r.to_s + "] ", r) - return viewer - end - - def privmsg(m) - unless(m.params && m.params =~ /^[0-9]*d[0-9]+([+-]([0-9]+|[0-9]*d[0-9])+)*$/) - m.reply "incorrect usage: " + help(m.plugin) - return - end - a = m.params.scan(/^[0-9]*d[0-9]+|[+-][0-9]*d[0-9]+|[+-][0-9]+/) - r = rolldice(a[0]) - t = "[" + a[0].to_s + "=" + r.to_s + "] " - for i in 1...a.length - tmp = iddice(a[i]) - r = r + tmp.total.to_i - t = t + tmp.view.to_s - end - m.reply r.to_s + " | " + t - end -end -plugin = DicePlugin.new -plugin.register("dice") -############################################## -#fin diff --git a/lib/rbot/plugins/eightball.rb b/lib/rbot/plugins/eightball.rb deleted file mode 100644 index 64748490..00000000 --- a/lib/rbot/plugins/eightball.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Author: novex, daniel@novex.net.nz based on code from slap.rb by oct - -class EightBallPlugin < Plugin - def initialize - super - @answers=['yes', 'no', 'outlook not so good', 'all signs point to yes', 'all signs point to no', 'why the hell are you asking me?', 'the answer is unclear'] - end - def help(plugin, topic="") - "magic 8-ball ruby bot module written by novex for nvinfo on #dumber@quakenet, usage:<botname> 8ball will i ever beat this cancer?" - end - def eightball(m, params) - answers = @answers[rand(@answers.length)] - action = "shakes the magic 8-ball... #{answers}" - @bot.action m.replyto, action - end -end -plugin = EightBallPlugin.new -plugin.map '8ball', :action => 'usage' -plugin.map '8ball *params', :action => 'eightball' diff --git a/lib/rbot/plugins/excuse.rb b/lib/rbot/plugins/excuse.rb deleted file mode 100644 index 38e85ad6..00000000 --- a/lib/rbot/plugins/excuse.rb +++ /dev/null @@ -1,470 +0,0 @@ -class ExcusePlugin < Plugin - # excuses courtesy of http://www.cs.wisc.edu/~ballard/bofh/ -@@excuses = [ -"clock speed", -"solar flares", -"electromagnetic radiation from satellite debris", -"static from nylon underwear", -"static from plastic slide rules", -"global warming", -"poor power conditioning", -"static buildup", -"doppler effect", -"hardware stress fractures", -"magnetic interference from money/credit cards", -"dry joints on cable plug", -"we're waiting for [the phone company] to fix that line", -"sounds like a Windows problem, try calling Microsoft support", -"temporary routing anomaly", -"somebody was calculating pi on the server", -"fat electrons in the lines", -"excess surge protection", -"floating point processor overflow", -"divide-by-zero error", -"POSIX compliance problem", -"monitor resolution too high", -"improperly oriented keyboard", -"network packets travelling uphill (use a carrier pigeon)", -"Decreasing electron flux", -"first Saturday after first full moon in Winter", -"radiosity depletion", -"CPU radiator broken", -"It works the way the Wang did, what's the problem", -"positron router malfunction", -"cellular telephone interference", -"techtonic stress", -"piezo-electric interference", -"(l)user error", -"working as designed", -"dynamic software linking table corrupted", -"heavy gravity fluctuation, move computer to floor rapidly", -"secretary plugged hairdryer into UPS", -"terrorist activities", -"not enough memory, go get system upgrade", -"interrupt configuration error", -"spaghetti cable cause packet failure", -"boss forgot system password", -"bank holiday - system operating credits not recharged", -"virus attack, luser responsible", -"waste water tank overflowed onto computer", -"Complete Transient Lockout", -"bad ether in the cables", -"Bogon emissions", -"Change in Earth's rotational speed", -"Cosmic ray particles crashed through the hard disk platter", -"Smell from unhygienic janitorial staff wrecked the tape heads", -"Little hamster in running wheel had coronary; waiting for replacement to be Fedexed from Wyoming", -"Evil dogs hypnotised the night shift", -"Plumber mistook routing panel for decorative wall fixture", -"Electricians made popcorn in the power supply", -"Groundskeepers stole the root password", -"high pressure system failure", -"failed trials, system needs redesigned", -"system has been recalled", -"not approved by the FCC", -"need to wrap system in aluminum foil to fix problem", -"not properly grounded, please bury computer", -"CPU needs recalibration", -"system needs to be rebooted", -"bit bucket overflow", -"descramble code needed from software company", -"only available on a need to know basis", -"knot in cables caused data stream to become twisted and kinked", -"nesting roaches shorted out the ether cable", -"The file system is full of it", -"Satan did it", -"Daemons did it", -"You're out of memory", -"There isn't any problem", -"Unoptimized hard drive", -"Typo in the code", -"Yes, yes, its called a design limitation", -"Look, buddy: Windows 3.1 IS A General Protection Fault.", -"That's a great computer you have there; have you considered how it would work as a BSD machine?", -"Please excuse me, I have to circuit an AC line through my head to get this database working.", -"Yeah, yo mama dresses you funny and you need a mouse to delete files.", -"Support staff hung over, send aspirin and come back LATER.", -"Someone is standing on the ethernet cable, causing a kink in the cable", -"Windows 95 undocumented 'feature'", -"Runt packets", -"Password is too complex to decrypt", -"Boss' kid fucked up the machine", -"Electromagnetic energy loss", -"Budget cuts", -"Mouse chewed through power cable", -"Stale file handle (next time use Tupperware(tm)!)", -"Feature not yet implemented", -"Internet outage", -"Pentium FDIV bug", -"Vendor no longer supports the product", -"Small animal kamikaze attack on power supplies", -"The vendor put the bug there.", -"SIMM crosstalk.", -"IRQ dropout", -"Collapsed Backbone", -"Power company testing new voltage spike (creation) equipment", -"operators on strike due to broken coffee machine", -"backup tape overwritten with copy of system manager's favourite CD", -"UPS interrupted the server's power", -"The electrician didn't know what the yellow cable was so he yanked the ethernet out.", -"The keyboard isn't plugged in", -"The air conditioning water supply pipe ruptured over the machine room", -"The electricity substation in the car park blew up.", -"The rolling stones concert down the road caused a brown out", -"The salesman drove over the CPU board.", -"The monitor is plugged into the serial port", -"Root nameservers are out of sync", -"electro-magnetic pulses from French above ground nuke testing.", -"your keyboard's space bar is generating spurious keycodes.", -"the real ttys became pseudo ttys and vice-versa.", -"the printer thinks its a router.", -"the router thinks its a printer.", -"evil hackers from Serbia.", -"we just switched to FDDI.", -"halon system went off and killed the operators.", -"because Bill Gates is a Jehovah's witness and so nothing can work on St. Swithin's day.", -"user to computer ratio too high.", -"user to computer ration too low.", -"we just switched to Sprint.", -"it has Intel Inside", -"Sticky bits on disk.", -"Power Company having EMP problems with their reactor", -"The ring needs another token", -"new management", -"telnet: Unable to connect to remote host: Connection refused", -"SCSI Chain overterminated", -"It's not plugged in.", -"because of network lag due to too many people playing deathmatch", -"You put the disk in upside down.", -"Daemons loose in system.", -"User was distributing pornography on server; system seized by FBI.", -"BNC (brain not connected)", -"UBNC (user brain not connected)", -"LBNC (luser brain not connected)", -"disks spinning backwards - toggle the hemisphere jumper.", -"new guy cross-connected phone lines with ac power bus.", -"had to use hammer to free stuck disk drive heads.", -"Too few computrons available.", -"Communications satellite used by the military for star wars.", -"Party-bug in the Aloha protocol.", -"Insert coin for new game", -"Dew on the telephone lines.", -"Arcserve crashed the server again.", -"Some one needed the powerstrip, so they pulled the switch plug.", -"My pony-tail hit the on/off switch on the power strip.", -"Big to little endian conversion error", -"You can tune a file system, but you can't tune a fish (from most tunefs man pages)", -"Dumb terminal", -"Zombie processes haunting the computer", -"Incorrect time synchronization", -"Defunct processes", -"Stubborn processes", -"non-redundant fan failure ", -"monitor VLF leakage", -"bugs in the RAID", -"no 'any' key on keyboard", -"root rot", -"Backbone Scoliosis", -"/pub/lunch", -"excessive collisions & not enough packet ambulances", -"le0: no carrier: transceiver cable problem?", -"broadcast packets on wrong frequency", -"popper unable to process jumbo kernel", -"NOTICE: alloc: /dev/null: filesystem full", -"pseudo-user on a pseudo-terminal", -"Recursive traversal of loopback mount points", -"Backbone adjustment", -"OS swapped to disk", -"vapors from evaporating sticky-note adhesives", -"sticktion", -"short leg on process table", -"multicasts on broken packets", -"ether leak", -"Atilla the Hub", -"endothermal recalibration", -"filesystem not big enough for Jumbo Kernel Patch", -"loop found in loop in redundant loopback", -"system consumed all the paper for paging", -"permission denied", -"Reformatting Page. Wait...", -"..disk or the processor is on fire.", -"SCSI's too wide.", -"Proprietary Information.", -"Just type 'mv * /dev/null'.", -"runaway cat on system.", -"Did you pay the new Support Fee?", -"We only support a 1200 bps connection.", -"We only support a 28000 bps connection.", -"Me no internet, only janitor, me just wax floors.", -"I'm sorry a pentium won't do, you need an SGI to connect with us.", -"Post-it Note Sludge leaked into the monitor.", -"the curls in your keyboard cord are losing electricity.", -"The monitor needs another box of pixels.", -"RPC_PMAP_FAILURE", -"kernel panic: write-only-memory (/dev/wom0) capacity exceeded.", -"Write-only-memory subsystem too slow for this machine. Contact your local dealer.", -"Just pick up the phone and give modem connect sounds. 'Well you said we should get more lines so we don't have voice lines.'", -"Quantum dynamics are affecting the transistors", -"Police are examining all internet packets in the search for a narco-net-trafficker", -"We are currently trying a new concept of using a live mouse. Unfortunately, one has yet to survive being hooked up to the computer.....please bear with us.", -"Your mail is being routed through Germany ... and they're censoring us.", -"Only people with names beginning with 'A' are getting mail this week (a la Microsoft)", -"We didn't pay the Internet bill and it's been cut off.", -"Lightning strikes.", -"Of course it doesn't work. We've performed a software upgrade.", -"Change your language to Finnish.", -"Fluorescent lights are generating negative ions. If turning them off doesn't work, take them out and put tin foil on the ends.", -"High nuclear activity in your area.", -"What office are you in? Oh, that one. Did you know that your building was built over the universities first nuclear research site? And wow, aren't you the lucky one, your office is right over where the core is buried!", -"The MGs ran out of gas.", -"The UPS doesn't have a battery backup.", -"Recursivity. Call back if it happens again.", -"Someone thought The Big Red Button was a light switch.", -"The mainframe needs to rest. It's getting old, you know.", -"I'm not sure. Try calling the Internet's head office -- it's in the book.", -"The lines are all busy (busied out, that is -- why let them in to begin with?).", -"Jan 9 16:41:27 huber su: 'su root' succeeded for .... on /dev/pts/1", -"It's those computer people in X {city of world}. They keep stuffing things up.", -"A star wars satellite accidently blew up the WAN.", -"Fatal error right in front of screen", -"That function is not currently supported, but Bill Gates assures us it will be featured in the next upgrade.", -"wrong polarity of neutron flow", -"Lusers learning curve appears to be fractal", -"We had to turn off that service to comply with the CDA Bill.", -"Ionization from the air-conditioning", -"TCP/IP UDP alarm threshold is set too low.", -"Someone is broadcasting pygmy packets and the router doesn't know how to deal with them.", -"The new frame relay network hasn't bedded down the software loop transmitter yet. ", -"Fanout dropping voltage too much, try cutting some of those little traces", -"Plate voltage too low on demodulator tube", -"You did wha... oh _dear_....", -"CPU needs bearings repacked", -"Too many little pins on CPU confusing it, bend back and forth until 10-20% are neatly removed. Do _not_ leave metal bits visible!", -"_Rosin_ core solder? But...", -"Software uses US measurements, but the OS is in metric...", -"The computer fleetly, mouse and all.", -"Your cat tried to eat the mouse.", -"The Borg tried to assimilate your system. Resistance is futile.", -"It must have been the lightning storm we had (yesterday) (last week) (last month)", -"Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one time. (namely none allowed....)", -"Too much radiation coming from the soil.", -"Unfortunately we have run out of bits/bytes/whatever. Don't worry, the next supply will be coming next week.", -"Program load too heavy for processor to lift.", -"Processes running slowly due to weak power supply", -"Our ISP is having {switching,routing,SMDS,frame relay} problems", -"We've run out of licenses", -"Interference from lunar radiation", -"Standing room only on the bus.", -"You need to install an RTFM interface.", -"That would be because the software doesn't work.", -"That's easy to fix, but I can't be bothered.", -"Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too.", -"We're upgrading /dev/null", -"The Usenet news is out of date", -"Our POP server was kidnapped by a weasel.", -"It's stuck in the Web.", -"Your modem doesn't speak English.", -"The mouse escaped.", -"All of the packets are empty.", -"The UPS is on strike.", -"Neutrino overload on the nameserver", -"Melting hard drives", -"Someone has messed up the kernel pointers", -"The kernel license has expired", -"Netscape has crashed", -"The cord jumped over and hit the power switch.", -"It was OK before you touched it.", -"Bit rot", -"U.S. Postal Service", -"Your Flux Capacitor has gone bad.", -"The Dilithium Crystals need to be rotated.", -"The static electricity routing is acting up...", -"Traceroute says that there is a routing problem in the backbone. It's not our problem.", -"The co-locator cannot verify the frame-relay gateway to the ISDN server.", -"High altitude condensation from U.S.A.F prototype aircraft has contaminated the primary subnet mask. Turn off your computer for 9 days to avoid damaging it.", -"Lawn mower blade in your fan need sharpening", -"Electrons on a bender", -"Telecommunications is upgrading. ", -"Telecommunications is downgrading.", -"Telecommunications is downshifting.", -"Hard drive sleeping. Let it wake up on it's own...", -"Interference between the keyboard and the chair.", -"The CPU has shifted, and become decentralized.", -"Due to the CDA, we no longer have a root account.", -"We ran out of dial tone and we're and waiting for the phone company to deliver another bottle.", -"You must've hit the wrong any key.", -"PCMCIA slave driver", -"The Token fell out of the ring. Call us when you find it.", -"The hardware bus needs a new token.", -"Too many interrupts", -"Not enough interrupts", -"The data on your hard drive is out of balance.", -"Digital Manipulator exceeding velocity parameters", -"appears to be a Slow/Narrow SCSI-0 Interface problem", -"microelectronic Riemannian curved-space fault in write-only file system", -"fractal radiation jamming the backbone", -"routing problems on the neural net", -"IRQ-problems with the Un-Interruptible-Power-Supply", -"CPU-angle has to be adjusted because of vibrations coming from the nearby road", -"emissions from GSM-phones", -"CD-ROM server needs recalibration", -"firewall needs cooling", -"asynchronous inode failure", -"transient bus protocol violation", -"incompatible bit-registration operators", -"your process is not ISO 9000 compliant", -"You need to upgrade your VESA local bus to a MasterCard local bus.", -"The recent proliferation of Nuclear Testing", -"Elves on strike. (Why do they call EMAG Elf Magic)", -"Internet exceeded Luser level, please wait until a luser logs off before attempting to log back on.", -"Your EMAIL is now being delivered by the USPS.", -"Your computer hasn't been returning all the bits it gets from the Internet.", -"You've been infected by the Telescoping Hubble virus.", -"Scheduled global CPU outage", -"Your Pentium has a heating problem - try cooling it with ice cold water.(Do not turn off your computer, you do not want to cool down the Pentium Chip while he isn't working, do you?)", -"Your processor has processed too many instructions. Turn it off immediately, do not type any commands!!", -"Your packets were eaten by the terminator", -"Your processor does not develop enough heat.", -"We need a licensed electrician to replace the light bulbs in the computer room.", -"The POP server is out of Coke", -"Fiber optics caused gas main leak", -"Server depressed, needs Prozac", -"quantum decoherence", -"those damn raccoons!", -"suboptimal routing experience", -"A plumber is needed, the network drain is clogged", -"50% of the manual is in .pdf readme files", -"the AA battery in the wallclock sends magnetic interference", -"the xy axis in the trackball is coordinated with the summer solstice", -"the butane lighter causes the pincushioning", -"old inkjet cartridges emanate barium-based fumes", -"manager in the cable duct", -"We'll fix that in the next (upgrade, update, patch release, service pack).", -"HTTPD Error 666 : BOFH was here", -"HTTPD Error 4004 : very old Intel cpu - insufficient processing power", -"The ATM board has run out of 10 pound notes. We are having a whip round to refill it, care to contribute ?", -"Network failure - call NBC", -"Having to manually track the satellite.", -"Your/our computer(s) had suffered a memory leak, and we are waiting for them to be topped up.", -"The rubber band broke", -"We're on Token Ring, and it looks like the token got loose.", -"Stray Alpha Particles from memory packaging caused Hard Memory Error on Server.", -"paradigm shift...without a clutch", -"PEBKAC (Problem Exists Between Keyboard And Chair)", -"The cables are not the same length.", -"Second-system effect.", -"Chewing gum on /dev/sd3c", -"Boredom in the Kernel.", -"the daemons! the daemons! the terrible daemons!", -"I'd love to help you -- it's just that the Boss won't let me near the computer. ", -"struck by the Good Times virus", -"YOU HAVE AN I/O ERROR -> Incompetent Operator error", -"Your parity check is overdrawn and you're out of cache.", -"Communist revolutionaries taking over the server room and demanding all the computers in the building or they shoot the sysadmin. Poor misguided fools.", -"Plasma conduit breach", -"Out of cards on drive D:", -"Sand fleas eating the Internet cables", -"parallel processors running perpendicular today", -"ATM cell has no roaming feature turned on, notebooks can't connect", -"Webmasters kidnapped by evil cult.", -"Failure to adjust for daylight savings time.", -"Virus transmitted from computer to sysadmins.", -"Virus due to computers having unsafe sex.", -"Incorrectly configured static routes on the corerouters.", -"Forced to support NT servers; sysadmins quit.", -"Suspicious pointer corrupted virtual machine", -"It's the InterNIC's fault.", -"Root name servers corrupted.", -"Budget cuts forced us to sell all the power cords for the servers.", -"Someone hooked the twisted pair wires into the answering machine.", -"Operators killed by year 2000 bug bite.", -"We've picked COBOL as the language of choice.", -"Operators killed when huge stack of backup tapes fell over.", -"Robotic tape changer mistook operator's tie for a backup tape.", -"Someone was smoking in the computer room and set off the halon systems.", -"Your processor has taken a ride to Heaven's Gate on the UFO behind Hale-Bopp's comet.", -"it's an ID-10-T error", -"Dyslexics retyping hosts file on servers", -"The Internet is being scanned for viruses.", -"Your computer's union contract is set to expire at midnight.", -"Bad user karma.", -"/dev/clue was linked to /dev/null", -"Increased sunspot activity.", -"We already sent around a notice about that.", -"It's union rules. There's nothing we can do about it. Sorry.", -"Interference from the Van Allen Belt.", -"Jupiter is aligned with Mars.", -"Redundant ACLs. ", -"Mail server hit by UniSpammer.", -"T-1's congested due to porn traffic to the news server.", -"Data for intranet got routed through the extranet and landed on the internet.", -"We are a 100% Microsoft Shop.", -"We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature.", -"Sales staff sold a product we don't offer.", -"Secretary sent chain letter to all 5000 employees.", -"Sysadmin didn't hear pager go off due to loud music from bar-room speakers.", -"Sysadmin accidentally destroyed pager with a large hammer.", -"Sysadmins unavailable because they are in a meeting talking about why they are unavailable so much.", -"Bad cafeteria food landed all the sysadmins in the hospital.", -"Route flapping at the NAP.", -"Computers under water due to SYN flooding.", -"The vulcan-death-grip ping has been applied.", -"Electrical conduits in machine room are melting.", -"Traffic jam on the Information Superhighway.", -"Radial Telemetry Infiltration", -"Cow-tippers tipped a cow onto the server.", -"tachyon emissions overloading the system", -"Maintenance window broken", -"We're out of slots on the server", -"Computer room being moved. Our systems are down for the weekend.", -"Sysadmins busy fighting SPAM.", -"Repeated reboots of the system failed to solve problem", -"Feature was not beta tested", -"Domain controller not responding", -"Someone else stole your IP address, call the Internet detectives!", -"It's not RFC-822 compliant.", -"operation failed because: there is no message for this error (#1014)", -"stop bit received", -"internet is needed to catch the etherbunny", -"network down, IP packets delivered via UPS", -"Firmware update in the coffee machine", -"Temporal anomaly", -"Mouse has out-of-cheese-error", -"Borg implants are failing", -"Borg nanites have infested the server", -"error: one bad user found in front of screen", -"Please state the nature of the technical emergency", -"Internet shut down due to maintenance", -"Daemon escaped from pentagram", -"crop circles in the corn shell", -"sticky bit has come loose", -"Hot Java has gone cold", -"Cache miss - please take better aim next time", -"Hash table has woodworm", -"Trojan horse ran out of hay", -"Zombie processes detected, machine is haunted.", -"overflow error in /dev/null", -"Browser's cookie is corrupted -- someone's been nibbling on it.", -"Mailer-daemon is busy burning your message in hell.", -"According to Microsoft, it's by design", -"vi needs to be upgraded to vii", -"greenpeace free'd the mallocs", -"Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)", -"astropneumatic oscillations in the water-cooling", -"Somebody ran the operating system through a spelling checker.", -"Rhythmic variations in the voltage reaching the power supply.", -"Keyboard Actuator Failure. Order and Replace." -] - - def help(plugin, topic="") - "excuse => supply a random excuse" - end - def privmsg(m) - excuse = @@excuses[rand(@@excuses.length)] - m.reply excuse - end -end - -plugin = ExcusePlugin.new -plugin.register("excuse") - diff --git a/lib/rbot/plugins/fish.rb b/lib/rbot/plugins/fish.rb deleted file mode 100644 index 57aaafc2..00000000 --- a/lib/rbot/plugins/fish.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'net/http' -require 'uri/common' -Net::HTTP.version_1_2 - -class BabelPlugin < Plugin - def help(plugin, topic="") - "translate to <lang> <string> => translate from english to <lang>, translate from <lang> <string> => translate to english from <lang>, translate <fromlang> <tolang> <string> => translate from <fromlang> to <tolang>. Languages: en, fr, de, it, pt, es, nl" - end - def translate(m, params) - langs = ["en", "fr", "de", "it", "pt", "es", "nl"] - trans_from = params[:fromlang] ? params[:fromlang] : 'en' - trans_to = params[:tolang] ? params[:tolang] : 'en' - trans_text = params[:phrase].to_s - - query = "/babelfish/tr" - lang_match = langs.join("|") - unless(trans_from =~ /^(#{lang_match})$/ && trans_to =~ /^(#{lang_match})$/) - m.reply "invalid language: valid languagess are: #{langs.join(' ')}" - return - end - - data_text = URI.escape trans_text - trans_pair = "#{trans_from}_#{trans_to}" - data = "lp=#{trans_pair}&doit=done&intl=1&tt=urltext&urltext=#{data_text}" - - # check cache for previous lookups - if @registry.has_key?("#{trans_pair}/#{data_text}") - m.reply @registry["#{trans_pair}/#{data_text}"] - return - end - - http = @bot.httputil.get_proxy(URI.parse("http://babelfish.altavista.com")) - - http.start {|http| - resp = http.post(query, data, {"content-type", - "application/x-www-form-urlencoded"}) - - if (resp.code == "200") - resp.body.each_line do |l| - if(l =~ /^\s+<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div>/) - answer = $1 - # cache the answer - if(answer.length > 0) - @registry["#{trans_pair}/#{data_text}"] = answer - end - m.reply answer - return - end - end - m.reply "couldn't parse babelfish response html :(" - else - m.reply "couldn't talk to babelfish :(" - end - } - end -end -plugin = BabelPlugin.new -plugin.map 'translate to :tolang *phrase' -plugin.map 'translate from :fromlang *phrase' -plugin.map 'translate :fromlang :tolang *phrase' - diff --git a/lib/rbot/plugins/fortune.rb b/lib/rbot/plugins/fortune.rb deleted file mode 100644 index 184b6b13..00000000 --- a/lib/rbot/plugins/fortune.rb +++ /dev/null @@ -1,22 +0,0 @@ -class FortunePlugin < Plugin - def help(plugin, topic="") - "fortune [<module>] => get a (short) fortune, optionally specifying fortune db" - end - def fortune(m, params) - db = params[:db] - fortune = nil - ["/usr/games/fortune", "/usr/bin/fortune", "/usr/local/bin/fortune"].each {|f| - if FileTest.executable? f - fortune = f - break - end - } - m.reply "fortune binary not found" unless fortune - ret = Utils.safe_exec(fortune, "-n", "255", "-s", db) - m.reply ret.gsub(/\t/, " ").split(/\n/).join(" ") - return - end -end -plugin = FortunePlugin.new -plugin.map 'fortune :db', :defaults => {:db => 'fortunes'}, - :requirements => {:db => /^[^-][\w-]+$/} diff --git a/lib/rbot/plugins/freshmeat.rb b/lib/rbot/plugins/freshmeat.rb deleted file mode 100644 index 20fa7248..00000000 --- a/lib/rbot/plugins/freshmeat.rb +++ /dev/null @@ -1,98 +0,0 @@ -require 'rexml/document' -require 'uri/common' - -class FreshmeatPlugin < Plugin - include REXML - def help(plugin, topic="") - "freshmeat search [<max>=4] <string> => search freshmeat for <string>, freshmeat [<max>=4] => return up to <max> freshmeat headlines" - end - - def search_freshmeat(m, params) - max = params[:limit].to_i - search = params[:search].to_s - max = 8 if max > 8 - begin - xml = @bot.httputil.get(URI.parse("http://freshmeat.net/search-xml/?orderby=locate_projectname_full_DESC&q=#{URI.escape(search)}")) - rescue URI::InvalidURIError, URI::BadURIError => e - m.reply "illegal search string #{search}" - return - end - unless xml - m.reply "search for #{search} failed" - return - end - doc = Document.new xml - unless doc - m.reply "search for #{search} failed" - return - end - matches = Array.new - max_width = 250 - title_width = 0 - url_width = 0 - done = 0 - doc.elements.each("*/match") {|e| - name = e.elements["projectname_short"].text - url = "http://freshmeat.net/projects/#{name}/" - desc = e.elements["desc_short"].text - title = e.elements["projectname_full"].text - #title_width = title.length if title.length > title_width - url_width = url.length if url.length > url_width - matches << [title, url, desc] - done += 1 - break if done >= max - } - if matches.length == 0 - m.reply "not found: #{search}" - end - matches.each {|mat| - title = mat[0] - url = mat[1] - desc = mat[2] - desc.gsub!(/(.{#{max_width - 3 - url_width}}).*/, '\1..') - reply = sprintf("%s | %s", url.ljust(url_width), desc) - m.reply reply - } - end - - def freshmeat(m, params) - max = params[:limit].to_i - max = 8 if max > 8 - xml = @bot.httputil.get(URI.parse("http://images.feedstermedia.com/feedcache/ostg/freshmeat/fm-releases-global.xml")) - unless xml - m.reply "freshmeat news parse failed" - return - end - doc = Document.new xml - unless doc - m.reply "freshmeat news parse failed" - return - end - matches = Array.new - max_width = 60 - title_width = 0 - done = 0 - doc.elements.each("*/channel/item") {|e| - desc = e.elements["description"].text - title = e.elements["title"].text - #title.gsub!(/\s+\(.*\)\s*$/, "") - title.strip! - title_width = title.length if title.length > title_width - matches << [title, desc] - done += 1 - break if done >= max - } - matches.each {|mat| - title = mat[0] - #desc = mat[1] - #desc.gsub!(/(.{#{max_width - 3 - title_width}}).*/, '\1..') - #reply = sprintf("%#{title_width}s | %s", title, desc) - m.reply title - } - end -end -plugin = FreshmeatPlugin.new -plugin.map 'freshmeat search :limit *search', :action => 'search_freshmeat', - :defaults => {:limit => 4}, :requirements => {:limit => /^\d+$/} -plugin.map 'freshmeat :limit', :defaults => {:limit => 4}, - :requirements => {:limit => /^\d+$/} diff --git a/lib/rbot/plugins/google.rb b/lib/rbot/plugins/google.rb deleted file mode 100644 index cd96f23c..00000000 --- a/lib/rbot/plugins/google.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'net/http' -require 'uri/common' - -Net::HTTP.version_1_2 - -class GooglePlugin < Plugin - def help(plugin, topic="") - "search <string> => search google for <string>" - end - def privmsg(m) - unless(m.params && m.params.length > 0) - m.reply "incorrect usage: " + help(m.plugin) - return - end - searchfor = URI.escape m.params - - query = "/search?q=#{searchfor}&btnI=I%27m%20feeling%20lucky" - result = "not found!" - - proxy_host = nil - proxy_port = nil - - if(ENV['http_proxy']) - if(ENV['http_proxy'] =~ /^http:\/\/(.+):(\d+)$/) - proxy_host = $1 - proxy_port = $2 - end - end - - http = @bot.httputil.get_proxy(URI.parse("http://www.google.com")) - - begin - http.start {|http| - resp = http.get(query) - if resp.code == "302" - result = resp['location'] - end - } - rescue => e - p e - if e.response && e.response['location'] - result = e.response['location'] - else - result = "error!" - end - end - m.reply "#{m.params}: #{result}" - end -end -plugin = GooglePlugin.new -plugin.register("search") diff --git a/lib/rbot/plugins/host.rb b/lib/rbot/plugins/host.rb deleted file mode 100644 index ef8dc8bc..00000000 --- a/lib/rbot/plugins/host.rb +++ /dev/null @@ -1,14 +0,0 @@ -class HostPlugin < Plugin - def help(plugin, topic="") - "host <domain> => query nameserver about domain names and zones for <domain>" - end - def privmsg(m) - unless(m.params =~ /^(\w|-|\.)+$/) - m.reply "incorrect usage: " + help(m.plugin) - return - end - m.reply Utils.safe_exec("host", m.params) - end -end -plugin = HostPlugin.new -plugin.register("host") diff --git a/lib/rbot/plugins/httpd.rb b/lib/rbot/plugins/httpd.rb deleted file mode 100644 index 92fe3a80..00000000 --- a/lib/rbot/plugins/httpd.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'webrick' - -class HttpPlugin < Plugin - include WEBrick - - - def initialize - super - @http_server = HTTPServer.new( - :Port => 5555 - ) - @http_server.mount_proc("/") { |req, resp| - resp['content-type'] = 'text/html' - resp.body = "<html><head><title>rbot httpd plugin</title></head><body>" - resp.body += "#{@bot.status} <br />" - resp.body += "hello from rbot." - resp.body += "</body>" - raise HTTPStatus::OK - } - Thread.new { - @http_server.start - } - end - def cleanup - @http_server.shutdown - end - def help(plugin, topic="") - "no help yet" - end - def privmsg(m) - end -end - -plugin = HttpPlugin.new -plugin.register("http") diff --git a/lib/rbot/plugins/insult.rb b/lib/rbot/plugins/insult.rb deleted file mode 100644 index 5f0384e8..00000000 --- a/lib/rbot/plugins/insult.rb +++ /dev/null @@ -1,258 +0,0 @@ -class InsultPlugin < Plugin - -## insults courtesy of http://insulthost.colorado.edu/ - -## -# Adjectives -## -@@adj = [ -"acidic", -"antique", -"contemptible", -"culturally-unsound", -"despicable", -"evil", -"fermented", -"festering", -"foul", -"fulminating", -"humid", -"impure", -"inept", -"inferior", -"industrial", -"left-over", -"low-quality", -"malodorous", -"off-color", -"penguin-molesting", -"petrified", -"pointy-nosed", -"salty", -"sausage-snorfling", -"tastless", -"tempestuous", -"tepid", -"tofu-nibbling", -"unintelligent", -"unoriginal", -"uninspiring", -"weasel-smelling", -"wretched", -"spam-sucking", -"egg-sucking", -"decayed", -"halfbaked", -"infected", -"squishy", -"porous", -"pickled", -"coughed-up", -"thick", -"vapid", -"hacked-up", -"unmuzzled", -"bawdy", -"vain", -"lumpish", -"churlish", -"fobbing", -"rank", -"craven", -"puking", -"jarring", -"fly-bitten", -"pox-marked", -"fen-sucked", -"spongy", -"droning", -"gleeking", -"warped", -"currish", -"milk-livered", -"surly", -"mammering", -"ill-borne", -"beef-witted", -"tickle-brained", -"half-faced", -"headless", -"wayward", -"rump-fed", -"onion-eyed", -"beslubbering", -"villainous", -"lewd-minded", -"cockered", -"full-gorged", -"rude-snouted", -"crook-pated", -"pribbling", -"dread-bolted", -"fool-born", -"puny", -"fawning", -"sheep-biting", -"dankish", -"goatish", -"weather-bitten", -"knotty-pated", -"malt-wormy", -"saucyspleened", -"motley-mind", -"it-fowling", -"vassal-willed", -"loggerheaded", -"clapper-clawed", -"frothy", -"ruttish", -"clouted", -"common-kissing", -"pignutted", -"folly-fallen", -"plume-plucked", -"flap-mouthed", -"swag-bellied", -"dizzy-eyed", -"gorbellied", -"weedy", -"reeky", -"measled", -"spur-galled", -"mangled", -"impertinent", -"bootless", -"toad-spotted", -"hasty-witted", -"horn-beat", -"yeasty", -"boil-brained", -"tottering", -"hedge-born", -"hugger-muggered", -"elf-skinned", -] - -## -# Amounts -## -@@amt = [ -"accumulation", -"bucket", -"coagulation", -"enema-bucketful", -"gob", -"half-mouthful", -"heap", -"mass", -"mound", -"petrification", -"pile", -"puddle", -"stack", -"thimbleful", -"tongueful", -"ooze", -"quart", -"bag", -"plate", -"ass-full", -"assload", -] - -## -# Objects -## -@@noun = [ -"bat toenails", -"bug spit", -"cat hair", -"chicken piss", -"dog vomit", -"dung", -"fat-woman's stomach-bile", -"fish heads", -"guano", -"gunk", -"pond scum", -"rat retch", -"red dye number-9", -"Sun IPC manuals", -"waffle-house grits", -"yoo-hoo", -"dog balls", -"seagull puke", -"cat bladders", -"pus", -"urine samples", -"squirrel guts", -"snake assholes", -"snake bait", -"buzzard gizzards", -"cat-hair-balls", -"rat-farts", -"pods", -"armadillo snouts", -"entrails", -"snake snot", -"eel ooze", -"slurpee-backwash", -"toxic waste", -"Stimpy-drool", -"poopy", -"poop", -"craptacular carpet droppings", -"jizzum", -"cold sores", -"anal warts", -] - - def help(plugin, topic="") - if(plugin == "insult") - return "insult me|<person> => insult you or <person>" - elsif(plugin == "msginsult") - return "msginsult <nick> => insult <nick> via /msg" - else - return "insult module topics: msginsult, insult" - end - end - def privmsg(m) - suffix="" - unless(m.params) - m.reply "incorrect usage: " + help(m.plugin) - return - end - msgto = m.channel - if(m.plugin =~ /^msginsult$/) - prefix = "you are " - if (m.params =~ /^#/) - prefix += "all " - end - msgto = m.params - suffix = " (from #{m.sourcenick})" - elsif(m.params =~ /^me$/) - prefix = "you are " - else - prefix = "#{m.params} is " - end - insult = generate_insult - @bot.say msgto, prefix + insult + suffix - end - def generate_insult - adj = @@adj[rand(@@adj.length)] - adj2 = "" - loop do - adj2 = @@adj[rand(@@adj.length)] - break if adj2 != adj - end - amt = @@amt[rand(@@amt.length)] - noun = @@noun[rand(@@noun.length)] - start = "a " - start = "an " if ['a','e','i','o','u'].include?(adj[0].chr) - "#{start}#{adj} #{amt} of #{adj2} #{noun}" - end -end -plugin = InsultPlugin.new -plugin.register("insult") -plugin.register("msginsult") - diff --git a/lib/rbot/plugins/karma.rb b/lib/rbot/plugins/karma.rb deleted file mode 100644 index 148427a5..00000000 --- a/lib/rbot/plugins/karma.rb +++ /dev/null @@ -1,85 +0,0 @@ -class KarmaPlugin < Plugin - def initialize - super - - # this plugin only wants to store ints! - class << @registry - def store(val) - val.to_i - end - def restore(val) - val.to_i - end - end - @registry.set_default(0) - - # import if old file format found - if(File.exist?("#{@bot.botclass}/karma.rbot")) - puts "importing old karma data" - IO.foreach("#{@bot.botclass}/karma.rbot") do |line| - if(line =~ /^(\S+)<=>([\d-]+)$/) - item = $1 - karma = $2.to_i - @registry[item] = karma - end - end - File.delete("#{@bot.botclass}/karma.rbot") - end - - end - - def stats(m, params) - if (@registry.length) - max = @registry.values.max - min = @registry.values.min - best = @registry.to_hash.index(max) - worst = @registry.to_hash.index(min) - m.reply "#{@registry.length} items. Best: #{best} (#{max}); Worst: #{worst} (#{min})" - end - end - - def karma(m, params) - thing = params[:key] - thing = m.sourcenick unless thing - thing = thing.to_s - karma = @registry[thing] - if(karma != 0) - m.reply "karma for #{thing}: #{@registry[thing]}" - else - m.reply "#{thing} has neutral karma" - end - end - - - def help(plugin, topic="") - "karma module: <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." - end - def listen(m) - return unless m.kind_of?(PrivMessage) && m.public? - # in channel message, the kind we are interested in - if(m.message =~ /(\+\+|--)/) - string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^(++)(\-\-)\s]+)/, "\2\1") - seen = Hash.new - while(string.sub!(/(\(.*?\)|[^(++)(\-\-)\s]+)(\+\+|--)/, "")) - key = $1 - change = $2 - next if seen[key] - seen[key] = true - - key.sub!(/^\((.*)\)$/, "\1") - key.gsub!(/\s+/, " ") - next unless(key.length > 0) - next if(key == m.sourcenick) - if(change == "++") - @registry[key] += 1 - elsif(change == "--") - @registry[key] -= 1 - end - end - end - end -end -plugin = KarmaPlugin.new -plugin.map 'karmastats', :action => 'stats' -plugin.map 'karma :key', :defaults => {:key => false} -plugin.map 'karma for :key' diff --git a/lib/rbot/plugins/lart.rb b/lib/rbot/plugins/lart.rb deleted file mode 100644 index de767197..00000000 --- a/lib/rbot/plugins/lart.rb +++ /dev/null @@ -1,181 +0,0 @@ -# Author: Michael Brailsford <brailsmt@yahoo.com> -# aka brailsmt -# Purpose: Provide for humorous larts and praises -# Copyright: 2002 Michael Brailsford. All rights reserved. -# License: This plugin is licensed under the BSD license. The terms of -# which follow. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -class LartPlugin < Plugin - - # Keep a 1:1 relation between commands and handlers - @@handlers = { - "lart" => "handle_lart", - "praise" => "handle_praise", - "addlart" => "handle_addlart", - "rmlart" => "handle_rmlart", - "addpraise" => "handle_addpraise", - "rmpraise" => "handle_rmpraise" - } - - def name - "lart" - end - - #{{{ - def initialize - super - @larts = Array.new - @praises = Array.new - #read in the lart and praise files - if File.exists? "#{@bot.botclass}/lart/larts" - IO.foreach("#{@bot.botclass}/lart/larts") { |line| - @larts << line.chomp - } - end - if File.exists? "#{@bot.botclass}/lart/praises" - IO.foreach("#{@bot.botclass}/lart/praises") { |line| - @praises << line.chomp - } - end - end - #}}} - #{{{ - def cleanup - end - #}}} - #{{{ - def save - Dir.mkdir("#{@bot.botclass}/lart") if not FileTest.directory? "#{@bot.botclass}/lart" - File.open("#{@bot.botclass}/lart/larts", "w") { |file| - file.puts @larts - } - File.open("#{@bot.botclass}/lart/praises", "w") { |file| - file.puts @praises - } - end - #}}} - #{{{ - def privmsg(m) - if not m.params - m.reply "What a crazy fool! Did you mean |help stats?" - return - end - - meth = self.method(@@handlers[m.plugin]) - meth.call(m) if(@bot.auth.allow?(m.plugin, m.source, m.replyto)) - end - #}}} - #{{{ - def help(plugin, topic="") - "Lart: The lart plugin allows you to punish/praise someone in the channel. You can also add new punishments and new praises as well as delete them. For the curious, LART is an acronym for Luser Attitude Readjustment Tool.\nUsage: punish/lart <nick> <reason> -- punishes <nick> for <reason>. The reason is optional.\n praise <nick> <reason> -- praises <nick> for <reason>. The reason is optional.\n mod[lart|punish|praise] [add|remove] -- Add or remove a lart or praise." - end - #}}} - # The following are command handlers {{{ - #{{{ - def handle_lart(m) - for_idx = m.params =~ /\s+\bfor\b/ - if for_idx - nick = m.params[0, for_idx] - else - nick = m.params - end - lart = @larts[get_msg_idx(@larts.length)] - if lart == nil - m.reply "I dunno any larts" - return - end - if nick == @bot.nick - lart = replace_who lart, m.sourcenick - lart << " for trying to make me lart myself" - else - lart = replace_who lart, nick - lart << m.params[for_idx, m.params.length] if for_idx - end - - @bot.action m.replyto, lart - end - #}}} - #{{{ - def handle_praise(m) - for_idx = m.params =~ /\s+\bfor\b/ - if for_idx - nick = m.params[0, for_idx] - else - nick = m.params - end - praise = @praises[get_msg_idx(@praises.length)] - if not praise - m.reply "I dunno any praises" - return - end - - if nick == m.sourcenick - praise = @larts[get_msg_idx(@larts.length)] - praise = replace_who praise, nick - else - praise = replace_who praise, nick - praise << m.params.gsub(/#{nick}/, "") - end - - @bot.action m.replyto, praise - end - #}}} - #{{{ - def handle_addlart(m) - @larts << m.params - m.okay - end - #}}} - #{{{ - def handle_rmlart(m) - @larts.delete m.params - m.okay - end - #}}} - #{{{ - def handle_addpraise(m) - @praises << m.params - m.okay - end - #}}} - #{{{ - def handle_rmpraise(m) - @praises.delete m.params - m.okay - end - #}}} - #}}} - - # The following are utils for larts/praises {{{ - #{{{ - def replace_who(msg, nick) - msg.gsub(/<who>/i, "#{nick}") - end - #}}} - #{{{ - def get_msg_idx(max) - idx = rand(max) - end - #}}} - #}}} -end -plugin = LartPlugin.new -plugin.register("lart") -plugin.register("praise") - -plugin.register("addlart") -plugin.register("addpraise") - -plugin.register("rmlart") -plugin.register("rmpraise") diff --git a/lib/rbot/plugins/math.rb b/lib/rbot/plugins/math.rb deleted file mode 100644 index 4a207389..00000000 --- a/lib/rbot/plugins/math.rb +++ /dev/null @@ -1,122 +0,0 @@ -class MathPlugin < Plugin - @@digits = { - "first" => "1", - "second" => "2", - "third" => "3", - "fourth" => "4", - "fifth" => "5", - "sixth" => "6", - "seventh" => "7", - "eighth" => "8", - "ninth" => "9", - "tenth" => "10", - "one" => "1", - "two" => "2", - "three" => "3", - "four" => "4", - "five" => "5", - "six" => "6", - "seven" => "7", - "eight" => "8", - "nine" => "9", - "ten" => "10" - }; - - def help(plugin, topic="") - "math <expression>, evaluate mathematical expression" - end - def privmsg(m) - unless(m.params) - m.reply "incorrect usage: " + help(m.plugin) - return - end - - expr = m.params.dup - @@digits.each {|k,v| - expr.gsub!(/\b#{k}\b/, v) - } - - while expr =~ /(exp ([\w\d]+))/ - exp = $1 - val = Math.exp($2).to_s - expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") - end - - while expr =~ /^\s*(dec2hex\s*(\d+))\s*\?*/ - exp = $1 - val = sprintf("%x", $2) - expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") - end - - expr.gsub(/\be\b/, Math.exp(1).to_s) - - while expr =~ /(log\s*((\d+\.?\d*)|\d*\.?\d+))\s*/ - exp = $1 - res = $2 - - if res == 0 - val = "Infinity" - else - val = Math.log(res).to_s - end - - expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") - end - - while expr =~ /(bin2dec ([01]+))/ - exp = $1 - val = join('', unpack('B*', pack('N', $2))) - val.gsub!(/^0+/, "") - expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") - end - - expr.gsub!(/ to the power of /, " ** ") - expr.gsub!(/ to the /, " ** ") - expr.gsub!(/\btimes\b/, "*") - expr.gsub!(/\bdiv(ided by)? /, "/ ") - expr.gsub!(/\bover /, "/ ") - expr.gsub!(/\bsquared/, "**2 ") - expr.gsub!(/\bcubed/, "**3 ") - expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, "**\1 ") - expr.gsub!(/\bpercent of/, "*0.01*") - expr.gsub!(/\bpercent/, "*0.01") - expr.gsub!(/\% of\b/, "*0.01*") - expr.gsub!(/\%/, "*0.01") - expr.gsub!(/\bsquare root of (\d+)/, "\1 ** 0.5 ") - expr.gsub!(/\bcubed? root of (\d+)/, "\1 **(1.0/3.0) ") - expr.gsub!(/ of /, " * ") - expr.gsub!(/(bit(-| )?)?xor(\'?e?d( with))?/, "^") - expr.gsub!(/(bit(-| )?)?or(\'?e?d( with))?/, "|") - expr.gsub!(/bit(-| )?and(\'?e?d( with))?/, "& ") - expr.gsub!(/(plus|and)/, "+") - - if (expr =~ /^\s*[-\d*+\s()\/^\.\|\&\*\!]+\s*$/ && - expr !~ /^\s*\(?\d+\.?\d*\)?\s*$/ && - expr !~ /^\s*$/ && - expr !~ /^\s*[( )]+\s*$/) - - begin - debug "evaluating expression \"#{expr}\"" - answer = eval(expr) - if answer =~ /^[-+\de\.]+$/ - answer = sprintf("%1.12f", answer) - answer.gsub!(/\.?0+$/, "") - answer.gsub!(/(\.\d+)000\d+/, '\1') - if (answer.length > 30) - answer = "a number with >30 digits..." - end - end - m.reply answer - rescue Exception => e - puts "couldn't evaluate expression \"#{m.params}\": #{e}" - m.reply "illegal expression \"#{m.params}\"" - return - end - else - m.reply "illegal expression \"#{m.params}\"" - return - end - end -end -plugin = MathPlugin.new -plugin.register("math") diff --git a/lib/rbot/plugins/nickserv.rb b/lib/rbot/plugins/nickserv.rb deleted file mode 100644 index 1ef2baf7..00000000 --- a/lib/rbot/plugins/nickserv.rb +++ /dev/null @@ -1,99 +0,0 @@ -# automatically lookup nicks in @registry and identify when asked - -class NickServPlugin < Plugin - - def help(plugin, topic="") - case topic - when "" - return "nickserv plugin: handles nickserv protected IRC nicks. topics password, register, identify, listnicks" - when "password" - return "nickserv password <nick> <passwd>: remember the password for nick <nick> and use it to identify in future" - when "register" - return "nickserv register [<password> [<email>]]: register the current nick, choosing a random password unless <password> is supplied - current nick must not already be registered for this to work. Also specify email if required by your services" - when "identify" - return "nickserv identify: identify with nickserv - shouldn't be needed - bot should identify with nickserv immediately on request - however this could be useful after splits or service disruptions, or when you just set the password for the current nick" - when "listnicks" - return "nickserv listnicks: lists nicknames and associated password the bot knows about - you will need config level auth access to do this one and it will reply by privmsg only" - end - end - - def initialize - super - # this plugin only wants to store strings! - class << @registry - def store(val) - val - end - def restore(val) - val - end - end - end - - def privmsg(m) - return unless m.params - - case m.params - when (/^password\s*(\S*)\s*(.*)$/) - nick = $1 - passwd = $2 - @registry[nick] = passwd - m.okay - when (/^register$/) - passwd = genpasswd - @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd - @registry[@bot.nick] = passwd - m.okay - when (/^register\s*(\S*)\s*(.*)$/) - passwd = $1 - email = $2 - @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd + " " + email - @registry[@bot.nick] = passwd - m.okay - when (/^register\s*(.*)\s*$/) - passwd = $1 - @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd - @registry[@bot.nick] = passwd - m.okay - when (/^listnicks$/) - if @bot.auth.allow?("config", m.source, m.replyto) - if @registry.length > 0 - @registry.each {|k,v| - @bot.say m.sourcenick, "#{k} => #{v}" - } - else - m.reply "none known" - end - end - when (/^identify$/) - if @registry.has_key?(@bot.nick) - @bot.sendmsg "PRIVMSG", "NickServ", "IDENTIFY " + @registry[@bot.nick] - m.okay - else - m.reply "I dunno the nickserv password for the nickname #{@bot.nick} :(" - end - end - end - - def listen(m) - return unless(m.kind_of? NoticeMessage) - - if (m.sourcenick == "NickServ" && m.message =~ /This nickname is owned by someone else/) - puts "nickserv asked us to identify for nick #{@bot.nick}" - if @registry.has_key?(@bot.nick) - @bot.sendmsg "PRIVMSG", "NickServ", "IDENTIFY " + @registry[@bot.nick] - end - end - end - - def genpasswd - # generate a random password - passwd = "" - 8.times do - passwd += (rand(26) + (rand(2) == 0 ? 65 : 97) ).chr - end - return passwd - end -end -plugin = NickServPlugin.new -plugin.register("nickserv") diff --git a/lib/rbot/plugins/nslookup.rb b/lib/rbot/plugins/nslookup.rb deleted file mode 100644 index 92da1ba7..00000000 --- a/lib/rbot/plugins/nslookup.rb +++ /dev/null @@ -1,56 +0,0 @@ -class DnsPlugin < Plugin - begin - require 'resolv-replace' - def gethostname(address) - Resolv.getname(address) - end - def getaddresses(name) - Resolv.getaddresses(name) - end - rescue LoadError - def gethostname(address) - Socket.gethostbyname(address).first - end - def getaddresses(name) - a = Socket.gethostbyname(name) - list = Socket.getaddrinfo(a[0], 'http') - addresses = Array.new - list.each {|line| - addresses << line[3] - } - addresses - end - end - - def help(plugin, topic="") - "nslookup|dns <hostname|ip> => show local resolution results for hostname or ip address" - end - def privmsg(m) - unless(m.params) - m.reply "incorrect usage: " + help(m.plugin) - return - end - Thread.new do - if(m.params =~ /^\d+\.\d+\.\d+\.\d+$/) - begin - a = gethostname(m.params) - m.reply m.params + ": " + a if a - rescue StandardError => err - m.reply "#{m.params}: not found" - end - elsif(m.params =~ /^\S+$/) - begin - a = getaddresses(m.params) - m.reply m.params + ": " + a.join(", ") - rescue StandardError => err - m.reply "#{m.params}: not found" - end - else - m.reply "incorrect usage: " + help(m.plugin) - end - end - end -end -plugin = DnsPlugin.new -plugin.register("nslookup") -plugin.register("dns") diff --git a/lib/rbot/plugins/opmeh.rb b/lib/rbot/plugins/opmeh.rb deleted file mode 100644 index 0702c906..00000000 --- a/lib/rbot/plugins/opmeh.rb +++ /dev/null @@ -1,19 +0,0 @@ -class OpMehPlugin < Plugin - - def help(plugin, topic="") - return "opmeh <channel> => grant user ops in <channel>" - end - - def privmsg(m) - if(m.params) - channel = m.params - else - channel = m.channel - end - target = m.sourcenick - @bot.sendq("MODE #{channel} +o #{target}") - m.okay - end -end -plugin = OpMehPlugin.new -plugin.register("opmeh") diff --git a/lib/rbot/plugins/quotes.rb b/lib/rbot/plugins/quotes.rb deleted file mode 100644 index 674a9ed6..00000000 --- a/lib/rbot/plugins/quotes.rb +++ /dev/null @@ -1,321 +0,0 @@ -Quote = Struct.new("Quote", "num", "date", "source", "quote") - -class QuotePlugin < Plugin - def initialize - super - @lists = Hash.new - Dir["#{@bot.botclass}/quotes/*"].each {|f| - channel = File.basename(f) - @lists[channel] = Array.new if(!@lists.has_key?(channel)) - IO.foreach(f) {|line| - if(line =~ /^(\d+) \| ([^|]+) \| (\S+) \| (.*)$/) - num = $1.to_i - @lists[channel][num] = Quote.new(num, $2, $3, $4) - end - } - } - end - def save - Dir.mkdir("#{@bot.botclass}/quotes") if(!FileTest.directory?("#{@bot.botclass}/quotes")) - @lists.each {|channel, quotes| - File.open("#{@bot.botclass}/quotes/#{channel}", "w") {|file| - quotes.compact.each {|q| - file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}" - } - } - } - end - def addquote(source, channel, quote) - @lists[channel] = Array.new if(!@lists.has_key?(channel)) - num = @lists[channel].length - @lists[channel][num] = Quote.new(num, Time.new, source, quote) - return num - end - def getquote(source, channel, num=nil) - return nil unless(@lists.has_key?(channel)) - return nil unless(@lists[channel].length > 0) - if(num) - if(@lists[channel][num]) - return @lists[channel][num], @lists[channel].length - 1 - end - else - # random quote - return @lists[channel].compact[rand(@lists[channel].nitems)], - @lists[channel].length - 1 - end - end - def delquote(channel, num) - return false unless(@lists.has_key?(channel)) - return false unless(@lists[channel].length > 0) - if(@lists[channel][num]) - @lists[channel][num] = nil - return true - end - return false - end - def countquote(source, channel=nil, regexp=nil) - unless(channel) - total=0 - @lists.each_value {|l| - total += l.compact.length - } - return total - end - return 0 unless(@lists.has_key?(channel)) - return 0 unless(@lists[channel].length > 0) - if(regexp) - matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/i } - else - matches = @lists[channel].compact - end - return matches.length - end - def searchquote(source, channel, regexp) - return nil unless(@lists.has_key?(channel)) - return nil unless(@lists[channel].length > 0) - matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/i } - if(matches.length > 0) - return matches[rand(matches.length)], @lists[channel].length - 1 - else - return nil - end - end - def help(plugin, topic="") - case topic - when "addquote" - return "addquote [<channel>] <quote> => Add quote <quote> for channel <channel>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Responds to !addquote without addressing if so configured" - when "delquote" - return "delquote [<channel>] <num> => delete quote from <channel> with number <num>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Responds to !delquote without addressing if so configured" - when "getquote" - return "getquote [<channel>] [<num>] => get quote from <channel> with number <num>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Without <num>, a random quote will be returned. Responds to !getquote without addressing if so configured" - when "searchquote" - return "searchquote [<channel>] <regexp> => search for quote from <channel> that matches <regexp>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Responds to !searchquote without addressing if so configured" - when "topicquote" - return "topicquote [<channel>] [<num>] => set topic to quote from <channel> with number <num>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Without <num>, a random quote will be set. Responds to !topicquote without addressing if so configured" - when "countquote" - return "countquote [<channel>] <regexp> => count quotes from <channel> that match <regexp>. You only need to supply <channel> if you are addressing #{@bot.nick} privately. Responds to !countquote without addressing if so configured" - when "whoquote" - return "whoquote [<channel>] <num> => show who added quote <num>. You only need to supply <channel> if you are addressing #{@bot.nick} privately" - when "whenquote" - return "whenquote [<channel>] <num> => show when quote <num> was added. You only need to supply <channel> if you are addressing #{@bot.nick} privately" - else - return "Quote module (Quote storage and retrieval) topics: addquote, getquote, searchquote, topicquote, countquote, whoquote, whenquote" - end - end - def listen(m) - return unless(m.kind_of? PrivMessage) - - command = m.message.dup - if(m.address? && m.private?) - case command - when (/^addquote\s+(#\S+)\s+(.*)/) - channel = $1 - quote = $2 - if(@bot.auth.allow?("addquote", m.source, m.replyto)) - if(channel =~ /^#/) - num = addquote(m.source, channel, quote) - m.reply "added the quote (##{num})" - end - end - when (/^getquote\s+(#\S+)$/) - channel = $1 - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^getquote\s+(#\S+)\s+(\d+)$/) - channel = $1 - num = $2.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel, num) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^whoquote\s+(#\S+)\s+(\d+)$/) - channel = $1 - num = $2.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel, num) - if(quote) - m.reply "quote #{quote.num} added by #{quote.source}" - else - m.reply "quote not found!" - end - end - when (/^whenquote\s+(#\S+)\s+(\d+)$/) - channel = $1 - num = $2.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel, num) - if(quote) - m.reply "quote #{quote.num} added on #{quote.date}" - else - m.reply "quote not found!" - end - end - when (/^topicquote\s+(#\S+)$/) - channel = $1 - if(@bot.auth.allow?("topicquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel) - if(quote) - @bot.topic channel, "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^topicquote\s+(#\S+)\s+(\d+)$/) - channel = $1 - num = $2.to_i - if(@bot.auth.allow?("topicquote", m.source, m.replyto)) - quote, total = getquote(m.source, channel, num) - if(quote) - @bot.topic channel, "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^delquote\s+(#\S+)\s+(\d+)$/) - channel = $1 - num = $2.to_i - if(@bot.auth.allow?("delquote", m.source, m.replyto)) - if(delquote(channel, num)) - m.okay - else - m.reply "quote not found!" - end - end - when (/^searchquote\s+(#\S+)\s+(.*)$/) - channel = $1 - reg = $2 - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = searchquote(m.source, channel, reg) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^countquote$/) - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - total = countquote(m.source) - m.reply "#{total} quotes" - end - when (/^countquote\s+(#\S+)\s*(.*)$/) - channel = $1 - reg = $2 - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - total = countquote(m.source, channel, reg) - if(reg.length > 0) - m.reply "#{total} quotes match: #{reg}" - else - m.reply "#{total} quotes" - end - end - end - elsif (m.address? || (@bot.config["QUOTE_LISTEN"] && command.gsub!(/^!/, ""))) - case command - when (/^addquote\s+(.+)/) - if(@bot.auth.allow?("addquote", m.source, m.replyto)) - num = addquote(m.source, m.target, $1) - m.reply "added the quote (##{num})" - end - when (/^getquote$/) - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "no quotes found!" - end - end - when (/^getquote\s+(\d+)$/) - num = $1.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target, num) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^whenquote\s+(\d+)$/) - num = $1.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target, num) - if(quote) - m.reply "quote #{quote.num} added on #{quote.date}" - else - m.reply "quote not found!" - end - end - when (/^whoquote\s+(\d+)$/) - num = $1.to_i - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target, num) - if(quote) - m.reply "quote #{quote.num} added by #{quote.source}" - else - m.reply "quote not found!" - end - end - when (/^topicquote$/) - if(@bot.auth.allow?("topicquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target) - if(quote) - @bot.topic m.target, "[#{quote.num}] #{quote.quote}" - else - m.reply "no quotes found!" - end - end - when (/^topicquote\s+(\d+)$/) - num = $1.to_i - if(@bot.auth.allow?("topicquote", m.source, m.replyto)) - quote, total = getquote(m.source, m.target, num) - if(quote) - @bot.topic m.target, "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^delquote\s+(\d+)$/) - num = $1.to_i - if(@bot.auth.allow?("delquote", m.source, m.replyto)) - if(delquote(m.target, num)) - m.okay - else - m.reply "quote not found!" - end - end - when (/^searchquote\s+(.*)$/) - reg = $1 - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - quote, total = searchquote(m.source, m.target, reg) - if(quote) - m.reply "[#{quote.num}] #{quote.quote}" - else - m.reply "quote not found!" - end - end - when (/^countquote(?:\s+(.*))?$/) - reg = $1 - if(@bot.auth.allow?("getquote", m.source, m.replyto)) - total = countquote(m.source, m.target, reg) - if(reg && reg.length > 0) - m.reply "#{total} quotes match: #{reg}" - else - m.reply "#{total} quotes" - end - end - end - end - end -end -plugin = QuotePlugin.new -plugin.register("quotes") diff --git a/lib/rbot/plugins/remind.rb b/lib/rbot/plugins/remind.rb deleted file mode 100644 index 5ad980ae..00000000 --- a/lib/rbot/plugins/remind.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'rbot/utils' - -class RemindPlugin < Plugin - def initialize - super - @reminders = Hash.new - end - def cleanup - @reminders.each_value {|v| - v.each_value {|vv| - @bot.timer.remove(vv) - } - } - @reminders.clear - end - def help(plugin, topic="") - if(plugin =~ /^remind\+$/) - "see remind. remind+ can be used to remind someone else of something, using <nick> instead of 'me'. However this will generally require a higher auth level than remind." - else - "remind me [about] <message> in <time>, remind me [about] <message> every <time>, remind me [about] <message> at <time>, remind me no more [about] <message>, remind me no more" - end - end - def add_reminder(who, subject, timestr, repeat=false) - begin - period = Irc::Utils.timestr_offset(timestr) - rescue RuntimeError - return "couldn't parse that time string (#{timestr}) :(" - end - if(period <= 0) - return "that time is in the past! (#{timestr})" - end - if(period < 30 && repeat) - return "repeats of less than 30 seconds are forbidden" - end - if(!@reminders.has_key?(who)) - @reminders[who] = Hash.new - elsif(@reminders[who].has_key?(subject)) - del_reminder(who, subject) - end - - if(repeat) - @reminders[who][subject] = @bot.timer.add(period) { - time = Time.now + period - tstr = time.strftime("%H:%M:%S") - @bot.say who, "repeat reminder (next at #{tstr}): #{subject}" - } - else - @reminders[who][subject] = @bot.timer.add_once(period) { - time = Time.now + period - tstr = time.strftime("%H:%M:%S") - @bot.say who, "reminder (#{tstr}): #{subject}" - } - end - return false - end - def del_reminder(who, subject=nil) - if(subject) - if(@reminders.has_key?(who) && @reminders[who].has_key?(subject)) - @bot.timer.remove(@reminders[who][subject]) - @reminders[who].delete(subject) - end - else - if(@reminders.has_key?(who)) - @reminders[who].each_value {|v| - @bot.timer.remove(v) - } - @reminders.delete(who) - end - end - end - def privmsg(m) - - if(m.params =~ /^(\S+)\s+(?:about\s+)?(.*)\s+in\s+(.*)$/) - who = $1 - subject = $2 - period = $3 - if(who =~ /^me$/) - who = m.sourcenick - else - unless(m.plugin =~ /^remind\+$/) - m.reply "incorrect usage: use remind+ to remind persons other than yourself" - return - end - end - if(err = add_reminder(who, subject, period)) - m.reply "incorrect usage: " + err - return - end - elsif(m.params =~ /^(\S+)\s+(?:about\s+)?(.*)\s+every\s+(.*)$/) - who = $1 - subject = $2 - period = $3 - if(who =~ /^me$/) - who = m.sourcenick - else - unless(m.plugin =~ /^remind\+$/) - m.reply "incorrect usage: use remind+ to remind persons other than yourself" - return - end - end - if(err = add_reminder(who, subject, period, true)) - m.reply "incorrect usage: " + err - return - end - elsif(m.params =~ /^(\S+)\s+(?:about\s+)?(.*)\s+at\s+(.*)$/) - who = $1 - subject = $2 - time = $3 - if(who =~ /^me$/) - who = m.sourcenick - else - unless(m.plugin =~ /^remind\+$/) - m.reply "incorrect usage: use remind+ to remind persons other than yourself" - return - end - end - if(err = add_reminder(who, subject, time)) - m.reply "incorrect usage: " + err - return - end - elsif(m.params =~ /^(\S+)\s+no\s+more\s+(?:about\s+)?(.*)$/) - who = $1 - subject = $2 - if(who =~ /^me$/) - who = m.sourcenick - else - unless(m.plugin =~ /^remind\+$/) - m.reply "incorrect usage: use remind+ to remind persons other than yourself" - return - end - end - del_reminder(who, subject) - elsif(m.params =~ /^(\S+)\s+no\s+more$/) - who = $1 - if(who =~ /^me$/) - who = m.sourcenick - else - unless(m.plugin =~ /^remind\+$/) - m.reply "incorrect usage: use remind+ to remind persons other than yourself" - return - end - end - del_reminder(who) - else - m.reply "incorrect usage: " + help(m.plugin) - return - end - m.okay - end -end -plugin = RemindPlugin.new -plugin.register("remind") -plugin.register("remind+") - diff --git a/lib/rbot/plugins/roshambo.rb b/lib/rbot/plugins/roshambo.rb deleted file mode 100644 index 4f20fb15..00000000 --- a/lib/rbot/plugins/roshambo.rb +++ /dev/null @@ -1,54 +0,0 @@ -# Play the game of roshambo (rock-paper-scissors) -# Copyright (C) 2004 Hans Fugal -# Distributed under the same license as rbot itself -require 'time' -class RoshamboPlugin < Plugin - def initialize - super - @scoreboard = {} - end - def help(plugin, topic="") - "roshambo <rock|paper|scissors> => play roshambo" - end - def privmsg(m) - # simultaneity - choice = choose - - # init scoreboard - if (not @scoreboard.has_key?(m.sourcenick) or (Time.now - @scoreboard[m.sourcenick]['timestamp']) > 3600) - @scoreboard[m.sourcenick] = {'me'=>0,'you'=>0,'timestamp'=>Time.now} - end - case m.params - when 'rock','paper','scissors' - s = score(choice,m.params) - @scoreboard[m.sourcenick]['timestamp'] = Time.now - myscore=@scoreboard[m.sourcenick]['me'] - yourscore=@scoreboard[m.sourcenick]['you'] - case s - when 1 - yourscore=@scoreboard[m.sourcenick]['you'] += 1 - m.reply "#{choice}. You win. Score: me #{myscore} you #{yourscore}" - when 0 - m.reply "#{choice}. We tie. Score: me #{myscore} you #{yourscore}" - when -1 - myscore=@scoreboard[m.sourcenick]['me'] += 1 - m.reply "#{choice}! I win! Score: me #{myscore} you #{yourscore}" - end - else - m.reply "incorrect usage: " + help(m.plugin) - end - end - - def choose - ['rock','paper','scissors'][rand(3)] - end - def score(a,b) - beats = {'rock'=>'scissors', 'paper'=>'rock', 'scissors'=>'paper'} - return -1 if beats[a] == b - return 1 if beats[b] == a - return 0 - end -end -plugin = RoshamboPlugin.new -plugin.register("roshambo") -plugin.register("rps") diff --git a/lib/rbot/plugins/rot13.rb b/lib/rbot/plugins/rot13.rb deleted file mode 100644 index 1f367dbd..00000000 --- a/lib/rbot/plugins/rot13.rb +++ /dev/null @@ -1,14 +0,0 @@ -class RotPlugin < Plugin - def help(plugin, topic="") - "rot13 <string> => encode <string> to rot13 or back" - end - def privmsg(m) - unless(m.params && m.params =~ /^.+$/) - m.reply "incorrect usage: " + help(m.plugin) - return - end - m.reply m.params.tr("A-Za-z", "N-ZA-Mn-za-m"); - end -end -plugin = RotPlugin.new -plugin.register("rot13") diff --git a/lib/rbot/plugins/roulette.rb b/lib/rbot/plugins/roulette.rb deleted file mode 100644 index c9d585ea..00000000 --- a/lib/rbot/plugins/roulette.rb +++ /dev/null @@ -1,147 +0,0 @@ -RouletteHistory = Struct.new("RouletteHistory", :games, :shots, :deaths, :misses, :wins) - -class RoulettePlugin < Plugin - def initialize - super - reload - end - def help(plugin, topic="") - "roulette => play russian roulette - starts a new game if one isn't already running. One round in a six chambered gun. Take turns to say roulette to the bot, until somebody dies. roulette reload => force the gun to reload, roulette stats => show stats from all games, roulette stats <player> => show stats for <player>, roulette clearstats => clear stats (config level auth required)" - end - def privmsg(m) - if m.params == "reload" - @bot.action m.replyto, "reloads" - reload - # all players win on a reload - # (allows you to play 3-shot matches etc) - @players.each {|plyr| - pdata = @registry[plyr] - next if pdata == nil - pdata.wins += 1 - @registry[plyr] = pdata - } - return - elsif m.params == "stats" - m.reply stats - return - elsif m.params =~ /^stats\s+(.+)$/ - m.reply(playerstats($1)) - return - elsif m.params == "clearstats" - if @bot.auth.allow?("config", m.source, m.replyto) - @registry.clear - m.okay - end - return - elsif m.params - m.reply "incorrect usage: " + help(m.plugin) - return - end - if m.private? - m.reply "you gotta play roulette in channel dude" - return - end - - playerdata = nil - if @registry.has_key?(m.sourcenick) - playerdata = @registry[m.sourcenick] - else - playerdata = RouletteHistory.new(0,0,0,0,0) - end - - unless @players.include?(m.sourcenick) - @players << m.sourcenick - playerdata.games += 1 - end - playerdata.shots += 1 - - shot = @chambers.pop - if shot - m.reply "#{m.sourcenick}: chamber #{6 - @chambers.length} of 6 => *BANG*" - playerdata.deaths += 1 - @players.each {|plyr| - next if plyr == m.sourcenick - pdata = @registry[plyr] - next if pdata == nil - pdata.wins += 1 - @registry[plyr] = pdata - } - else - m.reply "#{m.sourcenick}: chamber #{6 - @chambers.length} of 6 => +click+" - playerdata.misses += 1 - end - - @registry[m.sourcenick] = playerdata - - if shot || @chambers.empty? - @bot.action m.replyto, "reloads" - reload - end - end - def reload - @chambers = [false, false, false, false, false, false] - @chambers[rand(@chambers.length)] = true - @players = Array.new - end - def playerstats(player) - pstats = @registry[player] - return "#{player} hasn't played enough games yet" if pstats.nil? - return "#{player} has played #{pstats.games} games, won #{pstats.wins} and lost #{pstats.deaths}. #{player} pulled the trigger #{pstats.shots} times and found the chamber empty on #{pstats.misses} occasions." - end - def stats - total_players = 0 - total_games = 0 - total_shots = 0 - - died_most = [nil,0] - won_most = [nil,0] - h_win_percent = [nil,0] - l_win_percent = [nil,0] - h_luck_percent = [nil,0] - l_luck_percent = [nil,0] - @registry.each {|k,v| - total_players += 1 - total_games += v.deaths - total_shots += v.shots - - win_rate = v.wins.to_f / v.games * 100 - if h_win_percent[0].nil? || win_rate > h_win_percent[1] && v.games > 2 - h_win_percent = [[k], win_rate] - elsif win_rate == h_win_percent[1] && v.games > 2 - h_win_percent[0] << k - end - if l_win_percent[0].nil? || win_rate < l_win_percent[1] && v.games > 2 - l_win_percent = [[k], win_rate] - elsif win_rate == l_win_percent[1] && v.games > 2 - l_win_percent[0] << k - end - - luck = v.misses.to_f / v.shots * 100 - if h_luck_percent[0].nil? || luck > h_luck_percent[1] && v.games > 2 - h_luck_percent = [[k], luck] - elsif luck == h_luck_percent[1] && v.games > 2 - h_luck_percent[0] << k - end - if l_luck_percent[0].nil? || luck < l_luck_percent[1] && v.games > 2 - l_luck_percent = [[k], luck] - elsif luck == l_luck_percent[1] && v.games > 2 - l_luck_percent[0] << k - end - - if died_most[0].nil? || v.deaths > died_most[1] - died_most = [[k], v.deaths] - elsif v.deaths == died_most[1] - died_most[0] << k - end - if won_most[0].nil? || v.wins > won_most[1] - won_most = [[k], v.wins] - elsif v.wins == won_most[1] - won_most[0] << k - end - } - return "roulette stats: no games played yet" if total_games < 1 - return "roulette stats: #{total_games} games completed, #{total_shots} shots fired at #{total_players} players. Luckiest: #{h_luck_percent[0].join(',')} (#{sprintf '%.1f', h_luck_percent[1]}% clicks). Unluckiest: #{l_luck_percent[0].join(',')} (#{sprintf '%.1f', l_luck_percent[1]}% clicks). Highest survival rate: #{h_win_percent[0].join(',')} (#{sprintf '%.1f', h_win_percent[1]}%). Lowest survival rate: #{l_win_percent[0].join(',')} (#{sprintf '%.1f', l_win_percent[1]}%). Most wins: #{won_most[0].join(',')} (#{won_most[1]}). Most deaths: #{died_most[0].join(',')} (#{died_most[1]})." - end -end -plugin = RoulettePlugin.new -plugin.register("roulette") diff --git a/lib/rbot/plugins/seen.rb b/lib/rbot/plugins/seen.rb deleted file mode 100644 index 6bd86a70..00000000 --- a/lib/rbot/plugins/seen.rb +++ /dev/null @@ -1,89 +0,0 @@ -Saw = Struct.new("Saw", :nick, :time, :type, :where, :message) - -class SeenPlugin < Plugin - def help(plugin, topic="") - "seen <nick> => have you seen, or when did you last see <nick>" - end - - def privmsg(m) - unless(m.params =~ /^(\S)+$/) - m.reply "incorrect usage: " + help(m.plugin) - return - end - - m.params.gsub!(/\?$/, "") - - if @registry.has_key?(m.params) - m.reply seen(@registry[m.params]) - else - m.reply "nope!" - end - end - - def listen(m) - # keep database up to date with who last said what - if m.kind_of?(PrivMessage) - return if m.private? || m.address? - if m.action? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "ACTION", - m.target, m.message.dup) - else - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "PUBLIC", - m.target, m.message.dup) - end - elsif m.kind_of?(QuitMessage) - return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "QUIT", - nil, m.message.dup) - elsif m.kind_of?(NickMessage) - return if m.address? - @registry[m.message] = Saw.new(m.sourcenick.dup, Time.new, "NICK", - nil, m.message.dup) - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "NICK", - nil, m.message.dup) - elsif m.kind_of?(PartMessage) - return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "PART", - m.target, m.message.dup) - elsif m.kind_of?(JoinMessage) - return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "JOIN", - m.target, m.message.dup) - elsif m.kind_of?(TopicMessage) - return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "TOPIC", - m.target, m.message.dup) - end - end - - def seen(saw) - ret = "#{saw.nick} was last seen " - ago = Time.new - saw.time - - if (ago.to_i == 0) - ret += "just now, " - else - ret += Utils.secs_to_string(ago) + " ago, " - end - - case saw.type - when "PUBLIC" - ret += "saying #{saw.message}" - when "ACTION" - ret += "doing #{saw.nick} #{saw.message}" - when "NICK" - ret += "changing nick from #{saw.nick} to #{saw.message}" - when "PART" - ret += "leaving #{saw.where}" - when "JOIN" - ret += "joining #{saw.where}" - when "QUIT" - ret += "quiting IRC (#{saw.message})" - when "TOPIC" - ret += "changing the topic of #{saw.where} to #{saw.message}" - end - end - -end -plugin = SeenPlugin.new -plugin.register("seen") diff --git a/lib/rbot/plugins/slashdot.rb b/lib/rbot/plugins/slashdot.rb deleted file mode 100644 index b09ac7a7..00000000 --- a/lib/rbot/plugins/slashdot.rb +++ /dev/null @@ -1,95 +0,0 @@ -require 'rexml/document' -require 'uri/common' - -class SlashdotPlugin < Plugin - include REXML - def help(plugin, topic="") - "slashdot search <string> [<max>=4] => search slashdot for <string>, slashdot [<max>=4] => return up to <max> slashdot headlines (use negative max to return that many headlines, but all on one line.)" - end - def privmsg(m) - if m.params && m.params =~ /^search\s+(.*)\s+(\d+)$/ - search = $1 - limit = $2.to_i - search_slashdot m, search, limit - elsif m.params && m.params =~ /^search\s+(.*)$/ - search = $1 - search_slashdot m, search - elsif m.params && m.params =~ /^([-\d]+)$/ - limit = $1.to_i - slashdot m, limit - else - slashdot m - end - end - - def search_slashdot(m, search, max=4) - begin - xml = @bot.httputil.get(URI.parse("http://slashdot.org/search.pl?content_type=rss&query=#{URI.escape(search)}")) - rescue URI::InvalidURIError, URI::BadURIError => e - m.reply "illegal search string #{search}" - return - end - unless xml - m.reply "search for #{search} failed" - return - end - begin - doc = Document.new xml - rescue REXML::ParseException => e - puts e - m.reply "couldn't parse output XML: #{e.class}" - return - end - unless doc - m.reply "search for #{search} failed" - return - end - max = 8 if max > 8 - done = 0 - doc.elements.each("*/item") {|e| - desc = e.elements["title"].text - desc.gsub!(/(.{150}).*/, '\1..') - reply = sprintf("%s | %s", e.elements["link"].text, desc) - m.reply reply - done += 1 - break if done >= max - } - end - - def slashdot(m, max=4) - xml = @bot.httputil.get(URI.parse("http://slashdot.org/slashdot.xml")) - unless xml - m.reply "slashdot news parse failed" - return - end - doc = Document.new xml - unless doc - m.reply "slashdot news parse failed (invalid xml)" - return - end - done = 0 - oneline = false - if max < 0 - max = (0 - max) - oneline = true - end - max = 8 if max > 8 - matches = Array.new - doc.elements.each("*/story") {|e| - matches << [ e.elements["title"].text, - e.elements["author"].text, - e.elements["time"].text.gsub(/\d{4}-(\d{2})-(\d{2})/, "\\2/\\1").gsub(/:\d\d$/, "") ] - done += 1 - break if done >= max - } - if oneline - m.reply matches.collect{|mat| mat[0]}.join(" | ") - else - matches.each {|mat| - m.reply sprintf("%36s | %8s | %8s", mat[0][0,36], mat[1][0,8], mat[2]) - } - end - end -end -plugin = SlashdotPlugin.new -plugin.register("slashdot") diff --git a/lib/rbot/plugins/spell.rb b/lib/rbot/plugins/spell.rb deleted file mode 100644 index 81ee1ac6..00000000 --- a/lib/rbot/plugins/spell.rb +++ /dev/null @@ -1,36 +0,0 @@ -class SpellPlugin < Plugin - def help(plugin, topic="") - "spell <word> => check spelling of <word>, suggest alternatives" - end - def privmsg(m) - unless(m.params && m.params =~ /^\S+$/) - m.reply "incorrect usage: " + help(m.plugin) - return - end - p = IO.popen("ispell -a -S", "w+") - if(p) - p.puts m.params - p.close_write - p.each_line {|l| - if(l =~ /^\*/) - m.reply "#{m.params} may be spelled correctly" - return - elsif(l =~ /^\s*&.*: (.*)$/) - m.reply "#{m.params}: #$1" - return - elsif(l =~ /^\s*\+ (.*)$/) - m.reply "#{m.params} is presumably derived from " + $1.downcase - return - elsif(l =~ /^\s*#/) - m.reply "#{m.params}: no suggestions" - return - end - } - else - m.reply "couldn't exec ispell :(" - return - end - end -end -plugin = SpellPlugin.new -plugin.register("spell") diff --git a/lib/rbot/plugins/tube.rb b/lib/rbot/plugins/tube.rb deleted file mode 100644 index 77ca5227..00000000 --- a/lib/rbot/plugins/tube.rb +++ /dev/null @@ -1,77 +0,0 @@ -#Tube Status Enquiry plugin for rbot -#Plugin by Colm Linehan - -require 'rexml/document' -require 'uri/common' - -class TubePlugin < Plugin - include REXML - def help(plugin, topic="") - "tube [district|circle|metropolitan|central|jubilee|bakerloo|waterloo_city|hammersmith_city|victoria|eastlondon|northern|piccadilly] => display tube service status for the specified line(Docklands Light Railway is not currently supported), tube stations => list tube stations (not lines) with problems" - end - def privmsg(m) - if m.params && m.params =~ /^stations$/ - check_stations m - elsif m.params && m.params =~ /^(.*)$/ - line = $1.downcase.capitalize - check_tube m, line - end - end - - def check_tube(m, line) - begin - tube_page = @bot.httputil.get(URI.parse("http://www.tfl.gov.uk/tfl/service_rt_tube.shtml"), 1, 1) - rescue URI::InvalidURIError, URI::BadURIError => e - m.reply "Cannot contact Tube Service Status page" - return - end - unless tube_page - m.reply "Cannot contact Tube Service Status page" - return - end - next_line = false - tube_page.each_line {|l| - next if l == "\r\n" - next if l == "\n" - if (next_line) - if (l =~ /^<tr valign=top> <td>\s*(.*)<\/td><\/tr>/i) - m.reply $1.split(/<[^>]+>| /i).join(" ") - return - else - m.reply "There are problems on the #{line} line, but I didn't understand the page format. You should check out http://www.tfl.gov.uk/tfl/service_rt_tube.shtml for more details." - return - end - end - next_line = true if (l =~ /class="#{line}"/i) - } - m.reply "No Problems on the #{line} line." - end - - def check_stations(m) - begin - tube_page = @bot.httputil.get(URI.parse("http://www.tfl.gov.uk/tfl/service_rt_tube.shtml")) - rescue URI::InvalidURIError, URI::BadURIError => e - m.reply "Cannot contact Tube Service Status page" - return - end - unless tube_page - m.reply "Cannot contact Tube Service Status page" - return - end - stations_array = Array.new - tube_page.each_line {|l| - if (l =~ /<tr valign=top> <td valign="middle" class="Station"><b>(.*)<\/b><\/td><\/tr>\s*/i) - stations_array.push $1 - end - } - if stations_array.empty? - m.reply "There are no station-specific announcements" - return - else - m.reply stations_array.join(", ") - return - end - end -end -plugin = TubePlugin.new -plugin.register("tube") diff --git a/lib/rbot/plugins/url.rb b/lib/rbot/plugins/url.rb deleted file mode 100644 index ed82d1c1..00000000 --- a/lib/rbot/plugins/url.rb +++ /dev/null @@ -1,98 +0,0 @@ -Url = Struct.new("Url", :channel, :nick, :time, :url) - -class UrlPlugin < Plugin - def initialize - super - @registry.set_default(Array.new) - end - def help(plugin, topic="") - "urls [<max>=4] => list <max> last urls mentioned in current channel, urls <channel> [<max>=4] => list <max> last urls mentioned in <channel>, urls search <regexp> => search for matching urls, urls search <channel> <regexp>, search for matching urls in channel <channel>" - end - def listen(m) - return unless m.kind_of?(PrivMessage) - return if m.address? - # TODO support multiple urls in one line - if m.message =~ /(f|ht)tps?:\/\// - if m.message =~ /((f|ht)tps?:\/\/.*?)(?:\s+|$)/ - url = Url.new(m.target, m.sourcenick, Time.new, $1) - list = @registry[m.target] - debug "#{list.length} urls so far" - if list.length > 50 - list.pop - end - debug "storing url #{url.url}" - list.unshift url - debug "#{list.length} urls now" - @registry[m.target] = list - end - end - end - def privmsg(m) - case m.params - when nil - if m.public? - urls m, m.target - else - m.reply "in a private message, you need to specify a channel name for urls" - end - when (/^(\d+)$/) - max = $1.to_i - if m.public? - urls m, m.target, max - else - m.reply "in a private message, you need to specify a channel name for urls" - end - when (/^(#.*?)\s+(\d+)$/) - channel = $1 - max = $2.to_i - urls m, channel, max - when (/^(#.*?)$/) - channel = $1 - urls m, channel - when (/^search\s+(#.*?)\s+(.*)$/) - channel = $1 - string = $2 - search m, channel, string - when (/^search\s+(.*)$/) - string = $1 - if m.public? - search m, m.target, string - else - m.reply "in a private message, you need to specify a channel name for urls" - end - else - m.reply "incorrect usage: " + help(m.plugin) - end - end - - def urls(m, channel, max=4) - max = 10 if max > 10 - max = 1 if max < 1 - list = @registry[channel] - if list.empty? - m.reply "no urls seen yet for channel #{channel}" - else - list[0..(max-1)].each do |url| - m.reply "[#{url.time.strftime('%Y/%m/%d %H:%M:%S')}] <#{url.nick}> #{url.url}" - end - end - end - - def search(m, channel, string, max=4) - max = 10 if max > 10 - max = 1 if max < 1 - regex = Regexp.new(string) - list = @registry[channel].find_all {|url| - regex.match(url.url) || regex.match(url.nick) - } - if list.empty? - m.reply "no matches for channel #{channel}" - else - list[0..(max-1)].each do |url| - m.reply "[#{url.time.strftime('%Y/%m/%d %H:%M:%S')}] <#{url.nick}> #{url.url}" - end - end - end -end -plugin = UrlPlugin.new -plugin.register("urls") diff --git a/lib/rbot/plugins/weather.rb b/lib/rbot/plugins/weather.rb deleted file mode 100644 index 3e4134e4..00000000 --- a/lib/rbot/plugins/weather.rb +++ /dev/null @@ -1,55 +0,0 @@ -class WeatherPlugin < Plugin - - def help(plugin, topic="") - "weather <ICAO> => display the current weather at the location specified by the ICAO code [Lookup your ICAO code at http://www.nws.noaa.gov/oso/siteloc.shtml] - this will also store the ICAO against your nick, so you can later just say \"weather\", weather => display the current weather at the location you last asked for" - end - - def initialize - super - # this plugin only wants to store strings - class << @registry - def store(val) - val - end - def restore(val) - val - end - end - @metar_cache = Hash.new - end - - def describe(m, where) - if @metar_cache.has_key?(where) && - Time.now - @metar_cache[where].date < 3600 - met = @metar_cache[where] - else - met = Utils.get_metar(where) - end - - if met - m.reply met.pretty_print - @metar_cache[where] = met - else - m.reply "couldn't find weather data for #{where}" - end - end - - def privmsg(m) - case m.params - when nil - if @registry.has_key?(m.sourcenick) - where = @registry[m.sourcenick] - describe(m,where) - else - m.reply "I don't know where #{m.sourcenick} is!" - end - when (/^(\S{4})$/) - where = $1 - @registry[m.sourcenick] = where - describe(m,where) - end - end - -end -plugin = WeatherPlugin.new -plugin.register("weather") diff --git a/lib/rbot/plugins/wserver.rb b/lib/rbot/plugins/wserver.rb deleted file mode 100644 index e1fe10bd..00000000 --- a/lib/rbot/plugins/wserver.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'net/http' -require 'uri' -Net::HTTP.version_1_2 - -class WserverPlugin < Plugin - def help(plugin, topic="") - "wserver <uri> => try and determine what webserver <uri> is using" - end - def privmsg(m) - unless(m.params && m.params =~ /^\S+$/) - m.reply "incorrect usage: " + help(m.plugins) - return - end - - redirect_count = 0 - hostname = m.params.dup - hostname = "http://#{hostname}" unless hostname =~ /:\/\// - begin - if(redirect_count > 3) - m.reply "cowardly refusing to follow more than 3 redirects" - return - end - - begin - uri = URI.parse(hostname) - rescue URI::InvalidURIError => err - m.reply "#{m.params} is not a valid URI" - return - end - - unless(uri) - m.reply "incorrect usage: " + help(m.plugin) - return - end - - http = @bot.httputil.get_proxy(uri) - http.open_timeout = 5 - - http.start {|http| - resp = http.head('/') - server = resp['Server'] - if(server && server.length > 0) - m.reply "#{uri.host} is running #{server}" - else - m.reply "couldn't tell what #{uri.host} is running" - end - - if(resp.code == "302" || resp.code == "301") - newloc = resp['location'] - newuri = URI.parse(newloc) - # detect and ignore incorrect redirects (to relative paths etc) - if (newuri.host != nil) - if(uri.host != newuri.host) - m.reply "#{uri.host} redirects to #{newuri.scheme}://#{newuri.host}" - raise resp['location'] - end - end - end - } - rescue TimeoutError => err - m.reply "timed out connecting to #{uri.host}:#{uri.port} :(" - return - rescue RuntimeError => err - redirect_count += 1 - hostname = err.message - retry - rescue StandardError => err - puts err - m.reply "couldn't connect to #{uri.host}:#{uri.port} :(" - return - end - end -end -plugin = WserverPlugin.new -plugin.register("wserver") |