Only broadcast and activity change if it actually changed

This commit is contained in:
Dan Williams 2006-09-24 21:31:48 -04:00
parent b67c0a6b3d
commit 701cef3f1d

View File

@ -11,6 +11,7 @@ class KiuBot(Bot):
self._olpc_channel_service = None self._olpc_channel_service = None
self._sugar_channel_service = None self._sugar_channel_service = None
self._activity_switch_timeout = None self._activity_switch_timeout = None
self._curact = None
action = ShareActivityAction('OLPC channel', action = ShareActivityAction('OLPC channel',
'_GroupChatActivity_Sugar_redhat_com._udp', '_GroupChatActivity_Sugar_redhat_com._udp',
@ -33,9 +34,11 @@ class KiuBot(Bot):
actid = self._sugar_channel_activity.get_id() actid = self._sugar_channel_activity.get_id()
else: else:
raise RuntimeError("WTF? unexpected value") raise RuntimeError("WTF? unexpected value")
print "KIU: now setting current activity to %s" % actid if actid != self._curact:
self._owner.set_current_activity(actid) print "KIU: now setting current activity to %s" % actid
self._schedule_activity_switch_timeout() self._owner.set_current_activity(actid)
self._schedule_activity_switch_timeout()
self._curact = actid
return False return False
def _schedule_activity_switch_timeout(self): def _schedule_activity_switch_timeout(self):