Show
Ignore:
Timestamp:
08/29/07 22:42:28 (15 months ago)
Author:
roidelapluie
Message:

Prevent a TB when a jid is in mem but not in DB (is has been removed while gajim was running). Fix #3073.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/common/logger.py

    r7829 r8595  
    170170                if jid in self.jids_already_in: # we already have jids in DB 
    171171                        self.cur.execute('SELECT jid_id FROM jids WHERE jid=?', [jid]) 
    172                         jid_id = self.cur.fetchone()[0] 
    173                 else: # oh! a new jid :), we add it now 
    174                         if typestr == 'ROOM': 
    175                                 typ = constants.JID_ROOM_TYPE 
    176                         else: 
    177                                 typ = constants.JID_NORMAL_TYPE 
    178                         self.cur.execute('INSERT INTO jids (jid, type) VALUES (?, ?)', (jid, typ)) 
    179                         try: 
    180                                 self.con.commit() 
    181                         except sqlite.OperationalError, e: 
    182                                 print >> sys.stderr, str(e) 
    183                         jid_id = self.cur.lastrowid 
    184                         self.jids_already_in.append(jid) 
     172                        row = self.cur.fetchone() 
     173                        if row: 
     174                                return row[0] 
     175                # oh! a new jid :), we add it now 
     176                if typestr == 'ROOM': 
     177                        typ = constants.JID_ROOM_TYPE 
     178                else: 
     179                        typ = constants.JID_NORMAL_TYPE 
     180                self.cur.execute('INSERT INTO jids (jid, type) VALUES (?, ?)', (jid, typ)) 
     181                try: 
     182                        self.con.commit() 
     183                except sqlite.OperationalError, e: 
     184                        print >> sys.stderr, str(e) 
     185                jid_id = self.cur.lastrowid 
     186                self.jids_already_in.append(jid) 
    185187                return jid_id 
    186188