prevent a TB when a jid is in mem but not in DB (is has been removed while gajim was running) fixes #3073
This commit is contained in:
parent
2beba33a4a
commit
3ba415dfea
|
@ -169,19 +169,21 @@ class Logger:
|
||||||
jid = jid.split('/', 1)[0] # remove the resource
|
jid = jid.split('/', 1)[0] # remove the resource
|
||||||
if jid in self.jids_already_in: # we already have jids in DB
|
if jid in self.jids_already_in: # we already have jids in DB
|
||||||
self.cur.execute('SELECT jid_id FROM jids WHERE jid=?', [jid])
|
self.cur.execute('SELECT jid_id FROM jids WHERE jid=?', [jid])
|
||||||
jid_id = self.cur.fetchone()[0]
|
row = self.cur.fetchone()
|
||||||
else: # oh! a new jid :), we add it now
|
if row:
|
||||||
if typestr == 'ROOM':
|
return row[0]
|
||||||
typ = constants.JID_ROOM_TYPE
|
# oh! a new jid :), we add it now
|
||||||
else:
|
if typestr == 'ROOM':
|
||||||
typ = constants.JID_NORMAL_TYPE
|
typ = constants.JID_ROOM_TYPE
|
||||||
self.cur.execute('INSERT INTO jids (jid, type) VALUES (?, ?)', (jid, typ))
|
else:
|
||||||
try:
|
typ = constants.JID_NORMAL_TYPE
|
||||||
self.con.commit()
|
self.cur.execute('INSERT INTO jids (jid, type) VALUES (?, ?)', (jid, typ))
|
||||||
except sqlite.OperationalError, e:
|
try:
|
||||||
print >> sys.stderr, str(e)
|
self.con.commit()
|
||||||
jid_id = self.cur.lastrowid
|
except sqlite.OperationalError, e:
|
||||||
self.jids_already_in.append(jid)
|
print >> sys.stderr, str(e)
|
||||||
|
jid_id = self.cur.lastrowid
|
||||||
|
self.jids_already_in.append(jid)
|
||||||
return jid_id
|
return jid_id
|
||||||
|
|
||||||
def convert_human_values_to_db_api_values(self, kind, show):
|
def convert_human_values_to_db_api_values(self, kind, show):
|
||||||
|
|
Loading…
Reference in New Issue