From 7d411ced44896ba28fc9c758a2e2ba1de2bfa972 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Tue, 6 Apr 1999 22:37:51 +0000 Subject: [PATCH] new POP3 incoming server implementations git-svn-id: svn://10.0.0.236/trunk@26569 18797224-902f-48f8-a5cc-f745e15eee43 --- .../local/src/nsPop3IncomingServer.cpp | 101 ++++++++++++++++++ .../mailnews/local/src/nsPop3IncomingServer.h | 32 ++++++ 2 files changed, 133 insertions(+) create mode 100644 mozilla/mailnews/local/src/nsPop3IncomingServer.cpp create mode 100644 mozilla/mailnews/local/src/nsPop3IncomingServer.h diff --git a/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp new file mode 100644 index 00000000000..4fb9e9f7da3 --- /dev/null +++ b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsIPop3IncomingServer.h" +#include "nsPop3IncomingServer.h" +#include "nsMsgIncomingServer.h" + +#include "nsIPref.h" + +#include "prmem.h" +#include "plstr.h" + + +/* get some implementation from nsMsgIncomingServer */ +class nsPop3IncomingServer : public nsMsgIncomingServer, + public nsIPop3IncomingServer + +{ +public: + NS_DECL_ISUPPORTS_INHERITED + + nsPop3IncomingServer(); + virtual ~nsPop3IncomingServer(); + + NS_IMPL_CLASS_GETSET_STR(RootFolderPath, m_rootFolderPath); + NS_IMPL_CLASS_GETSET(LeaveMessagesOnServer, PRBool, m_leaveOnServer); + NS_IMPL_CLASS_GETSET(DeleteMailLeftOnServer, + PRBool, m_deleteMailLeftOnServer); + + NS_IMETHOD LoadPreferences(nsIPref *prefs, const char *serverKey); + +private: + char *m_rootFolderPath; + PRBool m_leaveOnServer; + PRBool m_deleteMailLeftOnServer; +}; + +NS_IMPL_ISUPPORTS_INHERITED(nsPop3IncomingServer, + nsMsgIncomingServer, + nsIPop3IncomingServer); + + + +nsPop3IncomingServer::nsPop3IncomingServer() : + m_rootFolderPath(0), + m_leaveOnServer(PR_FALSE), + m_deleteMailLeftOnServer(PR_FALSE) +{ + NS_INIT_REFCNT(); +} + +nsPop3IncomingServer::~nsPop3IncomingServer() +{ + PR_FREEIF(m_rootFolderPath); + +} + +nsresult +nsPop3IncomingServer::LoadPreferences(nsIPref *prefs, + const char *serverKey) +{ +#ifdef DEBUG_alecf + printf("Loading pop prefs for %s..\n",serverKey); +#endif + + nsMsgIncomingServer::LoadPreferences(prefs, serverKey); + + m_rootFolderPath = getCharPref(prefs, serverKey, "directory"); + m_leaveOnServer = getBoolPref(prefs, serverKey, "leave_on_server"); + m_deleteMailLeftOnServer = + getBoolPref(prefs, serverKey, "delete_mail_left_on_server"); + + return NS_OK; +} + +nsresult NS_NewPop3IncomingServer(const nsIID& iid, + void **result) +{ + nsPop3IncomingServer *server; + if (!result) return NS_ERROR_NULL_POINTER; + server = new nsPop3IncomingServer(); + + return server->QueryInterface(iid, result); +} + + diff --git a/mozilla/mailnews/local/src/nsPop3IncomingServer.h b/mozilla/mailnews/local/src/nsPop3IncomingServer.h new file mode 100644 index 00000000000..0a8457c4e12 --- /dev/null +++ b/mozilla/mailnews/local/src/nsPop3IncomingServer.h @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef __nsPop3IncomingServer_h +#define __nsPop3IncomingServer_h + +#include "nsIPop3IncomingServer.h" +#include "nscore.h" + +NS_BEGIN_EXTERN_C + +nsresult +NS_NewPop3IncomingServer(const nsIID& iid, void **result); + +NS_END_EXTERN_C + +#endif