From c04f0e97837dfc0c73defa3aaeada5c3848e2c59 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 16 May 2012 02:01:50 +0200 Subject: =?UTF-8?q?Prevent=20the=20rooms=20from=20going=20=E2=80=9Coffline?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a blacklist inside the roster that contains the bare JIDs of all the rooms ever joined in this session, so that no JID using this server will ever be shown as getting “offline”. If there is a cleaner way to do that (discriminating JIDs), I welcome it. --- src/roster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/roster.py') diff --git a/src/roster.py b/src/roster.py index 7f93c4b2..e1251024 100644 --- a/src/roster.py +++ b/src/roster.py @@ -19,6 +19,10 @@ from sleekxmpp.xmlstream.stanzabase import JID from sleekxmpp.exceptions import IqError class Roster(object): + + # MUC domains to blacklist from the contacts roster + blacklist = set() + def __init__(self): """ node: the RosterSingle from SleekXMPP @@ -103,7 +107,7 @@ class Roster(object): def jids(self): """List of the contact JIDS""" - return [key for key in self.__node.keys() if key not in self.__mucs and key != self.jid] + return [key for key in self.__node.keys() if JID(key).server not in self.blacklist and key != self.jid] def get_contacts(self): """ -- cgit v1.2.3