1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef nsMsgFolderNotificationService_h__ 7 #define nsMsgFolderNotificationService_h__ 8 9 #include "nsIMsgFolderNotificationService.h" 10 #include "nsIMsgFolderListener.h" 11 #include "nsTObserverArray.h" 12 #include "nsCOMPtr.h" 13 14 class nsMsgFolderNotificationService final 15 : public nsIMsgFolderNotificationService { 16 public: 17 NS_DECL_ISUPPORTS 18 NS_DECL_NSIMSGFOLDERNOTIFICATIONSERVICE 19 20 nsMsgFolderNotificationService(); 21 22 private: 23 ~nsMsgFolderNotificationService(); 24 struct MsgFolderListener { 25 nsCOMPtr<nsIMsgFolderListener> mListener; 26 msgFolderListenerFlag mFlags; 27 MsgFolderListenerMsgFolderListener28 MsgFolderListener(nsIMsgFolderListener* aListener, 29 msgFolderListenerFlag aFlags) 30 : mListener(aListener), mFlags(aFlags) {} MsgFolderListenerMsgFolderListener31 MsgFolderListener(const MsgFolderListener& aListener) 32 : mListener(aListener.mListener), mFlags(aListener.mFlags) {} ~MsgFolderListenerMsgFolderListener33 ~MsgFolderListener() {} 34 35 int operator==(nsIMsgFolderListener* aListener) const { 36 return mListener == aListener; 37 } 38 int operator==(const MsgFolderListener& aListener) const { 39 return mListener == aListener.mListener; 40 } 41 }; 42 43 nsTObserverArray<MsgFolderListener> mListeners; 44 }; 45 46 #endif 47