some coding standards

This commit is contained in:
Yann Leboulanger 2010-01-13 10:35:52 +01:00
parent 9782c3f1c0
commit 3238e30359
2 changed files with 10 additions and 11 deletions

View File

@ -1647,8 +1647,8 @@ class Connection(CommonConnection, ConnectionHandlers):
p = common.xmpp.Presence(jid, 'unsubscribe') p = common.xmpp.Presence(jid, 'unsubscribe')
self.connection.send(p) self.connection.send(p)
def request_subscription(self, jid, msg = '', name = '', groups = [], def request_subscription(self, jid, msg='', name='', groups=[],
auto_auth = False, user_nick = ''): auto_auth=False, user_nick=''):
if not self.connection: if not self.connection:
return return
log.debug('subscription request for %s' % jid) log.debug('subscription request for %s' % jid)
@ -1660,7 +1660,7 @@ class Connection(CommonConnection, ConnectionHandlers):
infos['name'] = name infos['name'] = name
iq = common.xmpp.Iq('set', common.xmpp.NS_ROSTER) iq = common.xmpp.Iq('set', common.xmpp.NS_ROSTER)
q = iq.getTag('query') q = iq.getTag('query')
item = q.addChild('item', attrs = infos) item = q.addChild('item', attrs=infos)
for g in groups: for g in groups:
item.addChild('group').setData(g) item.addChild('group').setData(g)
self.connection.send(iq) self.connection.send(iq)

View File

@ -133,20 +133,20 @@ class ConnectionDisco:
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:
return return
if is_form: if is_form:
iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent) iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to=agent)
query = iq.getTag('query') query = iq.getTag('query')
info.setAttr('type', 'submit') info.setAttr('type', 'submit')
query.addChild(node = info) query.addChild(node=info)
self.connection.SendAndCallForResponse(iq, self._agent_registered_cb, self.connection.SendAndCallForResponse(iq, self._agent_registered_cb,
{'agent': agent}) {'agent': agent})
else: else:
# fixed: blocking # fixed: blocking
common.xmpp.features_nb.register(self.connection, agent, info, None) common.xmpp.features_nb.register(self.connection, agent, info, None)
def _discover(self, ns, jid, node = None, id_prefix = None): def _discover(self, ns, jid, node=None, id_prefix=None):
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:
return return
iq = common.xmpp.Iq(typ = 'get', to = jid, queryNS = ns) iq = common.xmpp.Iq(typ='get', to=jid, queryNS=ns)
if id_prefix: if id_prefix:
id_ = self.connection.getAnID() id_ = self.connection.getAnID()
iq.setID('%s%s' % (id_prefix, id_)) iq.setID('%s%s' % (id_prefix, id_))
@ -167,12 +167,11 @@ class ConnectionDisco:
frm = helpers.get_full_jid_from_iq(iq_obj) frm = helpers.get_full_jid_from_iq(iq_obj)
to = unicode(iq_obj.getAttr('to')) to = unicode(iq_obj.getAttr('to'))
id_ = unicode(iq_obj.getAttr('id')) id_ = unicode(iq_obj.getAttr('id'))
iq = common.xmpp.Iq(to = frm, typ = 'result', queryNS =\ iq = common.xmpp.Iq(to=frm, typ='result', queryNS=common.xmpp.NS_DISCO,
common.xmpp.NS_DISCO, frm = to) frm=to)
iq.setAttr('id', id_) iq.setAttr('id', id_)
query = iq.setTag('query') query = iq.setTag('query')
query.setAttr('node','http://gajim.org#' + gajim.version.split('-', query.setAttr('node','http://gajim.org#' + gajim.version.split('-', 1)[0])
1)[0])
for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI, for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI,
common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS): common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS):
feature = common.xmpp.Node('feature') feature = common.xmpp.Node('feature')