mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Updated not to depend on the old ircdb.
This commit is contained in:
parent
21ef041a58
commit
92a7ae1028
@ -4,23 +4,22 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) != 3:
|
||||||
sys.stderr.write('Usage: %s <users file> <channels file>\n')
|
sys.stderr.write('Usage: %s <users file> <channels file>\n')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
(userFile, channelFile) = sys.argv[1:]
|
|
||||||
|
|
||||||
import supybot
|
import supybot
|
||||||
|
import fix
|
||||||
|
|
||||||
import conf
|
(userFile, channelFile) = sys.argv[1:]
|
||||||
conf.supybot.directories.conf.setValue('.')
|
|
||||||
conf.supybot.databases.users.filename.setValue(userFile)
|
class IrcUser:
|
||||||
conf.supybot.databases.channels.filename.setValue(channelFile)
|
def __init__(self, **kwargs):
|
||||||
|
self.__dict__.update(kwargs)
|
||||||
|
|
||||||
import log
|
UserCapabilitySet = list
|
||||||
conf.supybot.log.stdout.setValue(False)
|
CapabilitySet = list
|
||||||
|
|
||||||
import ircdb
|
|
||||||
|
|
||||||
def write(fd, s):
|
def write(fd, s):
|
||||||
fd.write(s)
|
fd.write(s)
|
||||||
@ -30,9 +29,12 @@ if __name__ == '__main__':
|
|||||||
shutil.copy(userFile, userFile + '.bak')
|
shutil.copy(userFile, userFile + '.bak')
|
||||||
shutil.copy(channelFile, channelFile + '.bak')
|
shutil.copy(channelFile, channelFile + '.bak')
|
||||||
# Users.conf.
|
# Users.conf.
|
||||||
|
fd = file(userFile)
|
||||||
|
s = fd.read().strip()
|
||||||
|
(_, L) = eval(s, locals(), globals())
|
||||||
fd = file(userFile, 'w')
|
fd = file(userFile, 'w')
|
||||||
for (i, u) in enumerate(ircdb.users.users):
|
for (i, u) in enumerate(L):
|
||||||
if u is None:
|
if i == 0 or u is None:
|
||||||
continue
|
continue
|
||||||
write(fd, 'user %s' % i)
|
write(fd, 'user %s' % i)
|
||||||
write(fd, ' name %s' % u.name)
|
write(fd, ' name %s' % u.name)
|
||||||
@ -53,8 +55,11 @@ if __name__ == '__main__':
|
|||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
# Channels.conf.
|
# Channels.conf.
|
||||||
|
fd = file(channelFile)
|
||||||
|
s = fd.read().strip()
|
||||||
|
d = eval(s, locals(), globals())
|
||||||
fd = file(channelFile, 'w')
|
fd = file(channelFile, 'w')
|
||||||
for (name, c) in ircdb.channels.iteritems():
|
for (name, c) in d.iteritems():
|
||||||
write(fd, 'channel %s' % name)
|
write(fd, 'channel %s' % name)
|
||||||
write(fd, ' defaultAllow %s' % c.defaultAllow)
|
write(fd, ' defaultAllow %s' % c.defaultAllow)
|
||||||
write(fd, ' lobotomized %s' % c.lobotomized)
|
write(fd, ' lobotomized %s' % c.lobotomized)
|
||||||
|
Loading…
Reference in New Issue
Block a user