| ... |
... |
@@ -671,6 +671,8 @@ class Connection(CommonConnection, ConnectionHandlers): |
|
671
|
671
|
self.try_connecting_for_foo_secs = 45
|
|
672
|
672
|
# holds the actual hostname to which we are connected
|
|
673
|
673
|
self.connected_hostname = None
|
|
|
674
|
+ # Holds the full jid we received on the bind event
|
|
|
675
|
+ self.registered_name = None
|
|
674
|
676
|
self.redirected = None
|
|
675
|
677
|
self.last_time_to_reconnect = None
|
|
676
|
678
|
self.new_account_info = None
|
| ... |
... |
@@ -754,19 +756,16 @@ class Connection(CommonConnection, ConnectionHandlers): |
|
754
|
756
|
def check_jid(self, jid):
|
|
755
|
757
|
return helpers.parse_jid(jid)
|
|
756
|
758
|
|
|
757
|
|
- def get_own_jid(self, full=False):
|
|
|
759
|
+ def get_own_jid(self):
|
|
758
|
760
|
"""
|
|
759
|
|
- Return our own jid as JID
|
|
760
|
|
- If full = True, this raises an exception if we cant provide
|
|
761
|
|
- the full JID
|
|
|
761
|
+ Return the last full JID we received on a bind event.
|
|
|
762
|
+ In case we were never connected it returns the bare JID from config.
|
|
762
|
763
|
"""
|
|
763
|
|
- if self.connection:
|
|
764
|
|
- full_jid = self.connection._registered_name
|
|
765
|
|
- return nbxmpp.JID(full_jid)
|
|
|
764
|
+ if self.registered_name:
|
|
|
765
|
+ # This returns the full jid we received on the bind event
|
|
|
766
|
+ return self.registered_name
|
|
766
|
767
|
else:
|
|
767
|
|
- if full:
|
|
768
|
|
- raise exceptions.GajimGeneralException(
|
|
769
|
|
- 'We are not connected, full JID unknown.')
|
|
|
768
|
+ # This returns the bare jid
|
|
770
|
769
|
return nbxmpp.JID(gajim.get_jid_from_account(self.name))
|
|
771
|
770
|
|
|
772
|
771
|
def reconnect(self):
|
| ... |
... |
@@ -1465,6 +1464,7 @@ class Connection(CommonConnection, ConnectionHandlers): |
|
1465
|
1464
|
return
|
|
1466
|
1465
|
if hasattr(con, 'Resource'):
|
|
1467
|
1466
|
self.server_resource = con.Resource
|
|
|
1467
|
+ self.registered_name = con._registered_name
|
|
1468
|
1468
|
if gajim.config.get_per('accounts', self.name, 'anonymous_auth'):
|
|
1469
|
1469
|
# Get jid given by server
|
|
1470
|
1470
|
old_jid = gajim.get_jid_from_account(self.name)
|