Exemplo n.º 1
0
def getImInfoDicWithLang(langStr,filter="enabled"):
    localeStr=convertLangToLocale(langStr)
    simf.init()
    simf.readcache(localeStr)
    imListStr=simf.listim(localeStr,filter)
    imList=imListStr.split(",")
    imInfoDic={}
    for uuid in imList:
        imInfoStr=simf.getinfo(uuid,localeStr)
        imInfo=imInfoStr.split(",")
        imInfoDic[uuid]=imInfo
        #covert pri from string to int
        imInfoDic[uuid][InfoPri]=int(imInfoDic[uuid][InfoPri],10)
    return imInfoDic
Exemplo n.º 2
0
def setUuidWithMaxPri(inputUuid,inputImInfoDic,langStr):
    uuidList=[]
    priList=[]
    if inputImInfoDic=={} or inputImInfoDic==None:
        maxPri=0
    else:
        uuidList=inputImInfoDic.keys()
        priList=[inputImInfoDic[uuid][InfoPri] for uuid in uuidList]
        maxPri=max(priList)
    if inputUuid not in uuidList:
        #get info of this im from simf and add this im's info in ImInfoDic 
        localeStr=convertLangToLocale(langStr)
        simf.init()
        simf.readcache(localeStr)
        imInfoStr=simf.getinfo(inputUuid,localeStr)
        imInfo=imInfoStr.split(",")
        inputImInfoDic[inputUuid]=imInfo
    inputImInfoDic[inputUuid][InfoPri]=maxPri+1
    return inputImInfoDic