def writeImInfo(oriSortedUuidList,curSortedUuidList,langStr): #init simf localeStr=convertLangToLocale(langStr) simf.init() simf.readcache(localeStr) #deal with disabled im for uuid in oriSortedUuidList: if uuid not in curSortedUuidList: simf.disableim(uuid,"flush",localeStr) #deal with enabled im for uuid in curSortedUuidList: simf.setmaxpri(uuid,"flush",localeStr)
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
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