No need to use presence service if it's all well known
This commit is contained in:
parent
23b6c1e98a
commit
0cd9d86310
@ -1,6 +1,3 @@
|
||||
import logging
|
||||
import random
|
||||
|
||||
from sugar.chat.GroupChat import GroupChat
|
||||
from sugar.presence.Service import Service
|
||||
import sugar.env
|
||||
@ -13,22 +10,6 @@ class MeshChat(GroupChat):
|
||||
def __init__(self):
|
||||
GroupChat.__init__(self)
|
||||
|
||||
self._pservice.connect('service-appeared', self._service_appeared_cb)
|
||||
self._pservice.track_service_type(MeshChat.SERVICE_TYPE)
|
||||
|
||||
self._publish()
|
||||
|
||||
service = self._pservice.get_service(MeshChat.SERVICE_TYPE)
|
||||
if service is not None:
|
||||
self._service_appeared_cb(self._pservice, None, service)
|
||||
|
||||
def _service_appeared_cb(self, pservice, buddy, service):
|
||||
if self._group_stream == None:
|
||||
if service.get_type() == MeshChat.SERVICE_TYPE:
|
||||
logging.debug('Mesh chat service appeared, setup the stream.')
|
||||
self._setup_stream(service)
|
||||
|
||||
def _publish(self):
|
||||
service = Service(sugar.env.get_nick_name(), MeshChat.SERVICE_TYPE,
|
||||
'local', MeshChat.SERVICE_ADDRESS, MeshChat.SERVICE_PORT)
|
||||
self._pservice.register_service(service)
|
||||
self._setup_stream(service)
|
||||
|
Loading…
Reference in New Issue
Block a user