Sugar.presence.presenceservice: Difference between revisions
Jump to navigation
Jump to search
(New page: = Class: PresenceService (gobject.GObject) = === How do I get a list of buddies that are presently available on my mesh network? === The PresenceService class has a helper method called ...) |
No edit summary |
||
| Line 3: | Line 3: | ||
=== How do I get a list of buddies that are presently available on my mesh network? === |
=== How do I get a list of buddies that are presently available on my mesh network? === |
||
The PresenceService class has a helper method called get_buddies() that will return a list of sugar.presence.buddy.Buddy objects. |
The PresenceService class has a helper method called get_buddies() that will return a list of sugar.presence.buddy.Buddy objects. The code below shows how you can get a list of available buddies and print out some relevant properties for each. |
||
<pre> |
<pre> |
||
from sugar.presence import presenceservice |
|||
... |
|||
#### Method: _print_buddy_info, which finds all the buddies detected for this |
|||
# XO and then prints their relevant properties. |
|||
def _print_buddy_info(self): |
|||
ps = presenceservice.PresenceService() |
|||
buddies = ps.get_buddies() |
|||
for currBuddy in buddies: |
|||
print '----------------------- ' + currBuddy.get_property('nick') + ': ' |
|||
print currBuddy.get_property('key') |
|||
print currBuddy.get_property('color') |
|||
print currBuddy.get_property('current-activity') |
|||
print currBuddy.get_property('owner') |
|||
print currBuddy.get_property('ip4-address') |
|||
print '' |
|||
</pre> |
</pre> |
||
Revision as of 18:49, 12 August 2008
Class: PresenceService (gobject.GObject)
How do I get a list of buddies that are presently available on my mesh network?
The PresenceService class has a helper method called get_buddies() that will return a list of sugar.presence.buddy.Buddy objects. The code below shows how you can get a list of available buddies and print out some relevant properties for each.
from sugar.presence import presenceservice
...
#### Method: _print_buddy_info, which finds all the buddies detected for this
# XO and then prints their relevant properties.
def _print_buddy_info(self):
ps = presenceservice.PresenceService()
buddies = ps.get_buddies()
for currBuddy in buddies:
print '----------------------- ' + currBuddy.get_property('nick') + ': '
print currBuddy.get_property('key')
print currBuddy.get_property('color')
print currBuddy.get_property('current-activity')
print currBuddy.get_property('owner')
print currBuddy.get_property('ip4-address')
print ''