Commit 60182967 authored by Philipp Hörist's avatar Philipp Hörist

Reduce usage of the server_resource variable

parent 7aab19fb
......@@ -1247,8 +1247,7 @@ class Connection(CommonConnection, ConnectionHandlers):
cfg_proxies = app.config.get_per('accounts', self.name,
'file_transfer_proxies')
our_jid = helpers.parse_jid(app.get_jid_from_account(self.name) + \
'/' + self.server_resource)
our_jid = self.get_own_jid()
testit = app.config.get_per('accounts', self.name,
'test_ft_proxies_on_startup')
if cfg_proxies:
......
......@@ -131,7 +131,7 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent):
if self.jingle_content.getAttr('creator') == 'initiator':
file_tag = desc.getTag('file')
self.file_props.sender = self.fjid
self.file_props.receiver = self.conn.get_module('Bytestream')._ft_get_our_jid()
self.file_props.receiver = self.conn.get_own_jid()
else:
file_tag = desc.getTag('file')
h = file_tag.getTag('hash')
......@@ -142,7 +142,7 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent):
file_info = self.conn.get_module('Jingle').get_file_info(
pjid, hash_=h, name=n, account=self.conn.name)
self.file_props.file_name = file_info['file-name']
self.file_props.sender = self.conn.get_module('Bytestream')._ft_get_our_jid()
self.file_props.sender = self.conn.get_own_jid()
self.file_props.receiver = self.fjid
self.file_props.type_ = 's'
for child in file_tag.getChildren():
......
......@@ -88,9 +88,7 @@ class JingleSession:
self.contents = {} # negotiated contents
self.connection = con # connection to use
# our full jid
self.ourjid = app.get_jid_from_account(self.connection.name)
if con.server_resource:
self.ourjid = self.ourjid + '/' + con.server_resource
self.ourjid = str(self.connection.get_own_jid())
self.peerjid = jid # jid we connect to
# jid we use as the initiator
self.initiator = self.ourjid if weinitiate else self.peerjid
......
......@@ -113,13 +113,6 @@ class Bytestream(BaseModule):
default=self._account, testit=testit)
raise nbxmpp.NodeProcessed
def _ft_get_our_jid(self):
if self._account == 'Local':
return app.get_jid_from_account(self._account)
our_jid = app.get_jid_from_account(self._account)
resource = self._con.server_resource
return our_jid + '/' + resource
def _ft_get_receiver_jid(self, file_props):
if self._account == 'Local':
return file_props.receiver.jid
......
......@@ -327,7 +327,7 @@ class RosterTooltip(StatusTable):
name=account_name,
show=connection.get_status(),
status=connection.status,
resource=connection.server_resource,
resource=connection.get_own_jid().getResource(),
priority=connection.priority)
contacts.append(contact)
......
......@@ -1839,9 +1839,7 @@ class RosterWindow:
if account not in app.groups:
app.groups[account] = {}
self_jid = app.get_jid_from_account(account)
if app.connections[account].server_resource:
self_jid += '/' + app.connections[account].server_resource
self_jid = str(app.connections[account].get_own_jid())
if account != app.ZEROCONF_ACC_NAME:
array[self_jid] = {'name': app.nicks[account],
'groups': ['self_contact'],
......@@ -2180,7 +2178,7 @@ class RosterWindow:
if account not in app.contacts.get_accounts():
return
child_iterA = self._get_account_iter(account, self.model)
self_resource = app.connections[account].server_resource
self_resource = app.connections[account].get_own_jid().getResource()
self_contact = app.contacts.get_contact(account,
app.get_jid_from_account(account), resource=self_resource)
if self_contact:
......@@ -2553,14 +2551,11 @@ class RosterWindow:
account = obj.conn.name
self_jid = app.get_jid_from_account(account)
if self_jid not in app.contacts.get_jid_list(account):
resource = ''
if app.connections[account].server_resource:
resource = app.connections[account].server_resource
sha = app.config.get_per('accounts', account, 'avatar_sha')
contact = app.contacts.create_contact(
jid=self_jid, account=account, name=app.nicks[account],
groups=['self_contact'], show='offline', sub='both',
ask='none', resource=resource, avatar_sha=sha)
ask='none', avatar_sha=sha)
app.contacts.add_contact(account, contact)
self.add_contact(self_jid, account)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment