def setCustomerIDs(idslist): """ Set customers ID's list, called when ListContacts packet received from Central server. """ global _CustomersChangedCallback global _ContactsChangedCallback oldcustomers = contactsdb.customers() oldcontacts = contactsdb.contacts() contactsdb.set_customers(idslist) if _CustomersChangedCallback is not None: _CustomersChangedCallback(oldcustomers, contactsdb.customers()) if _ContactsChangedCallback is not None: _ContactsChangedCallback(oldcontacts, contactsdb.contacts())
def addCustomer(idurl): """ Add a new customer, call event handlers. """ global _CustomersChangedCallback global _ContactsChangedCallback oldcustomers = contactsdb.customers() oldcontacts = contactsdb.contacts() res = contactsdb.add_customer(idurl) if _CustomersChangedCallback is not None: _CustomersChangedCallback(oldcustomers, contactsdb.customers()) if _ContactsChangedCallback is not None: _ContactsChangedCallback(oldcontacts, contactsdb.contacts()) return res
def getCustomerNames(): """ Return a list of customers names: ['veselin', 'bob', 'alice', ...] """ return map(nameurl.GetName, contactsdb.customers())
def getCustomerIDs(): """ Return list of customers ID's. """ return contactsdb.customers()