Make sure DIMP.baseWindow is defined.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 18 Aug 2009 16:44:45 +0000 (10:44 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 18 Aug 2009 16:51:41 +0000 (10:51 -0600)
imp/js/compose-dimp.js
imp/js/fullmessage-dimp.js

index 1d40441..fe471ed 100644 (file)
@@ -26,7 +26,8 @@ var DimpCompose = {
 
     updateDraftsMailbox: function()
     {
-        if (DIMP.baseWindow.DimpBase &&
+        if (DIMP.baseWindow &&
+            DIMP.baseWindow.DimpBase &&
             DIMP.baseWindow.DimpBase.folder == DIMP.conf_compose.drafts_mbox) {
             DIMP.baseWindow.DimpBase.poll();
         }
@@ -36,7 +37,8 @@ var DimpCompose = {
     {
         if (DIMP.conf_compose.qreply) {
             this.closeQReply();
-        } else if (DIMP.baseWindow.DimpBase || DIMP.conf_compose.popup) {
+        } else if ((DIMP.baseWindow && DIMP.baseWindow.DimpBase) ||
+                   DIMP.conf_compose.popup) {
             DimpCore.closePopup();
         } else {
             DimpCore.redirect(DIMP.conf.URI_DIMP);
@@ -202,7 +204,7 @@ var DimpCompose = {
             // Use an AJAX submit here so that we can do javascript-y stuff
             // before having to close the window on success.
             params = c.serialize(true);
-            if (!DIMP.baseWindow.DimpBase) {
+            if (!DIMP.baseWindow || !DIMP.baseWindow.DimpBase) {
                 params.nonotify = true;
             }
             DimpCore.doAction('*' + DIMP.conf.URI_COMPOSE, params, null, this.uniqueSubmitCallback.bind(this));
@@ -231,7 +233,9 @@ var DimpCompose = {
                 this.updateDraftsMailbox();
 
                 if (d.action == 'save_draft') {
-                    if (DIMP.baseWindow.DimpBase && !DIMP.conf_compose.qreply) {
+                    if (DIMP.baseWindow &&
+                        DIMP.baseWindow.DimpBase &&
+                        !DIMP.conf_compose.qreply) {
                         DIMP.baseWindow.DimpCore.showNotifications(r.msgs);
                     }
                     if (DIMP.conf_compose.close_draft) {
@@ -242,7 +246,7 @@ var DimpCompose = {
 
             case 'send_message':
                 this.button_pressed = false;
-                if (DIMP.baseWindow.DimpBase) {
+                if (DIMP.baseWindow && DIMP.baseWindow.DimpBase) {
                     if (d.reply_type) {
                         DIMP.baseWindow.DimpBase.flag(d.reply_type == 'reply' ? '\\answered' : '$forwarded', true, { index: d.index, mailbox: d.reply_folder, noserver: true });
                     }
index c128682..129c0a9 100644 (file)
@@ -94,11 +94,13 @@ var DimpFullmessage = {
             case 'button_ham':
             case 'button_spam':
                 if (id == 'button_deleted') {
-                    DIMP.baseWindow.DimpBase.deleteMsg({ index: this.index, mailbox: this.mailbox });
-                } else {
-                    DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { index: this.index, mailbox: this.mailbox });
+                    if (DIMP.baseWindow && DIMP.baseWindow.DimpBase) {
+                        DIMP.baseWindow.DimpBase.deleteMsg({ index: this.index, mailbox: this.mailbox });
+                    } else {
+                        DIMP.baseWindow.DimpBase.reportSpam(id == 'button_spam', { index: this.index, mailbox: this.mailbox });
+                    }
+                    window.close();
                 }
-                window.close();
                 e.stop();
                 return;