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 getContactIDs(): """ Return a list of all contacts - a union of suppliers, customers and correspondents. Sometimes we want to loop through all the IDs we make contact with. """ return contactsdb.contacts()