2006-05-29 21:57:39 +02:00
|
|
|
from common import zeroconf
|
|
|
|
|
|
|
|
class Roster:
|
|
|
|
def __init__(self, zeroconf):
|
|
|
|
self._data = {}
|
|
|
|
self.zeroconf = zeroconf # our zeroconf instance
|
|
|
|
|
|
|
|
def getRoster(self):
|
|
|
|
print 'getRoster in Roster'
|
|
|
|
self._data = self.zeroconf.get_contacts()
|
|
|
|
return self
|
|
|
|
|
|
|
|
def getItem(self, jid):
|
|
|
|
print 'getItem(%s) in Roster' % jid
|
|
|
|
if self._data.has_key(jid):
|
|
|
|
return self._data[jid]
|
|
|
|
|
2006-05-31 01:13:36 +02:00
|
|
|
def setItem(self, item):
|
|
|
|
print 'setItem in Roster: jid: %s' % item
|
|
|
|
# data is maybe not already resolved
|
|
|
|
# what data is expected here?
|
|
|
|
self._data[item] = self.zeroconf.get_contact(item)
|
|
|
|
|
2006-05-29 21:57:39 +02:00
|
|
|
def __getitem__(self,item):
|
|
|
|
print '__getitem__ in Roster'
|
|
|
|
return self._data[item]
|
|
|
|
|
|
|
|
def getRaw(self):
|
2006-05-30 00:17:13 +02:00
|
|
|
print 'getRaw in Roster'
|
2006-05-29 21:57:39 +02:00
|
|
|
return self._data
|
|
|
|
|
|
|
|
def getResources(self, jid):
|
|
|
|
print 'getResources(%s) in Roster' % jid
|
|
|
|
# return self
|
|
|
|
|
|
|
|
'''
|
|
|
|
delItem(jid)
|
|
|
|
getStatus(jid)
|
|
|
|
getPriority(jid)
|
|
|
|
getShow(jid)
|
|
|
|
'''
|