diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-22 03:49:37 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-06-22 03:49:37 (GMT) |
commit | 974ef81c1ed1f23dc208da019eb91242d2b65579 (patch) | |
tree | d22f08031079980113ee03d5e87450327401b4ce /sugar/chat/GroupChat.py | |
parent | e956f2259705acb7bc81060f7423cf4f2214f615 (diff) |
Get back mesh chat (for the everyone tab)
Diffstat (limited to 'sugar/chat/GroupChat.py')
-rw-r--r-- | sugar/chat/GroupChat.py | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/sugar/chat/GroupChat.py b/sugar/chat/GroupChat.py index 8f32ace..a269552 100644 --- a/sugar/chat/GroupChat.py +++ b/sugar/chat/GroupChat.py @@ -2,34 +2,15 @@ import logging from sugar.chat.Chat import Chat from sugar.p2p.Stream import Stream -from sugar.presence.PresenceService import PresenceService +from sugar.presence.PresenceService import PresenceService +import sugar.env class GroupChat(Chat): - SERVICE_TYPE = "_olpc_group_chat._udp" - SERVICE_PORT = 6200 - - def __init__(self, activity): + def __init__(self): Chat.__init__(self) - self._chats = {} - self._activity = activity - self._pservice = PresenceService.get_instance() - self._pservice.start() - self._pservice.connect('service-appeared', self._service_appeared_cb) - self._pservice.track_service_type(GroupChat.SERVICE_TYPE) - service = self._pservice.get_activity_service(activity, GroupChat.SERVICE_TYPE) - if service is not None: - self._service_appeared_cb(self._pservice, None, service) - - def _service_appeared_cb(self, pservice, buddy, service): - if service.get_activity_uid() == self._activity.get_id(): - if service.get_type() == GroupChat.SERVICE_TYPE: - logging.debug('Group chat service appeared, setup the stream.') - self._setup_stream(service) - - def publish(self): - service = self._pservice.share_activity(self._activity, - stype = GroupChat.SERVICE_TYPE, port = GroupChat.SERVICE_PORT) + self._pservice.start() + self._group_stream = None def _setup_stream(self, service): self._group_stream = Stream.new_from_service(service) |