def priorityComparator(resource, other): if resource.presence ^ other.presence: result = cmp(PRESENCES_ORDER.index(resource.presence), PRESENCES_ORDER.index(other.presence)) elif resource.priority ^ other.priority: result = cmp(other.priority, resource.priority) else: result = cmp(resource.name, other.name) return result
def priorityComparator(resItem, otherItem): resource = resItem[1] other = otherItem[1] if resource.presence ^ other.presence: result = cmp(PRESENCES_ORDER.index(resource.presence), PRESENCES_ORDER.index(other.presence)) elif resource.priority ^ other.priority: result = cmp(other.priority, resource.priority) else: result = 0 return result
def priorityComparator(resItem, otherItem): resource = resItem[1] other = otherItem[1] if resource.presence ^ other.presence: result = cmp(PRESENCES_ORDER.index(resource.presence), PRESENCES_ORDER.index(other.presence)) elif resource.priority ^ other.priority: result = cmp(other.priority, resource.priority) else: result = 0 return result
def __init__(self, priority = 0, message = 0, presence = PRESENCE.UNAVAILABLE, wgExts = None): super(Resource, self).__init__() self.priority = priority self.message = message self.presence = presence self.__wgExts = wgExts or WGExtsInfo(None, None, None) self.__order = PRESENCES_ORDER.index(self.presence) return
def __init__(self, priority = 0, message = 0, presence = PRESENCE.UNAVAILABLE, wgExts = None, mucInfo = None): super(Resource, self).__init__() self.priority = priority self.message = message self.presence = presence self.__wgExts = wgExts or WGExtsInfo(0, '', None, None, None) self.__mucInfo = mucInfo self.__order = PRESENCES_ORDER.index(self.presence) return