2 # supybot-shipping - A Supybot plugin to track shipments
3 # Copyright (C) 2008 Ian Weller <ianweller@gmail.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 import supybot
.utils
as utils
21 from supybot
.commands
import *
22 import supybot
.plugins
as plugins
23 import supybot
.ircutils
as ircutils
24 import supybot
.callbacks
as callbacks
27 from xml
.dom
import minidom
32 class Shipping(callbacks
.Plugin
):
33 """Use "list shipping" to get the commands, then, for example, "ups
34 TRACKINGNUMBER" to get the latest information."""
36 _tracking_rss
= "http://www.shaftek.org/code/track2rss/track2rss.pl?type"+\
37 "=ups&tracking_number=%s"
39 def __init__(self
, irc
):
40 super(Shipping
, self
).__init
__(irc
)
42 def ups(self
, irc
, msg
, args
, number
):
45 Returns the latest tracking information for UPS tracking number
47 rss
= utils
.web
.getUrl(self
._tracking
_rss
% number
)
48 irc
.reply(str(len(rss
)))
49 print self
._tracking
_rss
% number
50 ups
= wrap(ups
, ['text'])
56 # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: