From 2552e1024fae78752378836ffdc0b9a33a41df68 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Wed, 14 May 2008 02:57:29 +0000 Subject: [PATCH] fixed dropped messages after initiating a tic-tac-toe game with a contact that doesn't support sessions --- src/common/connection_handlers.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index ad256e91f..54c16300a 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1777,11 +1777,17 @@ haven't received a thread_id yet and returns the session that we last sent a message to.''' sessions = self.sessions[jid].values() - no_threadid_sessions = filter(lambda s: not s.received_thread_id, sessions) - if no_threadid_sessions: - no_threadid_sessions.sort(key=lambda s: s.last_send) - return no_threadid_sessions[-1] + # sessions that we haven't received a thread ID in + idless = filter(lambda s: not s.received_thread_id, sessions) + + # filter out everything exceptthe default session type + chat_sessions = filter(lambda s: isinstance(s, ChatControlSession), idless) + + if chat_sessions: + # return the session that we last sent a message in + chat_sessions.sort(key=lambda s: s.last_send) + return chat_sessions[-1] else: return None