summaryrefslogtreecommitdiffstats
path: root/mailnews/jsaccount/src/JaIncomingServer.h
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/jsaccount/src/JaIncomingServer.h
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/jsaccount/src/JaIncomingServer.h')
-rw-r--r--mailnews/jsaccount/src/JaIncomingServer.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/mailnews/jsaccount/src/JaIncomingServer.h b/mailnews/jsaccount/src/JaIncomingServer.h
new file mode 100644
index 000000000..5b0362324
--- /dev/null
+++ b/mailnews/jsaccount/src/JaIncomingServer.h
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef _JaIncomingServer_H_
+#define _JaIncomingServer_H_
+
+#include "DelegateList.h"
+#include "msgIOverride.h"
+#include "nsMsgIncomingServer.h"
+#include "nsAutoPtr.h"
+#include "nsDataHashtable.h"
+#include "nsIInterfaceRequestor.h"
+
+// This file specifies the definition of nsIMsgIncomingServer.idl objects
+// in the JsAccount system.
+
+namespace mozilla {
+namespace mailnews {
+
+/* Header file */
+
+// This class is an XPCOM component, usable in JS, that calls the methods
+// in the C++ base class (bypassing any JS override).
+class JaBaseCppIncomingServer : public nsMsgIncomingServer,
+ public nsIInterfaceRequestor
+{
+public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_NSIINTERFACEREQUESTOR
+ JaBaseCppIncomingServer() { }
+
+ // nsMsgIncomingServer overrides
+ nsresult CreateRootFolderFromUri(const nsCString &serverUri,
+ nsIMsgFolder **rootFolder) override;
+
+protected:
+ virtual ~JaBaseCppIncomingServer() { }
+
+};
+
+class JaCppIncomingServerDelegator : public JaBaseCppIncomingServer,
+ public msgIOverride
+{
+public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_MSGIOVERRIDE
+
+ NS_FORWARD_NSIMSGINCOMINGSERVER(DELEGATE_JS(nsIMsgIncomingServer, mJsIMsgIncomingServer)->)
+ NS_FORWARD_NSIINTERFACEREQUESTOR(DELEGATE_JS(nsIInterfaceRequestor, mJsIInterfaceRequestor)->)
+
+ JaCppIncomingServerDelegator();
+
+private:
+ virtual ~JaCppIncomingServerDelegator() {
+ }
+
+ // This class will call a method on the delegator, but force the use of the
+ // C++ parent class, bypassing any JS Delegate.
+ class Super : public nsIMsgIncomingServer,
+ public nsIInterfaceRequestor
+ {
+ public:
+ Super(JaCppIncomingServerDelegator* aFakeThis) {mFakeThis = aFakeThis;}
+ NS_DECL_ISUPPORTS
+ // Forward all overridable methods, bypassing JS override.
+ NS_FORWARD_NSIMSGINCOMINGSERVER(mFakeThis->JaBaseCppIncomingServer::)
+ NS_FORWARD_NSIINTERFACEREQUESTOR(mFakeThis->JaBaseCppIncomingServer::)
+ private:
+ virtual ~Super() {};
+ JaCppIncomingServerDelegator* mFakeThis;
+ };
+
+ // Interfaces that may be overridden by JS.
+ nsCOMPtr<nsIMsgIncomingServer> mJsIMsgIncomingServer;
+ nsCOMPtr<nsIInterfaceRequestor> mJsIInterfaceRequestor;
+
+ nsCOMPtr<nsISupports> mJsISupports;
+
+ // Class to bypass JS delegates.
+ nsCOMPtr<nsIMsgIncomingServer> mCppBase;
+
+ RefPtr<DelegateList> mDelegateList;
+ nsDataHashtable<nsCStringHashKey, bool>* mMethods;
+
+
+};
+
+} // namespace mailnews
+} // namespace mozilla
+
+#endif