Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorBenjamin Schwartz <bens@alum.mit.edu>2007-10-04 03:10:50 (GMT)
committer Benjamin Schwartz <bens@alum.mit.edu>2007-10-04 03:10:50 (GMT)
commit73e1a01b2926ed295926bdd5fefa92937d29fd43 (patch)
tree841a47a024a44d2697b569fe67bd9f1aeac9940e /activity.py
parent62fb8d0227bf8976b27afe8acbef155b7da37ce4 (diff)
Prevent more than two people from joining
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/activity.py b/activity.py
index d0776b0..006ccd4 100644
--- a/activity.py
+++ b/activity.py
@@ -239,17 +239,23 @@ class AcousticMeasureActivity(Activity):
return
# Find out who's already in the shared activity:
+ n = 0
for buddy in self._shared_activity.get_joined_buddies():
+ n += 1
self._logger.debug('Buddy %s is already in the activity' % buddy.props.nick)
- self._logger.debug('Joined an existing shared activity')
- self.initiating = False
- self._setup()
+ if n <= 2:
+ self._logger.debug('Joined an existing shared activity')
+ self.initiating = False
+ self._setup()
- self._logger.debug('This is not my activity: waiting for a tube...')
- self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
- reply_handler=self._list_tubes_reply_cb,
- error_handler=self._list_tubes_error_cb)
+ self._logger.debug('This is not my activity: waiting for a tube...')
+ self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
+ reply_handler=self._list_tubes_reply_cb,
+ error_handler=self._list_tubes_error_cb)
+ else:
+ self._logger.debug("There are already two people, not joining")
+ self._shared_activity.leave()
def _new_tube_cb(self, id, initiator, type, service, params, state):
self._logger.debug('New tube: ID=%d initator=%d type=%d service=%s '