* added one table in logs.db to save roster
* added "roster_version" in configuration to save roster version for the account * added "ver" attribute when gajim requests the roster
This commit is contained in:
parent
a3153f2403
commit
9133960fbc
|
@ -96,6 +96,12 @@ def create_log_db():
|
|||
jid_id INTEGER PRIMARY KEY UNIQUE,
|
||||
time INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS roster_entry(
|
||||
account_jid_id INTEGER PRIMARY KEY,
|
||||
jid_id INTEGER,
|
||||
subscription INTEGER
|
||||
);
|
||||
'''
|
||||
)
|
||||
|
||||
|
|
|
@ -342,6 +342,7 @@ class Config:
|
|||
'ignore_unknown_contacts': [ opt_bool, False ],
|
||||
'send_os_info': [ opt_bool, True ],
|
||||
'log_encrypted_sessions': [opt_bool, True, _('When negotiating an encrypted session, should Gajim assume you want your messages to be logged?')],
|
||||
'roster_version': [opt_str, ''],
|
||||
}, {}),
|
||||
'statusmsg': ({
|
||||
'message': [ opt_str, '' ],
|
||||
|
|
|
@ -1164,7 +1164,9 @@ class ConnectionVcard:
|
|||
if iq_obj.getErrorCode() not in ('403', '406', '404'):
|
||||
self.private_storage_supported = False
|
||||
# We can now continue connection by requesting the roster
|
||||
self.connection.initRoster()
|
||||
version = gajim.config.get_per('accounts', self.name,
|
||||
'roster_version')
|
||||
self.connection.initRoster(version=version)
|
||||
elif self.awaiting_answers[id_][0] == PRIVACY_ARRIVED:
|
||||
if iq_obj.getType() != 'error':
|
||||
self.privacy_rules_supported = True
|
||||
|
|
|
@ -671,4 +671,29 @@ class OptionsParser:
|
|||
gajim.config.set_per('soundevents', evt, 'path', path)
|
||||
gajim.config.set('version', '0.12.1.5')
|
||||
|
||||
def update_config_to_01216(self):
|
||||
back = os.getcwd()
|
||||
os.chdir(logger.LOG_DB_FOLDER)
|
||||
con = sqlite.connect(logger.LOG_DB_FILE)
|
||||
os.chdir(back)
|
||||
cur = con.cursor()
|
||||
try:
|
||||
cur.executescript(
|
||||
'''
|
||||
CREATE TABLE IF NOT EXISTS roster_entry(
|
||||
account_jid_id INTEGER PRIMARY KEY,
|
||||
jid_id INTEGER,
|
||||
subscription INTEGER
|
||||
);
|
||||
'''
|
||||
)
|
||||
con.commit()
|
||||
except sqlite.OperationalError:
|
||||
pass
|
||||
con.close()
|
||||
gajim.config.set('version', '0.12.1.6')
|
||||
|
||||
|
||||
|
||||
|
||||
# vim: se ts=3:
|
||||
|
|
|
@ -503,10 +503,10 @@ class NonBlockingClient:
|
|||
self.NonBlockingBind.NonBlockingBind(self._Resource, self._on_sasl_auth)
|
||||
return True
|
||||
|
||||
def initRoster(self):
|
||||
def initRoster(self, version=''):
|
||||
''' Plug in the roster. '''
|
||||
if not self.__dict__.has_key('NonBlockingRoster'):
|
||||
roster_nb.NonBlockingRoster.get_instance().PlugIn(self)
|
||||
roster_nb.NonBlockingRoster.get_instance(version=version).PlugIn(self)
|
||||
|
||||
def getRoster(self, on_ready=None):
|
||||
''' Return the Roster instance, previously plugging it in and
|
||||
|
|
|
@ -36,9 +36,10 @@ class NonBlockingRoster(PlugIn):
|
|||
You can also use mapping interface for access to the internal representation of
|
||||
contacts in roster.
|
||||
'''
|
||||
def __init__(self):
|
||||
def __init__(self, version=''):
|
||||
''' Init internal variables. '''
|
||||
PlugIn.__init__(self)
|
||||
self.version = version
|
||||
self._data = {}
|
||||
self.set=None
|
||||
self._exported_methods=[self.getRoster]
|
||||
|
@ -48,7 +49,10 @@ class NonBlockingRoster(PlugIn):
|
|||
(or if the 'force' argument is set). '''
|
||||
if self.set is None: self.set=0
|
||||
elif not force: return
|
||||
self._owner.send(Iq('get',NS_ROSTER))
|
||||
|
||||
iq = Iq('get',NS_ROSTER)
|
||||
iq.setTagAttr('query', 'ver', self.version)
|
||||
self._owner.send(iq)
|
||||
log.info('Roster requested from server')
|
||||
|
||||
def RosterIqHandler(self,dis,stanza):
|
||||
|
|
Loading…
Reference in New Issue