~m4v/+junk/Urldb

« back to all changes in this revision

Viewing changes to plugin.py

  • Committer: Elián Hanisch
  • Date: 2010-08-17 23:02:21 UTC
  • Revision ID: lambdae2@gmail.com-20100817230221-at2hopy04ikw8fwv
tweak

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
urlre = re.compile(urlre, re.I)
84
84
 
85
85
 
86
 
import os
87
 
path = conf.supybot.directories.data()
88
 
filename = os.path.join(path, 'Urldb.sqlite.db')
89
 
db = create_database('sqlite:%s' %filename)
90
 
global store
91
 
store = Store(db)
92
 
try:
93
 
    store.execute(urls_schema)
94
 
    store.execute(others_schema)
95
 
    store.commit()
96
 
except:
97
 
    pass
98
 
 
99
 
 
100
86
def makePattern(p):
101
87
    s = ''
102
88
    for c in p:
117
103
    """Add the help for "@plugin help Urldb" here
118
104
    This should describe *how* to use this plugin."""
119
105
 
 
106
    def __init__(self, irc):
 
107
        self.__parent = super(Urldb, self)
 
108
        self.__parent.__init__(irc)
 
109
        import os
 
110
        path = conf.supybot.directories.data()
 
111
        filename = os.path.join(path, 'Urldb.sqlite.db')
 
112
        db = create_database('sqlite:%s' %filename)
 
113
        global store
 
114
        store = Store(db)
 
115
        try:
 
116
            store.execute(urls_schema)
 
117
            store.execute(others_schema)
 
118
            store.commit()
 
119
        except:
 
120
            pass
 
121
 
120
122
    def die(self):
121
123
        store.commit()
122
 
 #       store.close()
 
124
        store.close()
123
125
 
124
126
    def doPrivmsg(self, irc, msg):
125
127
        channel = msg.args[0]