From f4f70d22f1d29d24b7234e9a6fb3203deec5adfa Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 10 Sep 2006 01:38:04 +0200 Subject: [PATCH] Remove old bots implementation. I'm going to rewrite this. --- sugar/bots.py | 37 ------------------------ tests/bots/bots.activity | 2 -- tests/{bots => simulator}/LICENSE | 0 tests/{bots => simulator}/bots.py | 0 tests/{bots => simulator}/chaitanya.jpg | Bin tests/{bots => simulator}/kiu.jpg | Bin tests/{bots => simulator}/penelope.jpg | Bin 7 files changed, 39 deletions(-) delete mode 100644 sugar/bots.py delete mode 100644 tests/bots/bots.activity rename tests/{bots => simulator}/LICENSE (100%) rename tests/{bots => simulator}/bots.py (100%) rename tests/{bots => simulator}/chaitanya.jpg (100%) rename tests/{bots => simulator}/kiu.jpg (100%) rename tests/{bots => simulator}/penelope.jpg (100%) diff --git a/sugar/bots.py b/sugar/bots.py deleted file mode 100644 index edc189d7..00000000 --- a/sugar/bots.py +++ /dev/null @@ -1,37 +0,0 @@ -import random -import base64 - -from sugar.presence import Service -from sugar.presence import Buddy -from sugar.presence import PresenceService -from sugar.p2p import Stream - -class Bot: - def __init__(self, nick, icon_path): - self._nick = nick - self._icon_path = icon_path - - def start(self): - fd = open(self._icon_path, "r") - self._icon = fd.read() - fd.close() - - # Our presence service - port = random.randint(40000, 65000) - properties = {} - self._service = Service.Service(self._nick, Buddy.PRESENCE_SERVICE_TYPE, - domain="", address=None, port=port, properties=properties) - - self._icon_stream = Stream.Stream.new_from_service(self._service) - self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon") - - # Announce ourselves to the world - self._pservice = PresenceService.PresenceService.get_instance() - self._pservice.start() - self._pservice.register_service(self._service) - - def _handle_buddy_icon_request(self): - """XMLRPC method, return the owner's icon encoded with base64.""" - if self._icon: - return base64.b64encode(self._icon) - return "" diff --git a/tests/bots/bots.activity b/tests/bots/bots.activity deleted file mode 100644 index fe18e11f..00000000 --- a/tests/bots/bots.activity +++ /dev/null @@ -1,2 +0,0 @@ -[Activity] -python_class = bots diff --git a/tests/bots/LICENSE b/tests/simulator/LICENSE similarity index 100% rename from tests/bots/LICENSE rename to tests/simulator/LICENSE diff --git a/tests/bots/bots.py b/tests/simulator/bots.py similarity index 100% rename from tests/bots/bots.py rename to tests/simulator/bots.py diff --git a/tests/bots/chaitanya.jpg b/tests/simulator/chaitanya.jpg similarity index 100% rename from tests/bots/chaitanya.jpg rename to tests/simulator/chaitanya.jpg diff --git a/tests/bots/kiu.jpg b/tests/simulator/kiu.jpg similarity index 100% rename from tests/bots/kiu.jpg rename to tests/simulator/kiu.jpg diff --git a/tests/bots/penelope.jpg b/tests/simulator/penelope.jpg similarity index 100% rename from tests/bots/penelope.jpg rename to tests/simulator/penelope.jpg