{
$imp_mailbox = IMP_Mailbox::singleton($mbox);
- $result = new stdClass;
- $result->folder = $mbox;
- $result->uids = $GLOBALS['imp_imap']->ob()->utils->toSequenceString($indices, array('mailbox' => true));
- $result->remove = intval($GLOBALS['prefs']->getValue('hide_deleted') ||
+ $del = new stdClass;
+ $del->folder = $mbox;
+ $del->uids = $GLOBALS['imp_imap']->ob()->utils->toSequenceString($indices, array('mailbox' => true));
+ $del->remove = intval($GLOBALS['prefs']->getValue('hide_deleted') ||
$GLOBALS['prefs']->getValue('use_trash'));
- $result->cacheid = $imp_mailbox->getCacheID($mbox);
+ $del->cacheid = $imp_mailbox->getCacheID($mbox);
+
+ $result = new stdClass;
+ $result->delete = $del;
/* Check if we need to update thread information. */
if (!$change && !$nothread) {
$result = _generateDeleteResult($mbox, $indices, $change);
// Need to manually set remove to true since we want to remove
// message from the list no matter the current pref settings.
- $result->remove = 1;
+ $result->delete->remove = 1;
}
// Update poll information for destination folder if necessary.
$result = _generateDeleteResult($mbox, $indices, $change);
// If result is non-zero, then we know the message has been removed
// from the current mailbox.
- $result->remove = 1;
+ $result->delete->remove = 1;
} elseif (!is_null($change)) {
$check_uidvalidity = true;
}
$result = _generateDeleteResult($mbox, $expunged, $change);
// Need to manually set remove to true since we want to remove
// message from the list no matter the current pref settings.
- $result->remove = 1;
+ $result->delete->remove = 1;
}
}
break;
} else if (this.folder != foldername) {
// Don't allow drag/drop to the current folder.
this.updateFlag(uids, '\\deleted', true);
- DimpCore.doAction('MoveMessage', this.viewport.addRequestParams({ tofld: foldername }), { uids: uids, callback: this._deleteCallback.bind(this) });
+ DimpCore.doAction('MoveMessage', this.viewport.addRequestParams({ tofld: foldername }), { uids: uids });
}
}
}
}
},
- _deleteCallback: function(r)
+ deleteCallback: function(r)
{
var search = null, uids = [], vs;
+ if (!r.delete) {
+ return;
+ }
+
this.loadingImg('viewport', false);
- r = r.response;
+ r = r.delete;
if (!r.uids || r.folder != this.folder) {
return;
}
// This needs to be synchronous Ajax if we are calling from a
// popup window because Mozilla will not correctly call the
// callback function if the calling window has been closed.
- DimpCore.doAction(type, this.viewport.addRequestParams(args), { uids: vs, callback: this._deleteCallback.bind(this), ajaxopts: { asynchronous: !(opts.uid && opts.mailbox) } });
+ DimpCore.doAction(type, this.viewport.addRequestParams(args), { uids: vs, ajaxopts: { asynchronous: !(opts.uid && opts.mailbox) } });
return vs;
}
/* Miscellaneous folder actions. */
purgeDeleted: function()
{
- DimpCore.doAction('PurgeDeleted', this.viewport.addRequestParams({}), { callback: this._deleteCallback.bind(this) });
+ DimpCore.doAction('PurgeDeleted', this.viewport.addRequestParams({}));
},
modifyPoll: function(folder, add)
};
DimpCore.onDoActionComplete = function(r) {
+ DimpBase.deleteCallback(r);
if (DimpBase.viewport) {
DimpBase.viewport.parseJSONResponse(r);
}