Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Taylor <bct@diffeq.com>2008-05-14 04:34:02 +0400
committerBrendan Taylor <bct@diffeq.com>2008-05-14 04:34:02 +0400
commitade56853fe6b7664552eb4707f8322d6950cb27d (patch)
treebc980adc0d35c38b47c7b1e34e4f8b8941676a3d
parentf8b12e3b6bdf4a9fd1fa4f63d43cc4c0520d6f40 (diff)
moved session.remove_events. fixes #3942
-rw-r--r--src/chat_control.py2
-rw-r--r--src/common/stanza_session.py20
-rw-r--r--src/session.py15
3 files changed, 21 insertions, 16 deletions
diff --git a/src/chat_control.py b/src/chat_control.py
index c669ba10d..a33548973 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -924,7 +924,7 @@ class ChatControlBase(MessageControl):
self.parent_win.get_active_control() == self and \
self.parent_win.window.is_active():
# we are at the end
- if not self.session.remove_events(types_list):
+ if self.session.remove_events(types_list):
# There were events to remove
self.redraw_after_event_removed(jid)
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index e45f10715..cd734a595 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -49,6 +49,26 @@ class StanzaSession(object):
return self.loggable and account not in no_log_for and self.jid not in no_log_for
+ # remove events associated with this session from the queue
+ # returns True if any events were removed (unlike gajim.events.remove_events)
+ def remove_events(self, types):
+ any_removed = False
+
+ for event in gajim.events.get_events(self.conn.name, self.jid, types=types):
+ # the event wasn't in this session
+ if (event.type_ == 'chat' and event.parameters[8] != self) or \
+ (event.type_ == 'printed_chat' and event.parameters[0] != self):
+ continue
+
+ # events.remove_events returns True when there were no events
+ # for some reason
+ r = gajim.events.remove_events(self.conn.name, self.jid, event)
+
+ if not r:
+ any_removed = True
+
+ return any_removed
+
def generate_thread_id(self):
return "".join([random.choice(string.ascii_letters) for x in xrange(0,32)])
diff --git a/src/session.py b/src/session.py
index 88e720485..b7debfeb6 100644
--- a/src/session.py
+++ b/src/session.py
@@ -26,21 +26,6 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
if self.control:
self.control.session = None
- # remove events associated with this session from the queue
- def remove_events(self, types):
- any_removed = False
-
- for event in gajim.events.get_events(self.conn, self.jid, types=types):
- if event.parameters[8] != self:
- continue
-
- r = gajim.events.remove_events(self.conn, self.jid, event)
-
- if not_any_removed:
- any_removed = r
-
- return any_removed
-
# extracts chatstate from a <message/> stanza
def get_chatstate(self, msg, msgtxt):
composing_xep = None