зеркало из https://github.com/mozilla/pjs.git
changes for posting to a newsgroup from msg compose
This commit is contained in:
Родитель
2f546f203d
Коммит
d31c94c862
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* DO NOT EDIT. THIS FILE IS GENERATED FROM nsIMsgPost.idl
|
||||
*/
|
||||
|
||||
#ifndef __gen_nsIMsgPost_h__
|
||||
#define __gen_nsIMsgPost_h__
|
||||
|
||||
#include "nsISupports.h" /* interface nsISupports */
|
||||
#include "nsIMsgCompFields.h" /* interface nsIMsgCompFields */
|
||||
#include "nsID.h" /* interface nsID */
|
||||
|
||||
#ifdef XPIDL_JS_STUBS
|
||||
#include "jsapi.h"
|
||||
#endif
|
||||
|
||||
/* starting interface: nsIMsgPost */
|
||||
|
||||
/* {a6fc080a-f1bb-11d2-84c2-004005263078} */
|
||||
#define NS_IMSGPOST_IID_STR "a6fc080a-f1bb-11d2-84c2-004005263078"
|
||||
#define NS_IMSGPOST_IID \
|
||||
{0xa6fc080a, 0xf1bb, 0x11d2, \
|
||||
{ 0x84, 0xc2, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78 }}
|
||||
|
||||
class nsIMsgPost : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMSGPOST_IID)
|
||||
|
||||
/* void PostMessage (in nsIMsgCompFields fields); */
|
||||
NS_IMETHOD PostMessage(nsIMsgCompFields *fields) = 0;
|
||||
|
||||
#ifdef XPIDL_JS_STUBS
|
||||
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
|
||||
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIMsgPost *priv);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* __gen_nsIMsgPost_h__ */
|
|
@ -0,0 +1,28 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 "nsISupports.idl"
|
||||
#include "nsIMsgCompFields.idl"
|
||||
|
||||
|
||||
[object, uuid(a6fc080a-f1bb-11d2-84c2-004005263078)]
|
||||
interface nsIMsgPost: nsISupports {
|
||||
|
||||
void PostMessage(in nsIMsgCompFields fields);
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/********************************************************************************************************
|
||||
|
||||
Message Post Class Factory.
|
||||
|
||||
*********************************************************************************************************/
|
||||
|
||||
#ifndef _MsgPostFact_H_
|
||||
#define _MsgPostFact_H_
|
||||
|
||||
#include "nsIMsgPost.h"
|
||||
|
||||
extern nsresult NS_NewMsgPost(const nsIID &aIID, void ** aInstancePtrResult);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/* Insert copyright and license here 1995 */
|
||||
|
||||
#include "msgCore.h"
|
||||
|
||||
#include "nsMsgPost.h"
|
||||
#include "nsMsgCompFields.h"
|
||||
|
||||
static NS_DEFINE_IID(kIMsgPost, NS_IMSGPOST_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsresult NS_NewMsgPost(const nsIID &aIID, void ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take a string describing the assertion */
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsMsgPost* pPost = new nsMsgPost();
|
||||
if (pPost)
|
||||
return pPost->QueryInterface(kIMsgPost, aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
||||
nsMsgPost::nsMsgPost()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsMsgPost::~nsMsgPost()
|
||||
{
|
||||
}
|
||||
|
||||
/* the following macro actually implement addref, release and query interface for our component. */
|
||||
NS_IMPL_ISUPPORTS(nsMsgPost, nsIMsgPost::GetIID());
|
||||
|
||||
nsresult
|
||||
nsMsgPost::PostMessage(nsIMsgCompFields *fields)
|
||||
{
|
||||
const char* pBody;
|
||||
PRInt32 nBodyLength;
|
||||
|
||||
if (fields) {
|
||||
pBody = ((nsMsgCompFields *)fields)->GetBody();
|
||||
if (pBody)
|
||||
nBodyLength = PL_strlen(pBody);
|
||||
else
|
||||
nBodyLength = 0;
|
||||
|
||||
printf("PostMessage to: %s\n", ((nsMsgCompFields *)fields)->GetNewsgroups());
|
||||
printf("subject: %s\n", ((nsMsgCompFields *)fields)->GetSubject());
|
||||
printf("\n%s", pBody);
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 __MSGPOST_H__
|
||||
#define __MSGPOST_H__
|
||||
|
||||
#include "nsIMsgPost.h"
|
||||
|
||||
class nsMsgPost : public nsIMsgPost
|
||||
{
|
||||
public:
|
||||
nsMsgPost();
|
||||
virtual ~nsMsgPost();
|
||||
|
||||
/* this macro defines QueryInterface, AddRef and Release for this class */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD PostMessage(nsIMsgCompFields *fields);
|
||||
};
|
||||
|
||||
#endif /* __MSGPOST_H__ */
|
Загрузка…
Ссылка в новой задаче