def syncmessagesto_copy(self, dest, applyto): """Pass 2 of folder synchronization. Look for messages present in self but not in dest. If any, add them to dest.""" threads = [] dest_messagelist = dest.getmessagelist() for uid in self.getmessagelist().keys(): if uid < 0: # Ignore messages that pass 1 missed. continue if not uid in dest_messagelist: if self.suggeststhreads(): self.waitforthread() thread = InstanceLimitedThread(\ self.getcopyinstancelimit(), target = self.copymessageto, name = "Copy message %d from %s" % (uid, self.getvisiblename()), args = (uid, applyto)) thread.setDaemon(1) thread.start() threads.append(thread) else: self.copymessageto(uid, applyto, register = 0) for thread in threads: thread.join()
def syncmessagesto_copy(self, dest, applyto): """Pass 2 of folder synchronization. Look for messages present in self but not in dest. If any, add them to dest.""" threads = [] dest_messagelist = dest.getmessagelist() for uid in self.getmessagelist().keys(): if uid < 0: # Ignore messages that pass 1 missed. continue if not uid in dest_messagelist: if self.suggeststhreads(): self.waitforthread() thread = InstanceLimitedThread(\ self.getcopyinstancelimit(), target = self.copymessageto, name = "Copy message %d from %s" % (uid, self.getvisiblename()), args = (uid, applyto)) thread.setDaemon(1) thread.start() threads.append(thread) else: self.copymessageto(uid, applyto, register=0) for thread in threads: thread.join()
def syncmessagesto_neguid(self, dest, applyto): """Pass 1 of folder synchronization. Look for messages in self with a negative uid. These are messages in Maildirs that were not added by us. Try to add them to the dests, and once that succeeds, get the UID, add it to the others for real, add it to local for real, and delete the fake one.""" uidlist = [uid for uid in self.getmessagelist().keys() if uid < 0] threads = [] usethread = None if applyto != None: usethread = applyto[0] for uid in uidlist: if usethread and usethread.suggeststhreads(): usethread.waitforthread() thread = InstanceLimitedThread(\ usethread.getcopyinstancelimit(), target = self.syncmessagesto_neguid_msg, name = "New msg sync from %s" % self.getvisiblename(), args = (uid, dest, applyto)) thread.setDaemon(1) thread.start() threads.append(thread) else: self.syncmessagesto_neguid_msg(uid, dest, applyto, register = 0) for thread in threads: thread.join()
def syncmessagesto_neguid(self, dest, applyto): """Pass 1 of folder synchronization. Look for messages in self with a negative uid. These are messages in Maildirs that were not added by us. Try to add them to the dests, and once that succeeds, get the UID, add it to the others for real, add it to local for real, and delete the fake one.""" uidlist = [uid for uid in self.getmessagelist().keys() if uid < 0] threads = [] usethread = None if applyto != None: usethread = applyto[0] for uid in uidlist: if usethread and usethread.suggeststhreads(): usethread.waitforthread() thread = InstanceLimitedThread(\ usethread.getcopyinstancelimit(), target = self.syncmessagesto_neguid_msg, name = "New msg sync from %s" % self.getvisiblename(), args = (uid, dest, applyto)) thread.setDaemon(1) thread.start() threads.append(thread) else: self.syncmessagesto_neguid_msg(uid, dest, applyto, register=0) for thread in threads: thread.join()