def cache_maildir(mdir, cacheobj, F): #cacheobj.local = map(lambda x: cachefacade(message.selectBy(localuid=x[0], folder=F, connection=dbconn).getOne().remoteuid, flags(x[1].get_flags())), mdir.iteritems()) #map(lambda x: cacheobj.local.setdefault(message.selectBy(localuid=x[0], folder=F, connection=dbconn).getOne().remoteuid, flags(x[1].get_flags())), mdir.iteritems()) map(lambda x: cacheobj.local.setdefault(x[0], flags(x[1].get_flags())), mdir.iteritems()) return cacheobj
def cache_imap(imapcon, cacheobj, F): msgs = imapcon.fetch('1:%s' % imapcon.sstatus['current_folder']['EXISTS'], '(UID FLAGS)') #cacheobj.remote = map(lambda x: cachefacade(x['UID'], flags(x['FLAGS'])), msgs.itervalues()) map(lambda x: cacheobj.remote.setdefault(x['UID'], flags(x['FLAGS'])), msgs.itervalues()) return cacheobj
lm = cache.local.get(msg.localuid, None) if lm: #msg still exists, so remove from the cache to prevent processing again. del cache.local[msg.localuid] #grab the vitals for the remote copy rm = cache.remote.get(int(m), None) if rm: #msg still exists, so remove from cache to prevent processing again. del cache.remote[int(m)] if not lm or not rm: #either the remote or local copy is missing. place in purgatory #for further processing later #cache.purgatory[msg.content.hash] = ((lm and LOCAL) or (rm and REMOTE)), msg cache.purgatory[((lm and LOCAL) or (rm and REMOTE))].append(msg) else: mf = flags(msg.flags) #check to see if flags are any different. if mf != lm or mf != rm: cf = combine_flags(mf, lm, rm) if cf != lm: cache.lflagupdate[msg.localuid] = cf if cf != rm: cache.rflagupdate[m] = cf ''' if cache.local: #any messages left in cache.local are messages whose names we don't #recognize. possabilities for these messages include: #-new #-copy #-moved