summaryrefslogtreecommitdiffstats
path: root/mailnews/news/src/nsNNTPNewsgroupPost.cpp
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/news/src/nsNNTPNewsgroupPost.cpp
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/news/src/nsNNTPNewsgroupPost.cpp')
-rw-r--r--mailnews/news/src/nsNNTPNewsgroupPost.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/mailnews/news/src/nsNNTPNewsgroupPost.cpp b/mailnews/news/src/nsNNTPNewsgroupPost.cpp
new file mode 100644
index 000000000..03c67c455
--- /dev/null
+++ b/mailnews/news/src/nsNNTPNewsgroupPost.cpp
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+#include "msgCore.h" // precompiled header...
+#include "nsNNTPNewsgroupPost.h"
+
+NS_IMPL_ISUPPORTS(nsNNTPNewsgroupPost, nsINNTPNewsgroupPost)
+
+nsNNTPNewsgroupPost::nsNNTPNewsgroupPost()
+{
+ m_isControl=false;
+}
+
+nsNNTPNewsgroupPost::~nsNNTPNewsgroupPost()
+{
+}
+
+#define IMPL_GETSET(attribute, member) \
+ NS_IMETHODIMP nsNNTPNewsgroupPost::Get##attribute(char **result) \
+ { \
+ NS_ENSURE_ARG_POINTER(result); \
+ *result = ToNewCString(member); \
+ return NS_OK; \
+ } \
+ NS_IMETHODIMP nsNNTPNewsgroupPost::Set##attribute(const char *aValue) \
+ { \
+ member.Assign(aValue); \
+ return NS_OK; \
+ }
+
+IMPL_GETSET(RelayVersion, m_header[IDX_HEADER_RELAYVERSION])
+IMPL_GETSET(PostingVersion, m_header[IDX_HEADER_POSTINGVERSION])
+IMPL_GETSET(From, m_header[IDX_HEADER_FROM])
+IMPL_GETSET(Date, m_header[IDX_HEADER_DATE])
+IMPL_GETSET(Subject, m_header[IDX_HEADER_SUBJECT])
+IMPL_GETSET(Path, m_header[IDX_HEADER_PATH])
+IMPL_GETSET(ReplyTo, m_header[IDX_HEADER_REPLYTO])
+IMPL_GETSET(Sender, m_header[IDX_HEADER_SENDER])
+IMPL_GETSET(FollowupTo, m_header[IDX_HEADER_FOLLOWUPTO])
+IMPL_GETSET(DateReceived, m_header[IDX_HEADER_DATERECEIVED])
+IMPL_GETSET(Expires, m_header[IDX_HEADER_EXPIRES])
+IMPL_GETSET(Control, m_header[IDX_HEADER_CONTROL])
+IMPL_GETSET(Distribution, m_header[IDX_HEADER_DISTRIBUTION])
+IMPL_GETSET(Organization, m_header[IDX_HEADER_ORGANIZATION])
+IMPL_GETSET(Body, m_body)
+
+NS_IMETHODIMP nsNNTPNewsgroupPost::GetNewsgroups(char **result)
+{
+ NS_ENSURE_ARG_POINTER(result);
+ *result = ToNewCString(m_header[IDX_HEADER_NEWSGROUPS]);
+ return NS_OK;
+}
+
+NS_IMETHODIMP nsNNTPNewsgroupPost::GetReferences(char **result)
+{
+ NS_ENSURE_ARG_POINTER(result);
+ *result = ToNewCString(m_header[IDX_HEADER_REFERENCES]);
+ return NS_OK;
+}
+
+NS_IMETHODIMP nsNNTPNewsgroupPost::GetIsControl(bool *result)
+{
+ NS_ENSURE_ARG_POINTER(result);
+ *result = m_isControl;
+ return NS_OK;
+}
+
+nsresult
+nsNNTPNewsgroupPost::AddNewsgroup(const char *newsgroup)
+{
+ m_header[IDX_HEADER_NEWSGROUPS].AppendLiteral(", ");
+ m_header[IDX_HEADER_NEWSGROUPS].Append(newsgroup);
+ return NS_OK;
+}
+
+
+// the message can be stored in a file....allow accessors for getting and setting
+// the file name to post...
+nsresult
+nsNNTPNewsgroupPost::SetPostMessageFile(nsIFile * aPostMessageFile)
+{
+ m_postMessageFile = aPostMessageFile;
+ return NS_OK;
+}
+
+nsresult
+nsNNTPNewsgroupPost::GetPostMessageFile(nsIFile ** aPostMessageFile)
+{
+ if (aPostMessageFile)
+ NS_IF_ADDREF(*aPostMessageFile = m_postMessageFile);
+ return NS_OK;
+}