mirror of
https://github.com/Expand-sys/imapmove.com
synced 2025-12-15 13:02:13 +11:00
wijadwklnadw
This commit is contained in:
parent
cee97443f7
commit
240a62409e
2 changed files with 13 additions and 10 deletions
|
|
@ -62,15 +62,14 @@ async function grabIMAP(
|
||||||
if (source == undefined || dest == undefined) {
|
if (source == undefined || dest == undefined) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
let arr = source.list()
|
let arr = await source.list()
|
||||||
let arr2 = dest.list()
|
arr.forEach(async mailbox=>{
|
||||||
for(let boxes in arr){
|
let lock = await source.getMailboxLock(`${mailbox.path}`);
|
||||||
let lock = await source.getMailboxLock(`${boxes}`);
|
|
||||||
const folder = Date.now();
|
const folder = Date.now();
|
||||||
let parsed;
|
let parsed;
|
||||||
try {
|
try {
|
||||||
const { uid } = await source.fetchOne("*", { uid: true });
|
const { uid } = await source.fetchOne("*", { uid: true });
|
||||||
for (i = 1; i < uid; i++) {
|
for (let i = 1; i < uid; i++) {
|
||||||
try {
|
try {
|
||||||
let { meta, content } = await source.download(i);
|
let { meta, content } = await source.download(i);
|
||||||
await content.pipe(
|
await content.pipe(
|
||||||
|
|
@ -84,8 +83,13 @@ async function grabIMAP(
|
||||||
const buf = await Buffer.from(
|
const buf = await Buffer.from(
|
||||||
await fs.readFileSync(path.resolve(__dirname, "./" + id))
|
await fs.readFileSync(path.resolve(__dirname, "./" + id))
|
||||||
);
|
);
|
||||||
var destbox = arr2.find(a =>a.includes(`${boxes}`));
|
try{
|
||||||
await dest.append(`${destbox}`, buf);
|
await dest.mailboxCreate(mailbox.path)
|
||||||
|
} catch(e){
|
||||||
|
//punch sand
|
||||||
|
}
|
||||||
|
|
||||||
|
await dest.append(`${mailbox.path}`, buf);
|
||||||
fs.rmSync(path.resolve(__dirname, "./" + id));
|
fs.rmSync(path.resolve(__dirname, "./" + id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,9 +99,8 @@ async function grabIMAP(
|
||||||
} finally {
|
} finally {
|
||||||
lock.release();
|
lock.release();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
console.log(arr)
|
console.log(arr)
|
||||||
console.log(arr2)
|
|
||||||
await source.logout();
|
await source.logout();
|
||||||
await dest.logout();
|
await dest.logout();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const URL = "https://a.imapmove.com";
|
const URL = "http://localhost:40151";
|
||||||
const socket = io(URL, { autoConnect: true });
|
const socket = io(URL, { autoConnect: true });
|
||||||
|
|
||||||
export default socket;
|
export default socket;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue