Exemple #1
0
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
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
 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
Exemple #5
0
 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