Reset the preferred private JID when all resources leave a room

For example if we are talking in private with nick Joe from
room #foo, and then we leave that room, we start receiving Joe’s
message from the server-wide JID

e2e tests included!!!
This commit is contained in:
louiz’
2016-06-10 10:00:48 +02:00
parent 7540f67933
commit 272c0e4995
3 changed files with 35 additions and 1 deletions
+12
View File
@@ -303,6 +303,7 @@ common_replacements = {
'jid_admin': 'admin@example.com',
'nick_two': 'Bobby',
'lower_nick_one': 'nick',
'lower_nick_two': 'bobby',
}
@@ -673,6 +674,17 @@ if __name__ == '__main__':
partial(send_stanza, "<message from='{jid_two}/{resource_one}' to='{lower_nick_one}!{irc_server_one}' type='chat'><body>re</body></message>"),
# The response is received from the in-room JID
partial(expect_stanza, "/message[@from='%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='re']"),
# Now we leave the room, to check if the subsequent private messages are still received properly
partial(send_stanza,
"<presence from='{jid_one}/{resource_one}' to='%{irc_server_one}/{nick_one}' type='unavailable' />"),
partial(expect_stanza,
"/presence[@type='unavailable']/muc_user:x/muc_user:status[@code='110']"),
# The private messages from this nick should now come (again) from the server-wide JID
partial(send_stanza, "<message from='{jid_two}/{resource_one}' to='{lower_nick_one}!{irc_server_one}' type='chat'><body>hihihoho</body></message>"),
partial(expect_stanza,
"/message[@from='{lower_nick_two}!{irc_server_one}'][@to='{jid_one}/{resource_one}']"),
]
)
)