Exemple #1
0
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())
Exemple #2
0
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
Exemple #3
0
def getCustomerNames():
    """
    Return a list of customers names: ['veselin', 'bob', 'alice', ...]
    """
    return map(nameurl.GetName, contactsdb.customers())
Exemple #4
0
def getCustomerIDs():
    """
    Return list of customers ID's.
    """
    return contactsdb.customers()