mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-10-18 18:07:25 +02:00
Let's make sure we give our users an id attribute.
This commit is contained in:
parent
dda6f9be4a
commit
f9a432c9ec
12
src/ircdb.py
12
src/ircdb.py
@ -577,6 +577,8 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
fd.close()
|
fd.close()
|
||||||
else:
|
else:
|
||||||
log.warning('UsersDictionary.flush called with no filename.')
|
log.warning('UsersDictionary.flush called with no filename.')
|
||||||
|
else:
|
||||||
|
log.debug('Not flushing UsersDictionary becuase of noFlush.')
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.flush()
|
self.flush()
|
||||||
@ -633,7 +635,9 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
if not isinstance(id, int):
|
if not isinstance(id, int):
|
||||||
# Must be a string. Get the UserId first.
|
# Must be a string. Get the UserId first.
|
||||||
id = self.getUserId(id)
|
id = self.getUserId(id)
|
||||||
return self.users[id]
|
u = self.users[id]
|
||||||
|
u.id = id
|
||||||
|
return u
|
||||||
|
|
||||||
def hasUser(self, id):
|
def hasUser(self, id):
|
||||||
"""Returns the database has a user given its id, name, or hostmask."""
|
"""Returns the database has a user given its id, name, or hostmask."""
|
||||||
@ -688,8 +692,7 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
raise ValueError, s
|
raise ValueError, s
|
||||||
self.invalidateCache(id)
|
self.invalidateCache(id)
|
||||||
self.users[id] = user
|
self.users[id] = user
|
||||||
# This shouldn't happen; we flush automatically every once in awhile.
|
self.flush()
|
||||||
#self.flush()
|
|
||||||
|
|
||||||
def delUser(self, id):
|
def delUser(self, id):
|
||||||
"""Removes a user from the database."""
|
"""Removes a user from the database."""
|
||||||
@ -711,6 +714,7 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
id = self.nextId
|
id = self.nextId
|
||||||
self.users[id] = user
|
self.users[id] = user
|
||||||
self.flush()
|
self.flush()
|
||||||
|
user.id = id
|
||||||
return (id, user)
|
return (id, user)
|
||||||
|
|
||||||
|
|
||||||
@ -747,6 +751,8 @@ class ChannelsDictionary(utils.IterableMap):
|
|||||||
fd.close()
|
fd.close()
|
||||||
else:
|
else:
|
||||||
log.warning('ChannelsDictionary.flush without self.filename.')
|
log.warning('ChannelsDictionary.flush without self.filename.')
|
||||||
|
else:
|
||||||
|
log.debug('Not flushing ChannelsDictionary because of noFlush.')
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.flush()
|
self.flush()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user