Disable the presence service. You can reenable it by just

changing the _ENABLE var to True.
This commit is contained in:
Marco Pesenti Gritti 2007-03-28 12:17:34 +02:00
parent 1037fe6ca4
commit bf805bfa2f
3 changed files with 75 additions and 10 deletions

View File

@ -89,11 +89,11 @@ class ShellOwner(gobject.GObject):
props = {'color': color.to_string(), 'icon-hash': self._icon_hash}
self._service = self._pservice.register_service(self._nick,
PRESENCE_SERVICE_TYPE, properties=props)
logging.debug("Owner '%s' using port %d" % (self._nick, self._service.get_port()))
#logging.debug("Owner '%s' using port %d" % (self._nick, self._service.get_port()))
self._icon_stream = Stream.Stream.new_from_service(self._service)
self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon")
self._icon_stream.register_reader_handler(self._handle_invite, "invite")
#self._icon_stream = Stream.Stream.new_from_service(self._service)
#self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon")
#self._icon_stream.register_reader_handler(self._handle_invite, "invite")
def _handle_buddy_icon_request(self):
"""XMLRPC method, return the owner's icon encoded with base64."""

View File

@ -51,7 +51,8 @@ class ActivityHost:
win = self._gdk_window
#self._chat_widget = ActivityChat.ActivityChat(self)
#self._chat_window = ActivityChatWindow(win, self._chat_widget)
self._chat_widget = gtk.HBox()
self._chat_window = ActivityChatWindow(win, self._chat_widget)
self._frame_was_visible = False

View File

@ -19,6 +19,8 @@ import dbus, dbus.glib, gobject
import Buddy, Service, Activity
_ENABLED = False
class ObjectCache(object):
def __init__(self):
self._cache = {}
@ -223,15 +225,77 @@ class PresenceService(gobject.GObject):
def unregister_service_type(self, stype):
self._ps.unregisterServiceType(stype)
class _MockPresenceService(gobject.GObject):
__gsignals__ = {
'buddy-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'buddy-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'service-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'service-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'activity-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'activity-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT]))
}
def __init__(self):
gobject.GObject.__init__(self)
def get_services(self):
return []
def get_services_of_type(self, stype):
return []
def get_activities(self):
return []
def get_activity(self, activity_id):
return None
def get_buddies(self):
return []
def get_buddy_by_name(self, name):
return None
def get_buddy_by_address(self, addr):
return None
def get_owner(self):
return None
def share_activity(self, activity, stype, properties={}, address=None, port=-1, domain=u"local"):
return None
def register_service(self, name, stype, properties={}, address=None, port=-1, domain=u"local"):
return None
def unregister_service(self, service):
pass
def register_service_type(self, stype):
pass
def unregister_service_type(self, stype):
pass
_ps = None
def get_instance():
global _ps
if not _ps:
_ps = PresenceService()
if _ENABLED:
_ps = PresenceService()
else:
_ps = _MockPresenceService()
return _ps
def start():
bus = dbus.SessionBus()
ps = dbus.Interface(bus.get_object(DBUS_SERVICE, DBUS_PATH), DBUS_INTERFACE)
ps.start()
if _ENABLED:
bus = dbus.SessionBus()
ps = dbus.Interface(bus.get_object(DBUS_SERVICE, DBUS_PATH), DBUS_INTERFACE)
ps.start()