get_to function in common/stanza_session.py returns wrong resource
get_to function in common/stanza_session.py in gajim is buggy:
Currently get_to looks like this:
def get_to(self):
to = str(self.jid)
if self.resource and not to.endswith(self.resource):
to += '/' + self.resource
return to
There are two problems related the resource:
If a user has set his resource to the end of the domain, such as user@example.com/le.com the if statement will not be true and the function will return user@example.com instead of user@example.com/le.com
There also appears to be another bug, where get_to will return something like:
user@example.com/16365608841372576689849576/1058193661372577120359216
where a new resource is added ontop of the old resource, more information about this problem can be found in this bug report: https://github.com/afflux/pure-python-otr/issues/37
A simple way to fix both of these problems is to rewrite the function like so:
def get_to(self):
to = str(self.jid)
to = to.split('/')[0] + '/' + self.resource
return to