bug 126453 : Chinese newsgroup names are not readable: patch by holywen%mozilla.org.cn with my changes (r=bienvenu, sr=mscott, a=asa)
git-svn-id: svn://10.0.0.236/trunk@176319 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ebf460765d
commit
0b971ab5ba
@ -344,10 +344,7 @@ function SetStateFromRow(row, state)
|
||||
{
|
||||
var col = gSearchTree.columns["nameColumn2"];
|
||||
var name = gSearchView.getCellText(row, col);
|
||||
// we need to escape the name because
|
||||
// some news servers have newsgroups with non ASCII names
|
||||
// we need to escape those name before calling SetState()
|
||||
SetState(encodeURI(name), state);
|
||||
SetState(name, state);
|
||||
}
|
||||
|
||||
function SetSubscribeState(state)
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
<!ENTITY abbreviateOn.label "Full names (For example, 'netscape.public.mozilla.mail-news')">
|
||||
<!ENTITY abbreviateOff.label "Abbreviate names (For example, 'n.p.m.mail-news')">
|
||||
<!ENTITY advancedButton.label "Advanced...">
|
||||
<!ENTITY serverDefaultCharset.label "Default Character Encoding:">
|
||||
<!ENTITY advancedButton.accesskey "v">
|
||||
<!ENTITY localFolderPicker.label "Select Local Directory">
|
||||
<!ENTITY browseFolder.label "Browse...">
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
|
||||
var gRedirectorType = "";
|
||||
var gServer;
|
||||
var gObserver;
|
||||
|
||||
function onInit()
|
||||
{
|
||||
@ -64,6 +65,10 @@ function onPreInit(account, accountValues)
|
||||
gRedirectorType = parent.getAccountValue(account, accountValues, "server", "redirectorType", null, false);
|
||||
hideShowControls(type);
|
||||
|
||||
gObserver= Components.classes["@mozilla.org/observer-service;1"].
|
||||
getService(Components.interfaces.nsIObserverService);
|
||||
gObserver.notifyObservers(null, "charsetmenu-selected", "other");
|
||||
|
||||
gServer = account.incomingServer;
|
||||
|
||||
if(!account.incomingServer.canEmptyTrashOnExit)
|
||||
|
||||
@ -330,4 +330,17 @@
|
||||
accesskey="&browseFolder.accesskey;" oncommand="BrowseForLocalFolders()"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<separator class="thin"/>
|
||||
<hbox hidefor="imap,pop3,movemail" align="center" valign="middle" iscontrolcontainer="true">
|
||||
<label value="&serverDefaultCharset.label;" control="nntp.charset"/>
|
||||
<menulist hidable="true" hidefor="imap,pop3,movemail" wsm_persist="true" id="nntp.charset"
|
||||
ref="NC:DecodersRoot" datasources="rdf:charset-menu"
|
||||
preftype="string" prefstring="mail.server.%serverkey%.charset">
|
||||
<template>
|
||||
<menupopup>
|
||||
<menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
|
||||
</menupopup>
|
||||
</template>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</page>
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
<!ENTITY abbreviateOn.label "Full names (For example, 'netscape.public.mozilla.mail-news')">
|
||||
<!ENTITY abbreviateOff.label "Abbreviate names (For example, 'n.p.m.mail-news')">
|
||||
<!ENTITY advancedButton.label "Advanced...">
|
||||
<!ENTITY serverDefaultCharset.label "Default Character Encoding:">
|
||||
<!ENTITY advancedButton.accesskey "v">
|
||||
<!ENTITY localFolderPicker.label "Select Local Directory">
|
||||
<!ENTITY browseFolder.label "Browse...">
|
||||
|
||||
@ -55,7 +55,7 @@ interface nsISubscribeListener : nsISupports {
|
||||
void OnDonePopulating();
|
||||
};
|
||||
|
||||
[scriptable, uuid(ce251379-dbcc-4dfd-9085-363b7b0b0af0)]
|
||||
[scriptable, uuid(4afd3d64-f7e9-4eb6-98bf-8200a7dab60f)]
|
||||
interface nsISubscribableServer : nsISupports {
|
||||
attribute nsISubscribeListener subscribeListener;
|
||||
attribute char delimiter;
|
||||
@ -65,7 +65,7 @@ interface nsISubscribableServer : nsISupports {
|
||||
void stopPopulating(in nsIMsgWindow aMsgWindow);
|
||||
|
||||
// return true if state changed, false otherwise
|
||||
boolean setState(in string path, in boolean state);
|
||||
boolean setState(in AUTF8String path, in boolean state);
|
||||
|
||||
void subscribeCleanup();
|
||||
|
||||
@ -76,26 +76,27 @@ interface nsISubscribableServer : nsISupports {
|
||||
|
||||
// other stuff
|
||||
void setIncomingServer(in nsIMsgIncomingServer server);
|
||||
void addTo(in string aName, in boolean addAsSubscribed, in boolean aSubscribable, in boolean aChangeIfExists);
|
||||
void setAsSubscribed(in string path);
|
||||
void addTo(in AUTF8String aName, in boolean addAsSubscribed,
|
||||
in boolean aSubscribable, in boolean aChangeIfExists);
|
||||
void setAsSubscribed(in AUTF8String path);
|
||||
void updateSubscribed();
|
||||
void setShowFullName(in boolean showFullName);
|
||||
|
||||
// if path is null, use the root
|
||||
boolean hasChildren(in string path);
|
||||
boolean hasChildren(in AUTF8String path);
|
||||
// if path is null, use the root
|
||||
boolean isSubscribed(in string path);
|
||||
// if path is null, use the root
|
||||
boolean isSubscribable(in string path);
|
||||
boolean isSubscribed(in AUTF8String path);
|
||||
// if path is null, use the root
|
||||
wstring getLeafName(in string path);
|
||||
boolean isSubscribable(in AUTF8String path);
|
||||
// if path is null, use the root
|
||||
void getChildren(in string path, in nsISupportsArray array);
|
||||
AString getLeafName(in AUTF8String path);
|
||||
// if path is null, use the root
|
||||
void getFirstChildURI(in string path, out string result);
|
||||
void getChildren(in AUTF8String path, in nsISupportsArray array);
|
||||
// if path is null, use the root
|
||||
AUTF8String getFirstChildURI(in AUTF8String path);
|
||||
|
||||
// for searching
|
||||
void setSearchValue(in string searchValue);
|
||||
void setSearchValue(in AString searchValue);
|
||||
readonly attribute boolean supportsSubscribeSearch;
|
||||
};
|
||||
|
||||
|
||||
@ -346,10 +346,8 @@ function SetStateFromRow(row, state)
|
||||
{
|
||||
var col = gSearchTree.columns["nameColumn2"];
|
||||
var name = gSearchView.getCellText(row, col);
|
||||
// we need to escape the name because
|
||||
// some news servers have newsgroups with non ASCII names
|
||||
// we need to escape those name before calling SetState()
|
||||
SetState(encodeURI(name), state);
|
||||
|
||||
SetState(name, state);
|
||||
}
|
||||
|
||||
function SetSubscribeState(state)
|
||||
|
||||
@ -127,10 +127,8 @@ nsSubscribableServer::SetDelimiter(char aDelimiter)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::SetAsSubscribed(const char *path)
|
||||
nsSubscribableServer::SetAsSubscribed(const nsACString &path)
|
||||
{
|
||||
NS_ASSERTION(path,"no path");
|
||||
if (!path) return NS_ERROR_NULL_POINTER;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
@ -150,7 +148,8 @@ nsSubscribableServer::SetAsSubscribed(const char *path)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool subscribable, PRBool changeIfExists)
|
||||
nsSubscribableServer::AddTo(const nsACString& aName, PRBool aAddAsSubscribed,
|
||||
PRBool aSubscribable, PRBool aChangeIfExists)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -163,7 +162,7 @@ nsSubscribableServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool su
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
|
||||
// todo, shouldn't we pass in addAsSubscribed, for the
|
||||
// todo, shouldn't we pass in aAddAsSubscribed, for the
|
||||
// default value if we create it?
|
||||
rv = FindAndCreateNode(aName, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -171,27 +170,30 @@ nsSubscribableServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool su
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
if (!node) return NS_ERROR_FAILURE;
|
||||
|
||||
if (changeIfExists) {
|
||||
node->isSubscribed = addAsSubscribed;
|
||||
if (aChangeIfExists) {
|
||||
node->isSubscribed = aAddAsSubscribed;
|
||||
rv = NotifyChange(node, kNC_Subscribed, node->isSubscribed);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
node->isSubscribable = subscribable;
|
||||
node->isSubscribable = aSubscribable;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::SetState(const char *path, PRBool state, PRBool *stateChanged)
|
||||
nsSubscribableServer::SetState(const nsACString &aPath, PRBool aState,
|
||||
PRBool *aStateChanged)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(path && stateChanged, "no path or stateChanged");
|
||||
if (!path || !stateChanged) return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(!aPath.IsEmpty() && aStateChanged, "no path or stateChanged");
|
||||
if (aPath.IsEmpty() || !aStateChanged) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*stateChanged = PR_FALSE;
|
||||
NS_ASSERTION(IsUTF8(aPath), "aPath is not in UTF-8");
|
||||
|
||||
*aStateChanged = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -202,12 +204,12 @@ nsSubscribableServer::SetState(const char *path, PRBool state, PRBool *stateChan
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (node->isSubscribed == state) {
|
||||
if (node->isSubscribed == aState) {
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
node->isSubscribed = state;
|
||||
*stateChanged = PR_TRUE;
|
||||
node->isSubscribed = aState;
|
||||
*aStateChanged = PR_TRUE;
|
||||
rv = NotifyChange(node, kNC_Subscribed, node->isSubscribed);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
@ -216,7 +218,7 @@ nsSubscribableServer::SetState(const char *path, PRBool state, PRBool *stateChan
|
||||
}
|
||||
|
||||
void
|
||||
nsSubscribableServer::BuildURIFromNode(SubscribeTreeNode *node, nsCAutoString &uri)
|
||||
nsSubscribableServer::BuildURIFromNode(SubscribeTreeNode *node, nsACString &uri)
|
||||
{
|
||||
if (node->parent) {
|
||||
BuildURIFromNode(node->parent, uri);
|
||||
@ -611,11 +613,12 @@ nsSubscribableServer::AddChildNode(SubscribeTreeNode *parent, const char *name,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSubscribableServer::FindAndCreateNode(const char *path, SubscribeTreeNode **result)
|
||||
nsSubscribableServer::FindAndCreateNode(const nsACString &aPath,
|
||||
SubscribeTreeNode **aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(result, "no result");
|
||||
if (!result) return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(aResult, "no result");
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (!mTreeRoot) {
|
||||
nsXPIDLCString serverUri;
|
||||
@ -626,12 +629,12 @@ nsSubscribableServer::FindAndCreateNode(const char *path, SubscribeTreeNode **re
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
if (!path || (path[0] == '\0')) {
|
||||
*result = mTreeRoot;
|
||||
if (aPath.IsEmpty()) {
|
||||
*aResult = mTreeRoot;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
char *pathStr = nsCRT::strdup(path);
|
||||
char *pathStr = nsCRT::strdup(PromiseFlatCString(aPath).get());
|
||||
char *token = nsnull;
|
||||
char *rest = pathStr;
|
||||
|
||||
@ -640,7 +643,7 @@ nsSubscribableServer::FindAndCreateNode(const char *path, SubscribeTreeNode **re
|
||||
delimstr[0] = mDelimiter;
|
||||
delimstr[1] = '\0';
|
||||
|
||||
*result = nsnull;
|
||||
*aResult = nsnull;
|
||||
|
||||
SubscribeTreeNode *parent = mTreeRoot;
|
||||
SubscribeTreeNode *child = nsnull;
|
||||
@ -658,21 +661,21 @@ nsSubscribableServer::FindAndCreateNode(const char *path, SubscribeTreeNode **re
|
||||
CRTFREEIF(pathStr);
|
||||
|
||||
// the last child we add is the result
|
||||
*result = child;
|
||||
*aResult = child;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
nsSubscribableServer::HasChildren(const nsACString &aPath, PRBool *aHasChildren)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(aHasChildren, "no aHasChildren");
|
||||
NS_ASSERTION(aHasChildren, "no hasChildren");
|
||||
if (!aHasChildren) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aHasChildren = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -684,14 +687,15 @@ nsSubscribableServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
nsSubscribableServer::IsSubscribed(const nsACString &aPath,
|
||||
PRBool *aIsSubscribed)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSubscribed);
|
||||
|
||||
*aIsSubscribed = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
nsresult rv = FindAndCreateNode(path, &node);
|
||||
nsresult rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -702,14 +706,15 @@ nsSubscribableServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
nsSubscribableServer::IsSubscribable(const nsACString &aPath,
|
||||
PRBool *aIsSubscribable)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSubscribable);
|
||||
|
||||
*aIsSubscribable = PR_FALSE;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
nsresult rv = FindAndCreateNode(path, &node);
|
||||
nsresult rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -720,14 +725,10 @@ nsSubscribableServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
nsSubscribableServer::GetLeafName(const nsACString &aPath, nsAString &aLeafName)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(aLeafName, "no aLeafName");
|
||||
if (!aLeafName) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
nsresult rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -739,28 +740,21 @@ nsSubscribableServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
// for news, the path is escaped UTF8
|
||||
//
|
||||
// when we switch to using the tree, this hack will go away.
|
||||
nsAutoString leafName;
|
||||
if (mShowFullName) {
|
||||
rv = NS_MsgDecodeUnescapeURLPath(nsDependentCString(path), leafName);
|
||||
return NS_MsgDecodeUnescapeURLPath(aPath, aLeafName);
|
||||
}
|
||||
else {
|
||||
rv = CopyMUTF7toUTF16(nsDependentCString(node->name), leafName);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aLeafName = ToNewUnicode(leafName);
|
||||
NS_ENSURE_TRUE(*aLeafName, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
return rv;
|
||||
|
||||
return CopyMUTF7toUTF16(nsDependentCString(node->name), aLeafName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
nsSubscribableServer::GetFirstChildURI(const nsACString &aPath,
|
||||
nsACString &aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
aResult.Truncate();
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
nsresult rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -769,22 +763,20 @@ nsSubscribableServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
// no children
|
||||
if (!node->firstChild) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString uri;
|
||||
BuildURIFromNode(node->firstChild, uri);
|
||||
BuildURIFromNode(node->firstChild, aResult);
|
||||
|
||||
*aResult = ToNewCString(uri);
|
||||
if (!*aResult) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::GetChildren(const char *path, nsISupportsArray *array)
|
||||
nsSubscribableServer::GetChildren(const nsACString &aPath,
|
||||
nsISupportsArray *array)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!array) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
SubscribeTreeNode *node = nsnull;
|
||||
rv = FindAndCreateNode(path, &node);
|
||||
rv = FindAndCreateNode(aPath, &node);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
NS_ASSERTION(node,"didn't find the node");
|
||||
@ -795,8 +787,8 @@ nsSubscribableServer::GetChildren(const char *path, nsISupportsArray *array)
|
||||
if (!mTreeRoot) return NS_ERROR_UNEXPECTED;
|
||||
uriPrefix = mTreeRoot->name; // the root's name is the server uri
|
||||
uriPrefix += "/";
|
||||
if (path && (path[0] != '\0')) {
|
||||
uriPrefix += path;
|
||||
if (!aPath.IsEmpty()) {
|
||||
uriPrefix += aPath;
|
||||
uriPrefix += mDelimiter;
|
||||
}
|
||||
|
||||
@ -836,7 +828,7 @@ nsSubscribableServer::CommitSubscribeChanges()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::SetSearchValue(const char *searchValue)
|
||||
nsSubscribableServer::SetSearchValue(const nsAString &aSearchValue)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -100,11 +100,12 @@ private:
|
||||
nsresult FreeSubtree(SubscribeTreeNode *node);
|
||||
nsresult CreateNode(SubscribeTreeNode *parent, const char *name, SubscribeTreeNode **result);
|
||||
nsresult AddChildNode(SubscribeTreeNode *parent, const char *name, SubscribeTreeNode **child);
|
||||
nsresult FindAndCreateNode(const char *path, SubscribeTreeNode **result);
|
||||
nsresult FindAndCreateNode(const nsACString &aPath,
|
||||
SubscribeTreeNode **aResult);
|
||||
nsresult NotifyAssert(SubscribeTreeNode *subjectNode, nsIRDFResource *property, SubscribeTreeNode *objectNode);
|
||||
nsresult NotifyChange(SubscribeTreeNode *subjectNode, nsIRDFResource *property, PRBool value);
|
||||
nsresult Notify(nsIRDFResource *subject, nsIRDFResource *property, nsIRDFNode *object, PRBool isAssert, PRBool isChange);
|
||||
void BuildURIFromNode(SubscribeTreeNode *node, nsCAutoString &uri);
|
||||
void BuildURIFromNode(SubscribeTreeNode *node, nsACString &uri);
|
||||
nsresult EnsureSubscribeDS();
|
||||
nsresult EnsureRDFService();
|
||||
};
|
||||
|
||||
@ -178,7 +178,8 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
|
||||
if (property == kNC_Name.get()) {
|
||||
nsCOMPtr<nsIRDFLiteral> name;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)relativePath).get(), getter_AddRefs(name));
|
||||
rv = mRDFService->GetLiteral(NS_ConvertUTF8toUTF16(relativePath).get(),
|
||||
getter_AddRefs(name));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!name) rv = NS_RDF_NO_VALUE;
|
||||
@ -187,9 +188,9 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
else if (property == kNC_Child.get()) {
|
||||
nsXPIDLCString childUri;
|
||||
rv = server->GetFirstChildURI(relativePath, getter_Copies(childUri));
|
||||
rv = server->GetFirstChildURI(relativePath, childUri);
|
||||
if (NS_FAILED(rv)) return NS_RDF_NO_VALUE;
|
||||
if (!(const char *)childUri) return NS_RDF_NO_VALUE;
|
||||
if (childUri.IsEmpty()) return NS_RDF_NO_VALUE;
|
||||
|
||||
nsCOMPtr <nsIRDFResource> childResource;
|
||||
rv = mRDFService->GetResource(childUri, getter_AddRefs(childResource));
|
||||
@ -219,7 +220,8 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> serverType;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)serverTypeStr).get(), getter_AddRefs(serverType));
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUTF16(serverTypeStr).get(),
|
||||
getter_AddRefs(serverType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!serverType) rv = NS_RDF_NO_VALUE;
|
||||
@ -228,7 +230,7 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
else if (property == kNC_LeafName.get()) {
|
||||
nsXPIDLString leafNameStr;
|
||||
rv = server->GetLeafName(relativePath, getter_Copies(leafNameStr));
|
||||
rv = server->GetLeafName(relativePath, leafNameStr);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> leafName;
|
||||
@ -247,18 +249,20 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSubscribeDataSource::GetChildren(nsISubscribableServer *server, const char *relativePath, nsISimpleEnumerator** aResult)
|
||||
nsSubscribeDataSource::GetChildren(nsISubscribableServer *aServer,
|
||||
const nsACString &aRelativePath,
|
||||
nsISimpleEnumerator** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(server && aResult, "no server or result");
|
||||
if (!server || !aResult) return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(aServer && aResult, "no server or result");
|
||||
if (!aServer || !aResult) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> children;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(children));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (!children) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = server->GetChildren(relativePath, children);
|
||||
rv = aServer->GetChildren(aRelativePath, children);
|
||||
// GetChildren() can fail if there are no children
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@ -297,7 +301,7 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
if (!tv) return NS_RDF_NO_VALUE;
|
||||
|
||||
nsCOMPtr<nsISubscribableServer> server;
|
||||
nsXPIDLCString relativePath;
|
||||
nsXPIDLCString relativePath; // UTF-8
|
||||
|
||||
rv = GetServerAndRelativePathFromResource(source, getter_AddRefs(server), getter_Copies(relativePath));
|
||||
if (NS_FAILED(rv) || !server) {
|
||||
@ -313,7 +317,7 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
}
|
||||
else if (property == kNC_LeafName.get()) {
|
||||
nsXPIDLString leafNameStr;
|
||||
rv = server->GetLeafName(relativePath, getter_Copies(leafNameStr));
|
||||
rv = server->GetLeafName(relativePath, leafNameStr);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> leafName;
|
||||
@ -350,7 +354,8 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
}
|
||||
else if (property == kNC_Name.get()) {
|
||||
nsCOMPtr<nsIRDFLiteral> name;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)relativePath).get(), getter_AddRefs(name));
|
||||
rv = mRDFService->GetLiteral(NS_ConvertUTF8toUTF16(relativePath).get(),
|
||||
getter_AddRefs(name));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(name);
|
||||
@ -365,7 +370,8 @@ nsSubscribeDataSource::GetTargets(nsIRDFResource *source,
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> serverType;
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUCS2((const char *)serverTypeStr).get(), getter_AddRefs(serverType));
|
||||
rv = mRDFService->GetLiteral(NS_ConvertASCIItoUTF16(serverTypeStr).get(),
|
||||
getter_AddRefs(serverType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsISimpleEnumerator* result = new nsSingletonEnumerator(serverType);
|
||||
@ -470,6 +476,7 @@ nsSubscribeDataSource::GetServerAndRelativePathFromResource(nsIRDFResource *sour
|
||||
*relativePath = nsnull;
|
||||
}
|
||||
else {
|
||||
// XXX : perhaps, have to unescape before returning
|
||||
*relativePath = nsCRT::strdup(sourceURI + serverURILen + 1);
|
||||
NS_ASSERTION(*relativePath,"no relative path");
|
||||
if (!*relativePath) return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -519,7 +526,7 @@ nsSubscribeDataSource::HasAssertion(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
// not everything has children
|
||||
rv = server->HasChildren((const char *)relativePath, hasAssertion);
|
||||
rv = server->HasChildren(relativePath, hasAssertion);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
else if (property == kNC_Name.get()) {
|
||||
@ -572,7 +579,7 @@ nsSubscribeDataSource::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc, P
|
||||
}
|
||||
|
||||
PRBool hasChildren = PR_FALSE;
|
||||
rv = server->HasChildren((const char *)relativePath, &hasChildren);
|
||||
rv = server->HasChildren(relativePath, &hasChildren);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
*result = hasChildren;
|
||||
return NS_OK;
|
||||
@ -633,7 +640,7 @@ nsSubscribeDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
array->AppendElement(kNC_LeafName);
|
||||
|
||||
PRBool hasChildren = PR_FALSE;
|
||||
rv = server->HasChildren((const char *)relativePath, &hasChildren);
|
||||
rv = server->HasChildren(relativePath, &hasChildren);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (hasChildren) {
|
||||
|
||||
@ -75,7 +75,9 @@ private:
|
||||
nsCOMPtr <nsIRDFService> mRDFService;
|
||||
nsCOMPtr <nsISupportsArray> mObservers;
|
||||
|
||||
nsresult GetChildren(nsISubscribableServer *server, const char *relativePath, nsISimpleEnumerator** aResult);
|
||||
nsresult GetChildren(nsISubscribableServer *aServer,
|
||||
const nsACString &aRelativePath,
|
||||
nsISimpleEnumerator** aResult);
|
||||
nsresult GetServerAndRelativePathFromResource(nsIRDFResource *source, nsISubscribableServer **server, char **relativePath);
|
||||
nsresult GetServerType(nsISubscribableServer *server, char **serverType);
|
||||
|
||||
|
||||
@ -2503,7 +2503,8 @@ nsMsgDBFolder::parseURI(PRBool needServer)
|
||||
// XXX conversion to unicode here? is fileName in UTF8?
|
||||
// yes, let's say it is in utf8
|
||||
NS_UnescapeURL((char *)fileName.get());
|
||||
mName = NS_ConvertUTF8toUCS2(fileName.get());
|
||||
NS_ASSERTION(IsUTF8(fileName), "fileName is not in UTF-8");
|
||||
CopyUTF8toUTF16(fileName, mName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2557,8 +2558,17 @@ nsMsgDBFolder::parseURI(PRBool needServer)
|
||||
// "folder1.sbd/folder2.sbd/foldern"
|
||||
// (remove leading / and add .sbd to first n-1 folders)
|
||||
// to be appended onto the server's path
|
||||
|
||||
PRBool isNewsFolder = PR_FALSE;
|
||||
nsCAutoString scheme;
|
||||
if (NS_SUCCEEDED(url->GetScheme(scheme)))
|
||||
{
|
||||
isNewsFolder = scheme.EqualsLiteral("news") ||
|
||||
scheme.EqualsLiteral("snews") ||
|
||||
scheme.EqualsLiteral("nntp");
|
||||
}
|
||||
|
||||
NS_MsgCreatePathStringFromFolderURI(urlPath.get(), newPath);
|
||||
NS_MsgCreatePathStringFromFolderURI(urlPath.get(), newPath, isNewsFolder);
|
||||
}
|
||||
|
||||
// now append munged path onto server path
|
||||
|
||||
@ -339,13 +339,15 @@ nsresult NS_MsgHashIfNecessary(nsAutoString &name)
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& pathCString)
|
||||
nsresult NS_MsgCreatePathStringFromFolderURI(const char *aFolderURI,
|
||||
nsCString& aPathCString,
|
||||
PRBool aIsNewsFolder)
|
||||
{
|
||||
// A file name has to be in native charset. Here we convert
|
||||
// to UTF-16 and check for 'unsafe' characters before converting
|
||||
// to native charset.
|
||||
NS_ENSURE_TRUE(IsUTF8(nsDependentCString(folderURI)), NS_ERROR_UNEXPECTED);
|
||||
NS_ConvertUTF8toUTF16 oldPath(folderURI);
|
||||
NS_ENSURE_TRUE(IsUTF8(nsDependentCString(aFolderURI)), NS_ERROR_UNEXPECTED);
|
||||
NS_ConvertUTF8toUTF16 oldPath(aFolderURI);
|
||||
|
||||
nsAutoString pathPiece, path;
|
||||
|
||||
@ -359,12 +361,21 @@ nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& p
|
||||
while (startSlashPos != -1) {
|
||||
oldPath.Mid(pathPiece, startSlashPos + 1, endSlashPos - startSlashPos);
|
||||
// skip leading '/' (and other // style things)
|
||||
if (!pathPiece.IsEmpty()) {
|
||||
if (!pathPiece.IsEmpty())
|
||||
{
|
||||
|
||||
// add .sbd onto the previous path
|
||||
if (haveFirst) {
|
||||
if (haveFirst)
|
||||
{
|
||||
path.AppendLiteral(".sbd/");
|
||||
}
|
||||
|
||||
if (aIsNewsFolder)
|
||||
{
|
||||
nsCAutoString tmp;
|
||||
CopyUTF16toMUTF7(pathPiece, tmp);
|
||||
CopyASCIItoUTF16(tmp, pathPiece);
|
||||
}
|
||||
|
||||
NS_MsgHashIfNecessary(pathPiece);
|
||||
path += pathPiece;
|
||||
@ -382,7 +393,7 @@ nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& p
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_CopyUnicodeToNative(path, pathCString);
|
||||
return NS_CopyUnicodeToNative(path, aPathCString);
|
||||
}
|
||||
|
||||
/* Given a string and a length, removes any "Re:" strings from the front.
|
||||
@ -563,21 +574,23 @@ char * NS_MsgSACat (char **destination, const char *source)
|
||||
return *destination;
|
||||
}
|
||||
|
||||
nsresult NS_MsgEscapeEncodeURLPath(const nsAString& str, nsAFlatCString& result)
|
||||
nsresult NS_MsgEscapeEncodeURLPath(const nsAString& aStr, nsAFlatCString& aResult)
|
||||
{
|
||||
char *escapedString = nsEscape(NS_ConvertUTF16toUTF8(str).get(), url_Path);
|
||||
char *escapedString = nsEscape(NS_ConvertUTF16toUTF8(aStr).get(), url_Path);
|
||||
if (!*escapedString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
result.Adopt(escapedString);
|
||||
aResult.Adopt(escapedString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_MsgDecodeUnescapeURLPath(const nsASingleFragmentCString& path, nsAString& result)
|
||||
nsresult NS_MsgDecodeUnescapeURLPath(const nsACString& aPath,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsCAutoString unescapedName;
|
||||
NS_UnescapeURL(path, esc_FileBaseName|esc_Forced|esc_AlwaysCopy,
|
||||
NS_UnescapeURL(PromiseFlatCString(aPath),
|
||||
esc_FileBaseName|esc_Forced|esc_AlwaysCopy,
|
||||
unescapedName);
|
||||
CopyUTF8toUTF16(unescapedName, result);
|
||||
CopyUTF8toUTF16(unescapedName, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,9 @@ NS_MSG_BASE nsresult NS_MsgGetUntranslatedPriorityName (nsMsgPriorityValue p, ns
|
||||
NS_MSG_BASE nsresult NS_MsgHashIfNecessary(nsAutoString &name);
|
||||
NS_MSG_BASE nsresult NS_MsgHashIfNecessary(nsCAutoString &name);
|
||||
|
||||
NS_MSG_BASE nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& pathString);
|
||||
NS_MSG_BASE nsresult NS_MsgCreatePathStringFromFolderURI(const char *aFolderURI,
|
||||
nsCString& aPathString,
|
||||
PRBool aIsNewsFolder=PR_FALSE);
|
||||
|
||||
NS_MSG_BASE PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP, char **modifiedSubject=nsnull);
|
||||
|
||||
@ -77,9 +79,11 @@ NS_MSG_BASE char * NS_MsgSACopy(char **destination, const char *source);
|
||||
|
||||
NS_MSG_BASE char * NS_MsgSACat(char **destination, const char *source);
|
||||
|
||||
NS_MSG_BASE nsresult NS_MsgEscapeEncodeURLPath(const nsAString& str, nsAFlatCString& result);
|
||||
NS_MSG_BASE nsresult NS_MsgEscapeEncodeURLPath(const nsAString& aStr,
|
||||
nsAFlatCString& aResult);
|
||||
|
||||
NS_MSG_BASE nsresult NS_MsgDecodeUnescapeURLPath(const nsASingleFragmentCString& path, nsAString& result);
|
||||
NS_MSG_BASE nsresult NS_MsgDecodeUnescapeURLPath(const nsACString& aPath,
|
||||
nsAString& aResult);
|
||||
|
||||
NS_MSG_BASE PRBool WeAreOffline();
|
||||
|
||||
|
||||
@ -80,9 +80,12 @@ void nsNewsSummarySpec::CreateSummaryFileName()
|
||||
{
|
||||
char *leafName = GetLeafName();
|
||||
|
||||
nsCAutoString fullLeafName((const char*)leafName);
|
||||
nsAutoString tmp;
|
||||
nsCAutoString fullLeafName;
|
||||
|
||||
// Append .msf (message summary file)
|
||||
// NS_CopyNativeToUnicode(nsDependentCString(leafName), tmp);
|
||||
// CopyUTF16toMUTF7(tmp, fullLeafName);
|
||||
// NS_MsgHashIfNecessary(fullLeafName);
|
||||
fullLeafName += ".msf";
|
||||
|
||||
SetLeafName(fullLeafName.get());
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
#include "nsIMsgAttachment.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
[scriptable, uuid(5BE51577-90EA-43ae-B9AC-71993E9AA285)]
|
||||
[scriptable, uuid(f5a85828-e9ef-4821-a045-6dc7a09351d6)]
|
||||
interface nsIMsgCompFields : nsISupports {
|
||||
|
||||
attribute AString from;
|
||||
@ -52,7 +52,7 @@ interface nsIMsgCompFields : nsISupports {
|
||||
attribute AString fcc;
|
||||
attribute AString fcc2;
|
||||
|
||||
attribute string newsgroups;
|
||||
attribute AString newsgroups;
|
||||
attribute string newshost;
|
||||
attribute string newspostUrl;
|
||||
attribute string followupTo;
|
||||
|
||||
@ -206,15 +206,14 @@ NS_IMETHODIMP nsMsgCompFields::GetFcc2(nsAString &_retval)
|
||||
return GetUnicodeHeader(MSG_FCC2_HEADER_ID, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgCompFields::SetNewsgroups(const char *value)
|
||||
NS_IMETHODIMP nsMsgCompFields::SetNewsgroups(const nsAString &aValue)
|
||||
{
|
||||
return SetAsciiHeader(MSG_NEWSGROUPS_HEADER_ID, value);
|
||||
return SetUnicodeHeader(MSG_NEWSGROUPS_HEADER_ID, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgCompFields::GetNewsgroups(char **_retval)
|
||||
NS_IMETHODIMP nsMsgCompFields::GetNewsgroups(nsAString &aGroup)
|
||||
{
|
||||
*_retval = nsCRT::strdup(GetAsciiHeader(MSG_NEWSGROUPS_HEADER_ID));
|
||||
return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
return GetUnicodeHeader(MSG_NEWSGROUPS_HEADER_ID, aGroup);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgCompFields::SetNewshost(const char *value)
|
||||
|
||||
@ -115,6 +115,7 @@ public:
|
||||
nsresult SetFcc2(const char *value) {return SetAsciiHeader(MSG_FCC2_HEADER_ID, value);}
|
||||
const char* GetFcc2() {return GetAsciiHeader(MSG_FCC2_HEADER_ID);}
|
||||
|
||||
nsresult SetNewsgroups(const char *aValue) {return SetAsciiHeader(MSG_NEWSGROUPS_HEADER_ID, aValue);}
|
||||
const char* GetNewsgroups() {return GetAsciiHeader(MSG_NEWSGROUPS_HEADER_ID);}
|
||||
|
||||
const char* GetNewshost() {return GetAsciiHeader(MSG_NEWSPOSTURL_HEADER_ID);}
|
||||
|
||||
@ -578,9 +578,10 @@ RRT_HEADER:
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PUSH_STRING ("Newsgroups: ");
|
||||
PUSH_STRING (newsgroupsHeaderVal.get());
|
||||
PUSH_NEWLINE ();
|
||||
// fixme:the newsgroups header had better be encoded as the server-side
|
||||
// character encoding, but this |charset| might be different from it.
|
||||
ENCODE_AND_PUSH("Newsgroups: ", PR_FALSE, newsgroupsHeaderVal.get(),
|
||||
charset, PR_FALSE);
|
||||
|
||||
// If we are here, we are NOT going to send this now. (i.e. it is a Draft,
|
||||
// Send Later file, etc...). Because of that, we need to store what the user
|
||||
|
||||
@ -2153,7 +2153,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||
if (! newgroups.IsEmpty())
|
||||
{
|
||||
if ((type != nsIMsgCompType::Reply) && (type != nsIMsgCompType::ReplyToSender))
|
||||
compFields->SetNewsgroups(NS_LossyConvertUCS2toASCII(newgroups).get());
|
||||
compFields->SetNewsgroups(newgroups);
|
||||
if (type == nsIMsgCompType::ReplyToGroup)
|
||||
compFields->SetTo(EmptyString());
|
||||
}
|
||||
@ -2188,12 +2188,12 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||
// Clear the newsgroup: header field, because followup-to: poster
|
||||
// only follows up to the original sender
|
||||
if (! newgroups.IsEmpty())
|
||||
compFields->SetNewsgroups(nsnull);
|
||||
compFields->SetNewsgroups(EmptyString());
|
||||
}
|
||||
else // Process "followup-to: newsgroup-content" here
|
||||
{
|
||||
if (type != nsIMsgCompType::ReplyToSender)
|
||||
compFields->SetNewsgroups(NS_LossyConvertUCS2toASCII(followUpTo).get());
|
||||
compFields->SetNewsgroups(followUpTo);
|
||||
if (type == nsIMsgCompType::Reply)
|
||||
compFields->SetTo(EmptyString());
|
||||
}
|
||||
|
||||
@ -463,8 +463,12 @@ nsMsgComposeService::OpenComposeWindow(const char *msgComposeWindowURL, const ch
|
||||
}
|
||||
else
|
||||
group = originalMsgURI;
|
||||
|
||||
pMsgCompFields->SetNewsgroups(group.get());
|
||||
|
||||
nsCAutoString unescapedName;
|
||||
NS_UnescapeURL(group,
|
||||
esc_FileBaseName|esc_Forced|esc_AlwaysCopy,
|
||||
unescapedName);
|
||||
pMsgCompFields->SetNewsgroups(NS_ConvertUTF8toUTF16(unescapedName));
|
||||
pMsgCompFields->SetNewshost(host.get());
|
||||
}
|
||||
else
|
||||
@ -586,7 +590,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
||||
pMsgCompFields->SetTo(NS_ConvertUTF8toUTF16(aToPart));
|
||||
pMsgCompFields->SetCc(NS_ConvertUTF8toUTF16(aCcPart));
|
||||
pMsgCompFields->SetBcc(NS_ConvertUTF8toUTF16(aBccPart));
|
||||
pMsgCompFields->SetNewsgroups(aNewsgroup);
|
||||
pMsgCompFields->SetNewsgroups(NS_ConvertUTF8toUTF16(aNewsgroup));
|
||||
pMsgCompFields->SetReferences(aRefPart);
|
||||
pMsgCompFields->SetSubject(NS_ConvertUTF8toUTF16(aSubjectPart));
|
||||
pMsgCompFields->SetBody(composeHTMLFormat ? sanitizedBody : rawBody);
|
||||
|
||||
@ -390,8 +390,7 @@ nsresult nsSMimeJSHelper::getMailboxList(nsIMsgCompFields *compFields, PRUint32
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsXPIDLString to, cc, bcc;
|
||||
nsXPIDLCString ng;
|
||||
nsXPIDLString to, cc, bcc, ng;
|
||||
|
||||
res = compFields->GetTo(to);
|
||||
if (NS_FAILED(res))
|
||||
@ -405,7 +404,7 @@ nsresult nsSMimeJSHelper::getMailboxList(nsIMsgCompFields *compFields, PRUint32
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
res = compFields->GetNewsgroups(getter_Copies(ng));
|
||||
res = compFields->GetNewsgroups(ng);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
@ -430,7 +429,9 @@ nsresult nsSMimeJSHelper::getMailboxList(nsIMsgCompFields *compFields, PRUint32
|
||||
all_recipients.Append(',');
|
||||
}
|
||||
|
||||
all_recipients += ng;
|
||||
if (!ng.IsEmpty()) {
|
||||
AppendUTF16toUTF8(ng, all_recipients);
|
||||
}
|
||||
|
||||
char *unique_mailboxes = nsnull;
|
||||
|
||||
|
||||
@ -1190,7 +1190,8 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
||||
imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
|
||||
isNamespace = (boxFlags & kNameSpace) != 0;
|
||||
if (!isNamespace)
|
||||
rv = AddTo(dupFolderPath.get(), mDoingLsub && !noSelect/* add as subscribed */, !noSelect, mDoingLsub /* change if exists */);
|
||||
rv = AddTo(dupFolderPath, mDoingLsub && !noSelect/* add as subscribed */,
|
||||
!noSelect, mDoingLsub /* change if exists */);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return rv;
|
||||
}
|
||||
@ -2854,7 +2855,7 @@ nsImapIncomingServer::SetDelimiter(char aDelimiter)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::SetAsSubscribed(const char *path)
|
||||
nsImapIncomingServer::SetAsSubscribed(const nsACString &path)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -2871,30 +2872,24 @@ nsImapIncomingServer::UpdateSubscribed()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool aSubscribable, PRBool changeIfExists)
|
||||
nsImapIncomingServer::AddTo(const nsACString &aName, PRBool addAsSubscribed,
|
||||
PRBool aSubscribable, PRBool changeIfExists)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// quick check if the name we are passed is really modified UTF-7
|
||||
// if it isn't, ignore it. (otherwise, we'll crash. see #63186)
|
||||
// there is a bug in the UW IMAP server where it can send us
|
||||
// folder names as literals, instead of MUTF7
|
||||
unsigned char *ptr = (unsigned char *)aName;
|
||||
PRBool nameIsClean = PR_TRUE;
|
||||
while (*ptr)
|
||||
{
|
||||
if (*ptr > 127)
|
||||
{
|
||||
nameIsClean = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
// RFC 3501 allows UTF-8 in addition to modified UTF-7
|
||||
// If it's not UTF-8, it cannot be MUTF7, either. We just ignore it.
|
||||
// (otherwise we'll crash. see #63186)
|
||||
if (!IsUTF8(aName))
|
||||
return NS_OK;
|
||||
|
||||
if (!IsASCII(aName)) {
|
||||
nsCAutoString name;
|
||||
CopyUTF16toMUTF7(NS_ConvertUTF8toUTF16(aName), name);
|
||||
return mInner->AddTo(name, addAsSubscribed, aSubscribable, changeIfExists);
|
||||
}
|
||||
|
||||
NS_ASSERTION(nameIsClean,"folder path was not in UTF7, ignore it");
|
||||
if (!nameIsClean) return NS_OK;
|
||||
|
||||
|
||||
return mInner->AddTo(aName, addAsSubscribed, aSubscribable, changeIfExists);
|
||||
}
|
||||
|
||||
@ -3031,7 +3026,8 @@ nsImapIncomingServer::ReDiscoverAllFolders()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::SetState(const char *path, PRBool state, PRBool *stateChanged)
|
||||
nsImapIncomingServer::SetState(const nsACString &path, PRBool state,
|
||||
PRBool *stateChanged)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3039,7 +3035,7 @@ nsImapIncomingServer::SetState(const char *path, PRBool state, PRBool *stateChan
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
nsImapIncomingServer::HasChildren(const nsACString &path, PRBool *aHasChildren)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3047,7 +3043,8 @@ nsImapIncomingServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
nsImapIncomingServer::IsSubscribed(const nsACString &path,
|
||||
PRBool *aIsSubscribed)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3055,7 +3052,7 @@ nsImapIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
nsImapIncomingServer::IsSubscribable(const nsACString &path, PRBool *aIsSubscribable)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3063,7 +3060,7 @@ nsImapIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
nsImapIncomingServer::GetLeafName(const nsACString &path, nsAString &aLeafName)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3071,7 +3068,7 @@ nsImapIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
nsImapIncomingServer::GetFirstChildURI(const nsACString &path, nsACString &aResult)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3080,7 +3077,7 @@ nsImapIncomingServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetChildren(const char *path, nsISupportsArray *array)
|
||||
nsImapIncomingServer::GetChildren(const nsACString &path, nsISupportsArray *array)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -3486,7 +3483,7 @@ nsImapIncomingServer::GetCanFileMessagesOnServer(PRBool *aCanFileMessagesOnServe
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::SetSearchValue(const char *searchValue)
|
||||
nsImapIncomingServer::SetSearchValue(const nsAString &searchValue)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -302,9 +302,9 @@ nsresult nsImapMailFolder::AddDirectorySeparator(nsFileSpec &path)
|
||||
// unfortunately we can't just say:
|
||||
// path += sep;
|
||||
// here because of the way nsFileSpec concatenates
|
||||
nsAutoString str; str.AssignWithConversion(nsFilePath(path));
|
||||
str += sep;
|
||||
path = nsFilePath(str);
|
||||
nsCAutoString str(path.GetNativePathCString());
|
||||
LossyAppendUTF16toASCII(sep, str);
|
||||
path = str.get();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
@ -383,8 +383,10 @@ CreateCompositionFields(const char *from,
|
||||
}
|
||||
|
||||
if (newsgroups) {
|
||||
// fixme: the newsgroups header had better be decoded using the server-side
|
||||
// character encoding,but this |charset| might be different from it.
|
||||
val = MIME_DecodeMimeHeader(newsgroups, charset, PR_FALSE, PR_TRUE);
|
||||
cFields->SetNewsgroups(val ? val : newsgroups);
|
||||
cFields->SetNewsgroups(NS_ConvertUTF8toUTF16(val ? val : newsgroups));
|
||||
PR_FREEIF(val);
|
||||
}
|
||||
|
||||
|
||||
@ -41,17 +41,23 @@
|
||||
interface nsIMsgWindow;
|
||||
interface nsINntpIncomingServer;
|
||||
|
||||
[scriptable, uuid(3716abe4-f6d4-11d2-86d5-004005263078)]
|
||||
[scriptable, uuid(02699533-7ba8-4e78-94dc-a20374fb2711)]
|
||||
interface nsIMsgNewsFolder : nsISupports {
|
||||
attribute string groupUsername;
|
||||
attribute string groupPassword;
|
||||
|
||||
/** the ascii name for the newsgroup.
|
||||
* newsgroup names are always ascii, and this can help simply
|
||||
* the code, to prevent use from having to get the name (as a wstring)
|
||||
* and then converting it back to ascii.
|
||||
*/
|
||||
readonly attribute string asciiName;
|
||||
readonly attribute AString unicodeName;
|
||||
/**|rawName| is an 8-bit string to represent the name of a newsgroup used by
|
||||
* a news server. It's offered for the convenience of callers so that they
|
||||
* don't have to convert |unicodeName| to the server-side name when
|
||||
* communicating with a news server. It's US-ASCII except for some
|
||||
* 'stand-alone' Chinese news servers that use GB2312 for newsgroup names
|
||||
* violating RFC 1036. For those servers, it's GB2312. However, it can be any
|
||||
* other single and multibyte encoding in principle. The encoding of this
|
||||
* string is stored in |nsINntpIncomingServer| because that's a server-wide
|
||||
* property.
|
||||
**/
|
||||
[noscript] readonly attribute ACString rawName;
|
||||
readonly attribute nsINntpIncomingServer nntpServer;
|
||||
attribute boolean saveArticleOffline;
|
||||
|
||||
@ -61,7 +67,7 @@ interface nsIMsgNewsFolder : nsISupports {
|
||||
void forgetGroupUsername();
|
||||
void forgetGroupPassword();
|
||||
|
||||
nsIMsgFolder addNewsgroup(in string newsgroupName, in string setStr);
|
||||
nsIMsgFolder addNewsgroup(in AUTF8String newsgroupName, in string setStr);
|
||||
|
||||
void setReadSetFromStr(in string setStr);
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(b5037f06-1dd1-11b2-bf61-fcab5b5837a7)]
|
||||
[scriptable, uuid(3634327c-392b-4686-adf5-576e6cef9196)]
|
||||
interface nsINewsDownloadDialogArgs: nsISupports {
|
||||
attribute string groupName;
|
||||
attribute AString groupName;
|
||||
attribute long articleCount;
|
||||
attribute string serverKey;
|
||||
attribute boolean hitOK;
|
||||
|
||||
@ -43,55 +43,63 @@ interface nsINNTPProtocol;
|
||||
interface nsIURI;
|
||||
interface nsIMsgWindow;
|
||||
|
||||
[scriptable, uuid(21ea0654-f773-11d2-8aec-004005263078)]
|
||||
[scriptable, uuid(020b614c-7bb2-44a3-9e6c-550e117d86e4)]
|
||||
interface nsINntpIncomingServer : nsISupports {
|
||||
/* the on-disk path to the newsrc file for this server */
|
||||
attribute nsIFileSpec newsrcFilePath;
|
||||
/* the on-disk path to the newsrc file for this server */
|
||||
attribute nsIFileSpec newsrcFilePath;
|
||||
|
||||
/* the newsrc root path (the directories all the newsrc files live) */
|
||||
attribute nsIFileSpec newsrcRootPath;
|
||||
|
||||
/* ask the user before downloading more than maxArticles? */
|
||||
attribute boolean notifyOn;
|
||||
/* the newsrc root path (the directories all the newsrc files live) */
|
||||
attribute nsIFileSpec newsrcRootPath;
|
||||
|
||||
/* ask the user before downloading more than maxArticles? */
|
||||
attribute boolean notifyOn;
|
||||
|
||||
/* the max articles to download */
|
||||
attribute long maxArticles;
|
||||
/* the max articles to download */
|
||||
attribute long maxArticles;
|
||||
|
||||
/* when we don't download all, do we mark the rest read? */
|
||||
attribute boolean markOldRead;
|
||||
attribute boolean markOldRead;
|
||||
|
||||
/* abbreviate the newsgroup names in the folder pane? */
|
||||
attribute boolean abbreviate;
|
||||
/* abbreviate the newsgroup names in the folder pane? */
|
||||
attribute boolean abbreviate;
|
||||
|
||||
/* do we use a single login per server or do we login per group */
|
||||
attribute boolean singleSignon;
|
||||
|
||||
/* the server keeps track of all the newsgroups we are subscribed to */
|
||||
void addNewsgroup(in string name);
|
||||
void removeNewsgroup(in string name);
|
||||
/** the server charset and it may be needed to display newsgroup folder
|
||||
* names correctly
|
||||
**/
|
||||
attribute ACString charset;
|
||||
|
||||
/* the server keeps track of all the newsgroups we are subscribed to */
|
||||
void addNewsgroup(in AString name);
|
||||
void removeNewsgroup(in AString name);
|
||||
|
||||
void writeNewsrcFile();
|
||||
|
||||
attribute boolean newsrcHasChanged;
|
||||
|
||||
attribute long maximumConnectionsNumber;
|
||||
attribute long maximumConnectionsNumber;
|
||||
|
||||
readonly attribute long numGroupsNeedingCounts;
|
||||
readonly attribute nsISupports firstGroupNeedingCounts;
|
||||
readonly attribute long numGroupsNeedingCounts;
|
||||
readonly attribute nsISupports firstGroupNeedingCounts;
|
||||
|
||||
void displaySubscribedGroup(in nsIMsgNewsFolder msgFolder, in long firstMessage, in long lastMessage, in long totalMessages);
|
||||
void displaySubscribedGroup(in nsIMsgNewsFolder msgFolder,
|
||||
in long firstMessage, in long lastMessage,
|
||||
in long totalMessages);
|
||||
|
||||
|
||||
void getNntpConnection(in nsIURI url, in nsIMsgWindow window,
|
||||
out nsINNTPProtocol aNntpConnection);
|
||||
void removeConnection(in nsINNTPProtocol aNntpConnection);
|
||||
void getNntpConnection(in nsIURI url, in nsIMsgWindow window,
|
||||
out nsINNTPProtocol aNntpConnection);
|
||||
void removeConnection(in nsINNTPProtocol aNntpConnection);
|
||||
|
||||
/* used for auto subscribing */
|
||||
boolean containsNewsgroup(in string name);
|
||||
void subscribeToNewsgroup(in string name);
|
||||
/* used for auto subscribing */
|
||||
boolean containsNewsgroup(in AUTF8String name);
|
||||
void subscribeToNewsgroup(in AUTF8String name);
|
||||
|
||||
/* used for the subscribe dialog */
|
||||
void addNewsgroupToList(in string name);
|
||||
/* used for the subscribe dialog.
|
||||
name is encoded in |charset| (attribute declared above) */
|
||||
[noscript] void addNewsgroupToList(in string name);
|
||||
|
||||
attribute boolean supportsExtensions;
|
||||
void addExtension(in string extension);
|
||||
@ -100,22 +108,23 @@ interface nsINntpIncomingServer : nsISupports {
|
||||
attribute boolean postingAllowed;
|
||||
attribute boolean pushAuth;
|
||||
attribute unsigned long lastUpdatedTime;
|
||||
|
||||
void addPropertyForGet(in string name, in string value);
|
||||
|
||||
void addPropertyForGet(in string name, in string value);
|
||||
string queryPropertyForGet(in string name);
|
||||
|
||||
void addSearchableGroup(in string name);
|
||||
boolean querySearchableGroup(in string name);
|
||||
void addSearchableGroup(in AString name);
|
||||
boolean querySearchableGroup(in AString name);
|
||||
|
||||
void addSearchableHeader(in string headerName);
|
||||
boolean querySearchableHeader(in string headerName);
|
||||
|
||||
nsIMsgNewsFolder findGroup(in string name);
|
||||
nsIMsgNewsFolder findGroup(in AUTF8String name);
|
||||
|
||||
readonly attribute string firstGroupNeedingExtraInfo;
|
||||
void setGroupNeedsExtraInfo(in string name, in boolean needsExtraInfo);
|
||||
readonly attribute AUTF8String firstGroupNeedingExtraInfo;
|
||||
void setGroupNeedsExtraInfo(in AUTF8String name, in boolean needsExtraInfo);
|
||||
|
||||
void groupNotFound(in nsIMsgWindow window, in string group, in boolean opening);
|
||||
void groupNotFound(in nsIMsgWindow window, in AString group,
|
||||
in boolean opening);
|
||||
|
||||
void setPrettyNameForGroup(in string name, in string prettyName);
|
||||
void setPrettyNameForGroup(in AString name, in AString prettyName);
|
||||
};
|
||||
|
||||
@ -71,6 +71,7 @@ REQUIRES = xpcom \
|
||||
rdfutil \
|
||||
nkcache \
|
||||
windowwatcher \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
||||
@ -324,16 +324,16 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(nsIMsgWindow *aMsgWindow,
|
||||
rv = args->SetArticleCount(*last - *first + 1);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString groupName;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(groupName));
|
||||
nsXPIDLString groupName;
|
||||
rv = m_newsFolder->GetUnicodeName(groupName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = args->SetGroupName((const char *)groupName);
|
||||
rv = args->SetGroupName(groupName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// get the server key
|
||||
nsXPIDLCString serverKey;
|
||||
rv = server->GetKey(getter_Copies(serverKey));
|
||||
// get the server key
|
||||
nsXPIDLCString serverKey;
|
||||
rv = server->GetKey(getter_Copies(serverKey));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = args->SetServerKey((const char *)serverKey);
|
||||
|
||||
@ -60,6 +60,7 @@
|
||||
#include "nsIPipe.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsMsgI18N.h"
|
||||
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgNewsCID.h"
|
||||
@ -983,6 +984,8 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
rv = ParseURL(aURL, getter_Copies(group), &m_messageID, getter_Copies(commandSpecificData));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to parse news url");
|
||||
//if (NS_FAILED(rv)) return rv;
|
||||
// XXX group returned from ParseURL is assumed to be in UTF-8
|
||||
NS_ASSERTION(IsUTF8(group), "newsgroup name is not in UTF-8");
|
||||
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) m_messageID = %s",this, m_messageID?m_messageID:"(null)"));
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group = %s",this,group.get()));
|
||||
@ -1051,7 +1054,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
m_typeWanted = IDS_WANTED;
|
||||
m_commandSpecificData = ToNewCString(commandSpecificData);
|
||||
|
||||
rv = m_nntpServer->FindGroup(group.get(), getter_AddRefs(m_newsFolder));
|
||||
rv = m_nntpServer->FindGroup(group, getter_AddRefs(m_newsFolder));
|
||||
if (!m_newsFolder) goto FAIL;
|
||||
}
|
||||
else
|
||||
@ -1062,7 +1065,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
m_searchData = m_commandSpecificData;
|
||||
|
||||
|
||||
rv = m_nntpServer->FindGroup(group.get(), getter_AddRefs(m_newsFolder));
|
||||
rv = m_nntpServer->FindGroup(group, getter_AddRefs(m_newsFolder));
|
||||
if (!m_newsFolder) goto FAIL;
|
||||
}
|
||||
}
|
||||
@ -1082,7 +1085,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
if (m_nntpServer)
|
||||
{
|
||||
PRBool containsGroup = PR_TRUE;
|
||||
rv = m_nntpServer->ContainsNewsgroup(group.get(),&containsGroup);
|
||||
rv = m_nntpServer->ContainsNewsgroup(group, &containsGroup);
|
||||
if (NS_FAILED(rv)) goto FAIL;
|
||||
|
||||
if (!containsGroup)
|
||||
@ -1105,8 +1108,10 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
|
||||
// to handle non-ASCII newsgroup names, we store them internally as escaped.
|
||||
// decode and unescape the newsgroup name so we'll display a proper name.
|
||||
// to handle non-ASCII newsgroup names, we store them internally
|
||||
// as escaped. decode and unescape the newsgroup name so we'll
|
||||
// display a proper name.
|
||||
|
||||
nsAutoString unescapedName;
|
||||
rv = NS_MsgDecodeUnescapeURLPath(group, unescapedName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1125,7 +1130,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
|
||||
if (confirmResult)
|
||||
{
|
||||
rv = m_nntpServer->SubscribeToNewsgroup(group.get());
|
||||
rv = m_nntpServer->SubscribeToNewsgroup(group);
|
||||
containsGroup = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
@ -1150,7 +1155,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
// If we have a group (since before, or just subscribed), set the m_newsFolder.
|
||||
if (containsGroup)
|
||||
{
|
||||
rv = m_nntpServer->FindGroup(group.get(), getter_AddRefs(m_newsFolder));
|
||||
rv = m_nntpServer->FindGroup(group, getter_AddRefs(m_newsFolder));
|
||||
if (!m_newsFolder) goto FAIL;
|
||||
}
|
||||
}
|
||||
@ -1739,7 +1744,15 @@ PRInt32 nsNNTPProtocol::SendListSearchesResponse(nsIInputStream * inputStream, P
|
||||
|
||||
if ('.' != line[0])
|
||||
{
|
||||
m_nntpServer->AddSearchableGroup(line);
|
||||
nsCAutoString charset;
|
||||
nsAutoString lineUtf16;
|
||||
if (NS_FAILED(m_nntpServer->GetCharset(charset)) ||
|
||||
NS_FAILED(nsMsgI18NConvertToUnicode(charset.get(),
|
||||
nsDependentCString(line),
|
||||
lineUtf16, PR_TRUE)))
|
||||
CopyUTF8toUTF16(nsDependentCString(line), lineUtf16);
|
||||
|
||||
m_nntpServer->AddSearchableGroup(lineUtf16);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1931,37 +1944,39 @@ PRInt32 nsNNTPProtocol::SendListSubscriptionsResponse(nsIInputStream * inputStre
|
||||
|
||||
PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
||||
{
|
||||
char *command=0;
|
||||
PRInt32 status = 0;
|
||||
char *command=0;
|
||||
PRInt32 status = 0;
|
||||
|
||||
if (m_typeWanted == ARTICLE_WANTED) {
|
||||
if (m_key != nsMsgKey_None) {
|
||||
nsresult rv;
|
||||
if (m_typeWanted == ARTICLE_WANTED) {
|
||||
if (m_key != nsMsgKey_None) {
|
||||
nsresult rv;
|
||||
nsXPIDLCString newsgroupName;
|
||||
if (m_newsFolder) {
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(newsgroupName));
|
||||
rv = m_newsFolder->GetRawName(newsgroupName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) current group = %s, desired group = %s", this, m_currentGroup.get(), newsgroupName.get()));
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,
|
||||
("(%p) current group = %s, desired group = %s", this,
|
||||
m_currentGroup.get(), newsgroupName.get()));
|
||||
// if the current group is the desired group, we can just issue the ARTICLE command
|
||||
// if not, we have to do a GROUP first
|
||||
if (!PL_strcmp(m_currentGroup.get(), newsgroupName.get()))
|
||||
m_nextState = NNTP_SEND_ARTICLE_NUMBER;
|
||||
else
|
||||
m_nextState = NNTP_SEND_GROUP_FOR_ARTICLE;
|
||||
if (!PL_strcmp(m_currentGroup.get(), newsgroupName.get()))
|
||||
m_nextState = NNTP_SEND_ARTICLE_NUMBER;
|
||||
else
|
||||
m_nextState = NNTP_SEND_GROUP_FOR_ARTICLE;
|
||||
|
||||
ClearFlag(NNTP_PAUSE_FOR_READ);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
ClearFlag(NNTP_PAUSE_FOR_READ);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_typeWanted == NEWS_POST)
|
||||
{ /* posting to the news group */
|
||||
if(m_typeWanted == NEWS_POST)
|
||||
{ /* posting to the news group */
|
||||
NS_MsgSACopy(&command, "POST");
|
||||
}
|
||||
}
|
||||
else if(m_typeWanted == READ_NEWS_RC)
|
||||
{
|
||||
{
|
||||
/* extract post method from the url when we have it... */
|
||||
#ifdef HAVE_NEWS_URL
|
||||
if(ce->URL_s->method == URL_POST_METHOD ||
|
||||
@ -1971,7 +1986,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
||||
#endif
|
||||
m_nextState = NEWS_DISPLAY_NEWS_RC;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
else if(m_typeWanted == NEW_GROUPS)
|
||||
{
|
||||
PRUint32 last_update;
|
||||
@ -2050,7 +2065,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
||||
if (!m_newsFolder) return -1;
|
||||
|
||||
nsXPIDLCString group_name;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
rv = m_newsFolder->GetRawName(group_name);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get newsgroup name");
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
@ -2090,21 +2105,21 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) doing GROUP for XPAT", this));
|
||||
nsXPIDLCString group_name;
|
||||
|
||||
/* for XPAT, we have to GROUP into the group before searching */
|
||||
if (!m_newsFolder) {
|
||||
NNTP_LOG_NOTE("m_newsFolder is null, panic!");
|
||||
return -1;
|
||||
}
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
/* for XPAT, we have to GROUP into the group before searching */
|
||||
if (!m_newsFolder) {
|
||||
NNTP_LOG_NOTE("m_newsFolder is null, panic!");
|
||||
return -1;
|
||||
}
|
||||
rv = m_newsFolder->GetRawName(group_name);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
NS_MsgSACopy(&command, "GROUP ");
|
||||
NS_MsgSACopy(&command, "GROUP ");
|
||||
NS_MsgSACat (&command, group_name);
|
||||
|
||||
// force a GROUP next time
|
||||
m_currentGroup.Truncate();
|
||||
m_nextState = NNTP_RESPONSE;
|
||||
m_nextStateAfterResponse = NNTP_XPAT_SEND;
|
||||
m_nextState = NNTP_RESPONSE;
|
||||
m_nextStateAfterResponse = NNTP_XPAT_SEND;
|
||||
}
|
||||
}
|
||||
else if (m_typeWanted == PRETTY_NAMES_WANTED)
|
||||
@ -2203,18 +2218,20 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommandResponse()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsXPIDLCString group_name;
|
||||
nsXPIDLString group_name;
|
||||
NS_ASSERTION(m_newsFolder, "no newsFolder");
|
||||
if (m_newsFolder) {
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
rv = m_newsFolder->GetUnicodeName(group_name);
|
||||
}
|
||||
|
||||
if (m_responseCode == MK_NNTP_RESPONSE_GROUP_NO_GROUP &&
|
||||
m_typeWanted == GROUP_WANTED) {
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group (%s) not found, so unset m_currentGroup",this,(const char *)group_name));
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group (%s) not found, so unset"
|
||||
" m_currentGroup", this,
|
||||
NS_ConvertUTF16toUTF8(group_name).get()));
|
||||
m_currentGroup.Truncate();
|
||||
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, group_name.get(), PR_TRUE /* opening */);
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, group_name, PR_TRUE /* opening */);
|
||||
}
|
||||
|
||||
/* if the server returned a 400 error then it is an expected
|
||||
@ -2321,7 +2338,7 @@ PRInt32 nsNNTPProtocol::SendGroupForArticle()
|
||||
PRInt32 status = 0;
|
||||
|
||||
nsXPIDLCString groupname;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(groupname));
|
||||
rv = m_newsFolder->GetRawName(groupname);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && groupname.get() && groupname.get()[0], "no group name");
|
||||
|
||||
char outputBuffer[OUTPUT_BUFFER_SIZE];
|
||||
@ -2353,7 +2370,7 @@ nsNNTPProtocol::SetCurrentGroup()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(groupname));
|
||||
rv = m_newsFolder->GetRawName(groupname);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && groupname.get()[0], "no group name");
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) SetCurrentGroup to %s",this,(const char *)groupname));
|
||||
m_currentGroup = groupname;
|
||||
@ -2910,13 +2927,14 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32
|
||||
rv = m_nntpServer->QueryExtension("XACTIVE",&xactive);
|
||||
if (NS_SUCCEEDED(rv) && xactive)
|
||||
{
|
||||
nsXPIDLCString groupName;
|
||||
rv = m_nntpServer->GetFirstGroupNeedingExtraInfo(getter_Copies(groupName));
|
||||
nsCAutoString groupName;
|
||||
rv = m_nntpServer->GetFirstGroupNeedingExtraInfo(groupName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = m_nntpServer->FindGroup((const char *)groupName, getter_AddRefs(m_newsFolder));
|
||||
rv = m_nntpServer->FindGroup(groupName, getter_AddRefs(m_newsFolder));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "FindGroup failed");
|
||||
m_nextState = NNTP_LIST_XACTIVE;
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) listing xactive for %s", this, (const char *)groupName));
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) listing xactive for %s", this,
|
||||
groupName.get()));
|
||||
PR_Free(lineToFree);
|
||||
return 0;
|
||||
}
|
||||
@ -2993,7 +3011,16 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32
|
||||
rv = m_nntpServer->QueryExtension("XACTIVE",&xactive);
|
||||
if (NS_SUCCEEDED(rv) && xactive)
|
||||
{
|
||||
m_nntpServer->SetGroupNeedsExtraInfo(line, PR_TRUE);
|
||||
nsCAutoString charset;
|
||||
nsAutoString lineUtf16;
|
||||
if (NS_SUCCEEDED(m_nntpServer->GetCharset(charset)) &&
|
||||
NS_SUCCEEDED(nsMsgI18NConvertToUnicode(charset.get(),
|
||||
nsDependentCString(line),
|
||||
lineUtf16, PR_TRUE)))
|
||||
m_nntpServer->SetGroupNeedsExtraInfo(NS_ConvertUTF16toUTF8(lineUtf16),
|
||||
PR_TRUE);
|
||||
else
|
||||
m_nntpServer->SetGroupNeedsExtraInfo(nsDependentCString(line), PR_TRUE);
|
||||
}
|
||||
|
||||
PR_Free(lineToFree);
|
||||
@ -3878,7 +3905,7 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
|
||||
if (!m_newsFolder) return -1;
|
||||
|
||||
nsXPIDLCString name;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(name));
|
||||
rv = m_newsFolder->GetRawName(name);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
if (!name) return -1;
|
||||
|
||||
@ -3967,11 +3994,11 @@ PRInt32 nsNNTPProtocol::DisplayNewsRCResponse()
|
||||
}
|
||||
else if (m_responseCode == MK_NNTP_RESPONSE_GROUP_NO_GROUP)
|
||||
{
|
||||
nsXPIDLCString name;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(name));
|
||||
nsXPIDLString name;
|
||||
rv = m_newsFolder->GetUnicodeName(name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, name.get(), PR_FALSE);
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, name, PR_FALSE);
|
||||
}
|
||||
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) NO_GROUP, so unset m_currentGroup", this));
|
||||
@ -4403,7 +4430,7 @@ PRInt32 nsNNTPProtocol::ListPrettyNames()
|
||||
char outputBuffer[OUTPUT_BUFFER_SIZE];
|
||||
PRInt32 status = 0;
|
||||
|
||||
nsresult rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
nsresult rv = m_newsFolder->GetRawName(group_name);
|
||||
PR_snprintf(outputBuffer,
|
||||
OUTPUT_BUFFER_SIZE,
|
||||
"LIST PRETTYNAMES %.512s" CRLF,
|
||||
@ -4421,7 +4448,6 @@ PRInt32 nsNNTPProtocol::ListPrettyNames()
|
||||
|
||||
PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PRUint32 length)
|
||||
{
|
||||
char *prettyName;
|
||||
PRUint32 status = 0;
|
||||
|
||||
if (m_responseCode != MK_NNTP_RESPONSE_LIST_OK)
|
||||
@ -4447,21 +4473,34 @@ PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PR
|
||||
{
|
||||
if (line[0] != '.')
|
||||
{
|
||||
#if 0 // SetPrettyName is not yet implemented. No reason to bother
|
||||
int i;
|
||||
/* find whitespace separator if it exits */
|
||||
for (i=0; line[i] != '\0' && !NET_IS_SPACE(line[i]); i++)
|
||||
; /* null body */
|
||||
|
||||
char *prettyName;
|
||||
if(line[i] == '\0')
|
||||
prettyName = &line[i];
|
||||
else
|
||||
prettyName = &line[i+1];
|
||||
|
||||
line[i] = 0; /* terminate group name */
|
||||
if (i > 0)
|
||||
m_nntpServer->SetPrettyNameForGroup(line, prettyName);
|
||||
if (i > 0) {
|
||||
nsCAutoString charset;
|
||||
nsAutoString lineUtf16, prettyNameUtf16;
|
||||
if (NS_FAILED(m_nntpServer->GetCharset(charset) ||
|
||||
NS_FAILED(ConvertToUnicode(charset, line, lineUtf16)) ||
|
||||
NS_FAILED(ConvertToUnicode(charset, prettyName, prettyNameUtf16)))) {
|
||||
CopyUTF8toUTF16(line, lineUtf16);
|
||||
CopyUTF8toUTF16(prettyName, prettyNameUtf16);
|
||||
}
|
||||
m_nntpServer->SetPrettyNameForGroup(lineUtf16, prettyNameUtf16);
|
||||
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) adding pretty name %s", this, prettyName));
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) adding pretty name %s", this,
|
||||
NS_ConvertUTF16toUTF8(prettyNameUtf16).get()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4480,7 +4519,7 @@ PRInt32 nsNNTPProtocol::ListXActive()
|
||||
{
|
||||
nsXPIDLCString group_name;
|
||||
nsresult rv;
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
rv = m_newsFolder->GetRawName(group_name);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
PRInt32 status = 0;
|
||||
@ -4586,9 +4625,10 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
||||
old_newsFolder = m_newsFolder;
|
||||
nsXPIDLCString groupName;
|
||||
|
||||
rv = m_nntpServer->GetFirstGroupNeedingExtraInfo(getter_Copies(groupName));
|
||||
rv = m_nntpServer->GetFirstGroupNeedingExtraInfo(groupName);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
rv = m_nntpServer->FindGroup(groupName, getter_AddRefs(m_newsFolder));
|
||||
rv = m_nntpServer->FindGroup(groupName,
|
||||
getter_AddRefs(m_newsFolder));
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
// see if we got a different group
|
||||
@ -4633,7 +4673,7 @@ PRInt32 nsNNTPProtocol::SendListGroup()
|
||||
if (!m_newsFolder) return -1;
|
||||
nsXPIDLCString newsgroupName;
|
||||
|
||||
rv = m_newsFolder->GetAsciiName(getter_Copies(newsgroupName));
|
||||
rv = m_newsFolder->GetRawName(newsgroupName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PR_snprintf(outputBuffer,
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
|
||||
nsNewsDownloadDialogArgs::nsNewsDownloadDialogArgs()
|
||||
{
|
||||
mGroupName = "";
|
||||
mArticleCount = 0;
|
||||
mServerKey = "";
|
||||
mHitOK = PR_FALSE;
|
||||
@ -55,22 +54,19 @@ nsNewsDownloadDialogArgs::~nsNewsDownloadDialogArgs()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNewsDownloadDialogArgs, nsINewsDownloadDialogArgs)
|
||||
|
||||
NS_IMETHODIMP nsNewsDownloadDialogArgs::GetGroupName(char * *aGroupName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aGroupName);
|
||||
|
||||
*aGroupName = ToNewCString(mGroupName);
|
||||
|
||||
NS_IMETHODIMP nsNewsDownloadDialogArgs::GetGroupName(nsAString & aGroupName)
|
||||
{
|
||||
aGroupName = mGroupName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsNewsDownloadDialogArgs::SetGroupName(const char * aGroupName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aGroupName);
|
||||
|
||||
mGroupName = aGroupName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
NS_IMETHODIMP nsNewsDownloadDialogArgs::SetGroupName(const nsAString & aGroupName)
|
||||
{
|
||||
|
||||
mGroupName = aGroupName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsNewsDownloadDialogArgs::GetArticleCount(PRInt32 *aArticleCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aArticleCount);
|
||||
|
||||
@ -52,7 +52,7 @@ public:
|
||||
NS_DECL_NSINEWSDOWNLOADDIALOGARGS
|
||||
|
||||
private:
|
||||
nsCString mGroupName;
|
||||
nsString mGroupName;
|
||||
PRInt32 mArticleCount;
|
||||
nsCString mServerKey;
|
||||
PRBool mHitOK;
|
||||
|
||||
@ -93,6 +93,9 @@
|
||||
#include "nsNewsDownloader.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
@ -117,7 +120,7 @@ nsMsgNewsFolder::nsMsgNewsFolder(void) : nsMsgLineBuffer(nsnull, PR_FALSE),
|
||||
mExpungedBytes(0), mGettingNews(PR_FALSE),
|
||||
mInitialized(PR_FALSE), mOptionLines(""), mUnsubscribedNewsgroupLines(""),
|
||||
m_downloadMessageForOfflineUse(PR_FALSE), m_downloadingMultipleMessages(PR_FALSE),
|
||||
mReadSet(nsnull), mGroupUsername(nsnull), mGroupPassword(nsnull), mAsciiName(nsnull)
|
||||
mReadSet(nsnull), mGroupUsername(nsnull), mGroupPassword(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsNewsFolder); // double count these for now.
|
||||
/* we're parsing the newsrc file, and the line breaks are platform specific.
|
||||
@ -133,7 +136,6 @@ nsMsgNewsFolder::~nsMsgNewsFolder(void)
|
||||
delete mReadSet;
|
||||
PR_Free(mGroupUsername);
|
||||
PR_Free(mGroupPassword);
|
||||
PR_Free(mAsciiName);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsMsgNewsFolder, nsMsgDBFolder)
|
||||
@ -190,13 +192,13 @@ nsMsgNewsFolder::CreateSubFolders(nsFileSpec &path)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::AddNewsgroup(const char *name, const char *setStr, nsIMsgFolder **child)
|
||||
nsMsgNewsFolder::AddNewsgroup(const nsACString &name, const char *setStr,
|
||||
nsIMsgFolder **child)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(child);
|
||||
NS_ENSURE_ARG_POINTER(setStr);
|
||||
NS_ENSURE_ARG_POINTER(name);
|
||||
|
||||
nsCOMPtr <nsIRDFService> rdf = do_GetService(kRDFServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@ -210,19 +212,18 @@ nsMsgNewsFolder::AddNewsgroup(const char *name, const char *setStr, nsIMsgFolder
|
||||
uri.Append('/');
|
||||
// URI should use UTF-8
|
||||
// (see RFC2396 Uniform Resource Identifiers (URI): Generic Syntax)
|
||||
// since we are forcing it to be latin-1 (IS0-8859-1)
|
||||
// we can just assign with conversion
|
||||
nsAutoString newsgroupName;
|
||||
newsgroupName.AssignWithConversion(name);
|
||||
|
||||
// we are handling newsgroup names in UTF-8
|
||||
NS_ConvertUTF8toUTF16 nameUtf16(name);
|
||||
|
||||
nsCAutoString escapedName;
|
||||
rv = NS_MsgEscapeEncodeURLPath(newsgroupName, escapedName);
|
||||
rv = NS_MsgEscapeEncodeURLPath(nameUtf16, escapedName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nntpServer->AddNewsgroup(escapedName.get());
|
||||
rv = nntpServer->AddNewsgroup(nameUtf16);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uri.Append(escapedName.get());
|
||||
uri.Append(escapedName);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
@ -241,7 +242,7 @@ nsMsgNewsFolder::AddNewsgroup(const char *name, const char *setStr, nsIMsgFolder
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// this what shows up in the UI
|
||||
rv = folder->SetName(newsgroupName.get());
|
||||
rv = folder->SetName(nameUtf16.get());
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = folder->SetFlag(MSG_FOLDER_FLAG_NEWSGROUP);
|
||||
@ -516,8 +517,8 @@ NS_IMETHODIMP nsMsgNewsFolder::GetFolderURL(char **url)
|
||||
|
||||
nsXPIDLCString hostName;
|
||||
nsresult rv = GetHostname(getter_Copies(hostName));
|
||||
nsXPIDLCString groupName;
|
||||
rv = GetAsciiName(getter_Copies(groupName));
|
||||
nsXPIDLString groupName;
|
||||
rv = GetName(getter_Copies(groupName));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
@ -531,7 +532,11 @@ NS_IMETHODIMP nsMsgNewsFolder::GetFolderURL(char **url)
|
||||
rv = server->GetPort(&port);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
const char *newsScheme = (isSecure) ? SNEWS_SCHEME : NEWS_SCHEME;
|
||||
*url = PR_smprintf("%s//%s:%ld/%s", newsScheme, hostName.get(), port, groupName.get());
|
||||
nsXPIDLCString escapedName;
|
||||
rv = NS_MsgEscapeEncodeURLPath(groupName, escapedName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*url = PR_smprintf("%s//%s:%ld/%s", newsScheme, hostName.get(), port,
|
||||
escapedName.get());
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
@ -547,22 +552,13 @@ NS_IMETHODIMP nsMsgNewsFolder::SetNewsrcHasChanged(PRBool newsrcHasChanged)
|
||||
return nntpServer->SetNewsrcHasChanged(newsrcHasChanged);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const PRUnichar *uninewsgroupname, nsIMsgWindow *msgWindow)
|
||||
NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const PRUnichar *newsgroupName,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(uninewsgroupname);
|
||||
if (!*uninewsgroupname) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString newsgroupname;
|
||||
newsgroupname.AssignWithConversion(uninewsgroupname);
|
||||
|
||||
nsFileSpec path;
|
||||
nsCOMPtr<nsIFileSpec> pathSpec;
|
||||
rv = GetPath(getter_AddRefs(pathSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = pathSpec->GetFileSpec(&path);
|
||||
NS_ENSURE_ARG_POINTER(newsgroupName);
|
||||
if (!*newsgroupName) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> child;
|
||||
|
||||
@ -570,23 +566,25 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const PRUnichar *uninewsgroupname
|
||||
nsCOMPtr<nsIMsgDatabase> newsDBFactory;
|
||||
nsCOMPtr <nsIMsgDatabase> newsDB;
|
||||
|
||||
//Now we have a valid directory or we have returned.
|
||||
//Make sure the new folder name is valid
|
||||
|
||||
// remember, some file systems (like mac) can't handle long file names
|
||||
nsCAutoString hashedName = newsgroupname;
|
||||
rv = NS_MsgHashIfNecessary(hashedName);
|
||||
path += hashedName.get();
|
||||
|
||||
//Now let's create the actual new folder
|
||||
rv = AddNewsgroup(newsgroupname.get(), "", getter_AddRefs(child));
|
||||
rv = AddNewsgroup(NS_ConvertUTF16toUTF8(newsgroupName), "",
|
||||
getter_AddRefs(child));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
SetNewsrcHasChanged(PR_TRUE); // subscribe UI does this - but maybe we got here through auto-subscribe
|
||||
|
||||
if(NS_SUCCEEDED(rv) && child)
|
||||
NotifyItemAdded(child);
|
||||
if(NS_SUCCEEDED(rv) && child){
|
||||
nsCOMPtr <nsINntpIncomingServer> nntpServer;
|
||||
rv = GetNntpServer(getter_AddRefs(nntpServer));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString dataCharset;
|
||||
rv = nntpServer->GetCharset(dataCharset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
child->SetCharset(dataCharset.get());
|
||||
NotifyItemAdded(child);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -619,15 +617,11 @@ NS_IMETHODIMP nsMsgNewsFolder::Delete()
|
||||
rv = GetNntpServer(getter_AddRefs(nntpServer));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLString name;
|
||||
rv = GetName(getter_Copies(name));
|
||||
nsAutoString name;
|
||||
rv = GetUnicodeName(name);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCAutoString escapedName;
|
||||
rv = NS_MsgEscapeEncodeURLPath(name, escapedName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = nntpServer->RemoveNewsgroup(escapedName.get());
|
||||
rv = nntpServer->RemoveNewsgroup(name);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = SetNewsrcHasChanged(PR_TRUE);
|
||||
@ -1134,7 +1128,7 @@ nsMsgNewsFolder::HandleNewsrcLine(char* line, PRUint32 line_size)
|
||||
// we're subscribed, so add it
|
||||
nsCOMPtr <nsIMsgFolder> child;
|
||||
|
||||
rv = AddNewsgroup(line, setStr, getter_AddRefs(child));
|
||||
rv = AddNewsgroup(nsDependentCString(line), setStr, getter_AddRefs(child));
|
||||
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
}
|
||||
@ -1508,12 +1502,13 @@ nsMsgNewsFolder::GetNewsrcLine(char **newsrcLine)
|
||||
|
||||
if (!newsrcLine) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsXPIDLCString newsgroupname;
|
||||
rv = GetAsciiName(getter_Copies(newsgroupname));
|
||||
nsXPIDLString newsgroupNameUtf16;
|
||||
rv = GetName(getter_Copies(newsgroupNameUtf16));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ConvertUTF16toUTF8 newsgroupName(newsgroupNameUtf16);
|
||||
|
||||
nsCAutoString newsrcLineStr;
|
||||
newsrcLineStr = newsgroupname;
|
||||
newsrcLineStr = newsgroupName;
|
||||
newsrcLineStr += ':';
|
||||
|
||||
if (mReadSet) {
|
||||
@ -1580,28 +1575,45 @@ nsMsgNewsFolder::OnReadChanged(nsIDBChangeListener * aInstigator)
|
||||
return SetNewsrcHasChanged(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetUnicodeName(nsAString & aName)
|
||||
{
|
||||
nsXPIDLString newsgroupName;
|
||||
nsresult rv = GetName(getter_Copies(newsgroupName));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
aName = newsgroupName;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetAsciiName(char **asciiName)
|
||||
nsMsgNewsFolder::GetRawName(nsACString & aRawName)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(asciiName);
|
||||
if (!mAsciiName)
|
||||
if (mRawName.IsEmpty())
|
||||
{
|
||||
nsXPIDLString name;
|
||||
rv = GetName(getter_Copies(name));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// convert to ASCII
|
||||
// convert to the server-side encoding
|
||||
nsCAutoString tmpStr;
|
||||
tmpStr.AssignWithConversion(name);
|
||||
nsCOMPtr <nsINntpIncomingServer> nntpServer;
|
||||
rv = GetNntpServer(getter_AddRefs(nntpServer));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
mAsciiName = nsCRT::strdup(tmpStr.get());
|
||||
if (!mAsciiName) return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCAutoString dataCharset;
|
||||
rv = nntpServer->GetCharset(dataCharset);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = nsMsgI18NConvertFromUnicode(dataCharset.get(), name, tmpStr);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LossyCopyUTF16toASCII(name,tmpStr);
|
||||
}
|
||||
|
||||
mRawName = tmpStr;
|
||||
}
|
||||
|
||||
*asciiName = nsCRT::strdup(mAsciiName);
|
||||
if (!*asciiName) return NS_ERROR_OUT_OF_MEMORY;
|
||||
aRawName = mRawName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1944,4 +1956,3 @@ nsMsgNewsFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||
m_downloadingMultipleMessages = PR_FALSE;
|
||||
return nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +125,7 @@ public:
|
||||
virtual PRInt32 HandleLine(char *line, PRUint32 line_size);
|
||||
|
||||
protected:
|
||||
// helper routine to parse the URI and update member variables
|
||||
nsresult AbbreviatePrettyName(PRUnichar ** prettyName, PRInt32 fullwords);
|
||||
nsresult ParseFolder(nsFileSpec& path);
|
||||
nsresult CreateSubFolders(nsFileSpec &path);
|
||||
@ -161,7 +162,7 @@ protected:
|
||||
char *mGroupPassword;
|
||||
|
||||
// the name of the newsgroup.
|
||||
char *mAsciiName;
|
||||
nsCString mRawName;
|
||||
PRInt32 mSortOrder;
|
||||
|
||||
private:
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsNntpIncomingServer.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIMsgNewsFolder.h"
|
||||
@ -62,12 +61,16 @@
|
||||
#include "nsITreeColumns.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsEscape.h"
|
||||
|
||||
#define INVALID_VERSION 0
|
||||
#define VALID_VERSION 1
|
||||
#define NEW_NEWS_DIR_NAME "News"
|
||||
#define PREF_MAIL_NEWSRC_ROOT "mail.newsrc_root"
|
||||
#define PREF_MAIL_NEWSRC_ROOT_REL "mail.newsrc_root-rel"
|
||||
#define PREF_MAILNEWS_VIEW_DEFAULT_CHARSET "mailnews.view_default_charset"
|
||||
#define HOSTINFO_FILE_NAME "hostinfo.dat"
|
||||
|
||||
#define NEWS_DELIMITER '.'
|
||||
@ -308,6 +311,40 @@ nsresult nsNntpIncomingServer::SetupNewsrcSaveTimer()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetCharset(const nsACString & aCharset)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = SetCharValue("charset", PromiseFlatCString(aCharset).get());
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetCharset(nsACString & aCharset)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString serverCharset;
|
||||
//first we get the per-server settings mail.server.<serverkey>.charset
|
||||
rv = GetCharValue("charset",getter_Copies(serverCharset));
|
||||
|
||||
//if the per-server setting is empty,we get the default charset from
|
||||
//mailnews.view_default_charset setting and set it as per-server preference.
|
||||
if(serverCharset.IsEmpty()){
|
||||
nsXPIDLString defaultCharset;
|
||||
rv = NS_GetUnicharPreferenceWithDefault(nsnull,
|
||||
PREF_MAILNEWS_VIEW_DEFAULT_CHARSET,
|
||||
NS_LITERAL_STRING("ISO-8859-1"), defaultCharset);
|
||||
LossyCopyUTF16toASCII(defaultCharset,serverCharset);
|
||||
SetCharset(serverCharset);
|
||||
}
|
||||
#ifdef DEBUG_holywen
|
||||
printf("default charset for the server is %s\n",
|
||||
(const char *)serverCharset);
|
||||
#endif
|
||||
aCharset = serverCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::WriteNewsrcFile()
|
||||
{
|
||||
@ -748,48 +785,45 @@ nsNntpIncomingServer::OnStopRunningUrl(nsIURI *url, nsresult exitCode)
|
||||
PRBool
|
||||
checkIfSubscribedFunction(nsCString &aElement, void *aData)
|
||||
{
|
||||
if (nsCRT::strcmp((const char *)aData, aElement.get()) == 0) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (aElement.Equals(*NS_STATIC_CAST(nsACString *, aData))) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::ContainsNewsgroup(const char *name, PRBool *containsGroup)
|
||||
nsNntpIncomingServer::ContainsNewsgroup(const nsACString &name,
|
||||
PRBool *containsGroup)
|
||||
{
|
||||
NS_ASSERTION(name && strlen(name),"no name");
|
||||
if (!name || !containsGroup) return NS_ERROR_NULL_POINTER;
|
||||
if (!strlen(name)) return NS_ERROR_FAILURE;
|
||||
if (name.IsEmpty()) return NS_ERROR_FAILURE;
|
||||
nsCAutoString unescapedName;
|
||||
NS_UnescapeURL(PromiseFlatCString(name),
|
||||
esc_FileBaseName|esc_Forced|esc_AlwaysCopy, unescapedName);
|
||||
|
||||
*containsGroup = !(mSubscribedNewsgroups.EnumerateForwards((nsCStringArrayEnumFunc)checkIfSubscribedFunction, (void *)name));
|
||||
return NS_OK;
|
||||
*containsGroup = !(mSubscribedNewsgroups.EnumerateForwards(
|
||||
nsCStringArrayEnumFunc(checkIfSubscribedFunction),
|
||||
(void *) &unescapedName));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SubscribeToNewsgroup(const char *name)
|
||||
nsNntpIncomingServer::SubscribeToNewsgroup(const nsACString &aName)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(!aName.IsEmpty(), "no name");
|
||||
if (aName.IsEmpty()) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ASSERTION(name && strlen(name),"no name");
|
||||
if (!name) return NS_ERROR_NULL_POINTER;
|
||||
if (!strlen(name)) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIMsgFolder> msgfolder;
|
||||
nsresult rv = GetRootMsgFolder(getter_AddRefs(msgfolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!msgfolder) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgfolder;
|
||||
rv = GetRootMsgFolder(getter_AddRefs(msgfolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!msgfolder) return NS_ERROR_FAILURE;
|
||||
rv = msgfolder->CreateSubfolder(NS_ConvertUTF8toUTF16(aName).get(), nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString newsgroupName;
|
||||
rv = NS_MsgDecodeUnescapeURLPath(nsDependentCString(name), newsgroupName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = msgfolder->CreateSubfolder(newsgroupName.get(), nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -803,18 +837,8 @@ writeGroupToHostInfoFile(nsCString &aElement, void *aData)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = NS_MsgDecodeUnescapeURLPath(aElement, name);
|
||||
if (NS_FAILED(rv)) {
|
||||
// stop, something is bad.
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCAutoString nameOnDisk;
|
||||
nameOnDisk.AssignWithConversion(name.get());
|
||||
|
||||
// XXX todo ",,1,0,0" is a temporary hack, fix it
|
||||
*stream << nameOnDisk.get() << ",,1,0,0" << MSG_LINEBREAK;
|
||||
*stream << aElement.get() << ",,1,0,0" << MSG_LINEBREAK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -1014,14 +1038,36 @@ nsNntpIncomingServer::StartPopulating(nsIMsgWindow *aMsgWindow, PRBool aForceToS
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is the entry point for |nsNNTPProtocol| class. |aName| is now
|
||||
* encoded in the serverside character encoding, but we need to handle
|
||||
* newsgroup names in UTF-8 internally, So we convert |aName| to
|
||||
* UTF-8 here for later use.
|
||||
**/
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::AddNewsgroupToList(const char *aName)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
rv = AddTo(aName, PR_FALSE, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_OK;
|
||||
nsAutoString newsgroupName;
|
||||
nsCAutoString dataCharset;
|
||||
rv = GetCharset(dataCharset);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = nsMsgI18NConvertToUnicode(dataCharset.get(),
|
||||
nsDependentCString(aName),
|
||||
newsgroupName);
|
||||
#ifdef DEBUG_jungshik
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "newsgroup name conversion failed");
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
CopyASCIItoUTF16(aName, newsgroupName);
|
||||
}
|
||||
|
||||
rv = AddTo(NS_ConvertUTF16toUTF8(newsgroupName),
|
||||
PR_FALSE, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1091,9 +1137,9 @@ nsNntpIncomingServer::SetDelimiter(char aDelimiter)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetAsSubscribed(const char *path)
|
||||
nsNntpIncomingServer::SetAsSubscribed(const nsACString &path)
|
||||
{
|
||||
mTempSubscribed.AppendCString(nsCAutoString(path));
|
||||
mTempSubscribed.AppendCString(path);
|
||||
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1111,7 +1157,7 @@ setAsSubscribedFunction(nsCString &aElement, void *aData)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
rv = server->SetAsSubscribed(aElement.get());
|
||||
rv = server->SetAsSubscribed(aElement);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"SetAsSubscribed failed");
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -1127,24 +1173,19 @@ nsNntpIncomingServer::UpdateSubscribed()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool aSubscribable, PRBool changeIfExists)
|
||||
nsNntpIncomingServer::AddTo(const nsACString &aName, PRBool addAsSubscribed,
|
||||
PRBool aSubscribable, PRBool changeIfExists)
|
||||
{
|
||||
NS_ASSERTION(IsUTF8(aName), "Non-UTF-8 newsgroup name");
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoString newsgroupName;
|
||||
newsgroupName.AssignWithConversion(aName);
|
||||
|
||||
char *escapedName = nsEscape(NS_ConvertUCS2toUTF8(newsgroupName.get()).get(), url_Path);
|
||||
if (!escapedName) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = AddGroupOnServer(escapedName);
|
||||
rv = AddGroupOnServer(aName);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mInner->AddTo(escapedName,addAsSubscribed, aSubscribable, changeIfExists);
|
||||
rv = mInner->AddTo(aName, addAsSubscribed, aSubscribable, changeIfExists);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PR_FREEIF(escapedName);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1194,7 +1235,7 @@ nsNntpIncomingServer::GetSubscribeListener(nsISubscribeListener **aListener)
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::Subscribe(const PRUnichar *aUnicharName)
|
||||
{
|
||||
return SubscribeToNewsgroup(NS_LossyConvertUCS2toASCII(aUnicharName).get());
|
||||
return SubscribeToNewsgroup(NS_ConvertUTF16toUTF8(aUnicharName));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1209,14 +1250,16 @@ nsNntpIncomingServer::Unsubscribe(const PRUnichar *aUnicharName)
|
||||
|
||||
if (!serverFolder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
// to handle non-ASCII newsgroup names, we store them internally as escaped.
|
||||
// so we need to escape and encode the name, in order to find it.
|
||||
nsCAutoString escapedName;
|
||||
rv = NS_MsgEscapeEncodeURLPath(nsDependentString(aUnicharName), escapedName);
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> newsgroupFolder;
|
||||
rv = serverFolder->FindSubFolder(escapedName, getter_AddRefs(newsgroupFolder));
|
||||
rv = serverFolder->FindSubFolder(escapedName,
|
||||
getter_AddRefs(newsgroupFolder));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -1238,26 +1281,31 @@ nsNntpIncomingServer::Unsubscribe(const PRUnichar *aUnicharName)
|
||||
PRInt32
|
||||
nsNntpIncomingServer::HandleLine(char* line, PRUint32 line_size)
|
||||
{
|
||||
NS_ASSERTION(line, "line is null");
|
||||
if (!line) return 0;
|
||||
NS_ASSERTION(line, "line is null");
|
||||
if (!line) return 0;
|
||||
|
||||
// skip blank lines and comments
|
||||
if (line[0] == '#' || line[0] == '\0') return 0;
|
||||
// skip blank lines and comments
|
||||
if (line[0] == '#' || line[0] == '\0') return 0;
|
||||
|
||||
line[line_size] = 0;
|
||||
line[line_size] = 0;
|
||||
|
||||
if (mHasSeenBeginGroups) {
|
||||
char *commaPos = PL_strchr(line,',');
|
||||
if (commaPos) *commaPos = 0;
|
||||
if (mHasSeenBeginGroups) {
|
||||
char *commaPos = PL_strchr(line,',');
|
||||
if (commaPos) *commaPos = 0;
|
||||
|
||||
nsresult rv = AddTo(line, PR_FALSE, PR_TRUE, PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to add line");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// since we've seen one group, we can claim we've loaded the hostinfo file
|
||||
mHostInfoLoaded = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// newsrc entries are all in UTF-8
|
||||
#ifdef DEBUG_jungshik
|
||||
NS_ASSERTION(IsUTF8(nsDependentCString(line)), "newsrc line is not utf-8");
|
||||
#endif
|
||||
nsresult rv = AddTo(nsDependentCString(line), PR_FALSE, PR_TRUE, PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to add line");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// since we've seen one group, we can claim we've loaded the
|
||||
// hostinfo file
|
||||
mHostInfoLoaded = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (nsCRT::strncmp(line,"begingroups", 11) == 0) {
|
||||
mHasSeenBeginGroups = PR_TRUE;
|
||||
}
|
||||
@ -1281,30 +1329,31 @@ nsNntpIncomingServer::HandleLine(char* line, PRUint32 line_size)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNntpIncomingServer::AddGroupOnServer(const char *name)
|
||||
nsNntpIncomingServer::AddGroupOnServer(const nsACString &aName)
|
||||
{
|
||||
mGroupsOnServer.AppendCString(nsCAutoString(name));
|
||||
mGroupsOnServer.AppendCString(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::AddNewsgroup(const char *name)
|
||||
nsNntpIncomingServer::AddNewsgroup(const nsAString &aName)
|
||||
{
|
||||
// handle duplicates?
|
||||
mSubscribedNewsgroups.AppendCString(nsCAutoString(name));
|
||||
return NS_OK;
|
||||
// handle duplicates?
|
||||
mSubscribedNewsgroups.AppendCString(NS_ConvertUTF16toUTF8(aName));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::RemoveNewsgroup(const char *name)
|
||||
nsNntpIncomingServer::RemoveNewsgroup(const nsAString &aName)
|
||||
{
|
||||
// handle duplicates?
|
||||
mSubscribedNewsgroups.RemoveCString(nsCAutoString(name));
|
||||
return NS_OK;
|
||||
// handle duplicates?
|
||||
mSubscribedNewsgroups.RemoveCString(NS_ConvertUTF16toUTF8(aName));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetState(const char *path, PRBool state, PRBool *stateChanged)
|
||||
nsNntpIncomingServer::SetState(const nsACString &path, PRBool state,
|
||||
PRBool *stateChanged)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1312,15 +1361,15 @@ nsNntpIncomingServer::SetState(const char *path, PRBool state, PRBool *stateChan
|
||||
rv = mInner->SetState(path, state, stateChanged);
|
||||
if (*stateChanged) {
|
||||
if (state)
|
||||
mTempSubscribed.AppendCString(nsCAutoString(path));
|
||||
mTempSubscribed.AppendCString(path);
|
||||
else
|
||||
mTempSubscribed.RemoveCString(nsCAutoString(path));
|
||||
mTempSubscribed.RemoveCString(path);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
nsNntpIncomingServer::HasChildren(const nsACString &path, PRBool *aHasChildren)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1328,7 +1377,8 @@ nsNntpIncomingServer::HasChildren(const char *path, PRBool *aHasChildren)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
nsNntpIncomingServer::IsSubscribed(const nsACString &path,
|
||||
PRBool *aIsSubscribed)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1336,7 +1386,8 @@ nsNntpIncomingServer::IsSubscribed(const char *path, PRBool *aIsSubscribed)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
nsNntpIncomingServer::IsSubscribable(const nsACString &path,
|
||||
PRBool *aIsSubscribable)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1344,7 +1395,7 @@ nsNntpIncomingServer::IsSubscribable(const char *path, PRBool *aIsSubscribable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
nsNntpIncomingServer::GetLeafName(const nsACString &path, nsAString &aLeafName)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1352,7 +1403,7 @@ nsNntpIncomingServer::GetLeafName(const char *path, PRUnichar **aLeafName)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
nsNntpIncomingServer::GetFirstChildURI(const nsACString &path, nsACString &aResult)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1360,7 +1411,8 @@ nsNntpIncomingServer::GetFirstChildURI(const char * path, char **aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetChildren(const char *path, nsISupportsArray *array)
|
||||
nsNntpIncomingServer::GetChildren(const nsACString &path,
|
||||
nsISupportsArray *array)
|
||||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
@ -1507,14 +1559,14 @@ nsNntpIncomingServer::QueryPropertyForGet(const char *name, char **value)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::AddSearchableGroup(const char *name)
|
||||
nsNntpIncomingServer::AddSearchableGroup(const nsAString &name)
|
||||
{
|
||||
NS_ASSERTION(0,"not implemented");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::QuerySearchableGroup(const char *name, PRBool *result)
|
||||
nsNntpIncomingServer::QuerySearchableGroup(const nsAString &name, PRBool *result)
|
||||
{
|
||||
NS_ASSERTION(0,"not implemented");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@ -1535,9 +1587,8 @@ nsNntpIncomingServer::QuerySearchableHeader(const char *name, PRBool *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::FindGroup(const char *name, nsIMsgNewsFolder **result)
|
||||
nsNntpIncomingServer::FindGroup(const nsACString &name, nsIMsgNewsFolder **result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(name);
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
|
||||
nsresult rv;
|
||||
@ -1548,7 +1599,7 @@ nsNntpIncomingServer::FindGroup(const char *name, nsIMsgNewsFolder **result)
|
||||
if (!serverFolder) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> subFolder;
|
||||
rv = serverFolder->FindSubFolder(nsDependentCString(name), getter_AddRefs(subFolder));
|
||||
rv = serverFolder->FindSubFolder(name, getter_AddRefs(subFolder));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (!subFolder) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1559,14 +1610,15 @@ nsNntpIncomingServer::FindGroup(const char *name, nsIMsgNewsFolder **result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetFirstGroupNeedingExtraInfo(char **result)
|
||||
nsNntpIncomingServer::GetFirstGroupNeedingExtraInfo(nsACString &result)
|
||||
{
|
||||
NS_ASSERTION(0,"not implemented");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetGroupNeedsExtraInfo(const char *name, PRBool needsExtraInfo)
|
||||
nsNntpIncomingServer::SetGroupNeedsExtraInfo(const nsACString &name,
|
||||
PRBool needsExtraInfo)
|
||||
{
|
||||
NS_ASSERTION(0,"not implemented");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@ -1574,10 +1626,9 @@ nsNntpIncomingServer::SetGroupNeedsExtraInfo(const char *name, PRBool needsExtra
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName, PRBool aOpening)
|
||||
nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow,
|
||||
const nsAString &aName, PRBool aOpening)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIPrompt> prompt;
|
||||
|
||||
@ -1599,17 +1650,14 @@ nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName,
|
||||
rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoString groupStr;
|
||||
groupStr.AssignWithConversion(aName);
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
rv = GetHostName(getter_Copies(hostname));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(hostname.get());
|
||||
NS_ConvertUTF8toUTF16 hostStr(hostname);
|
||||
|
||||
const PRUnichar *formatStrings[2] = { groupStr.get(), hostStr.get() };
|
||||
nsAFlatString groupName = PromiseFlatString(aName);
|
||||
const PRUnichar *formatStrings[2] = { groupName.get(), hostStr.get() };
|
||||
nsXPIDLString confirmText;
|
||||
rv = bundle->FormatStringFromName(
|
||||
NS_LITERAL_STRING("autoUnsubscribeText").get(),
|
||||
@ -1622,7 +1670,7 @@ nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName,
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (confirmResult) {
|
||||
rv = Unsubscribe(groupStr.get());
|
||||
rv = Unsubscribe(groupName.get());
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
@ -1630,7 +1678,8 @@ nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetPrettyNameForGroup(const char *name, const char *prettyName)
|
||||
nsNntpIncomingServer::SetPrettyNameForGroup(const nsAString &name,
|
||||
const nsAString &prettyName)
|
||||
{
|
||||
NS_ASSERTION(0,"not implemented");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@ -1703,26 +1752,20 @@ buildSubscribeSearchResult(nsCString &aElement, void *aData)
|
||||
nsresult
|
||||
nsNntpIncomingServer::AppendIfSearchMatch(nsCString& newsgroupName)
|
||||
{
|
||||
// we've converted mSearchValue to lower case
|
||||
// do the same to the newsgroup name before we do our strstr()
|
||||
// this way searches will be case independant
|
||||
nsCAutoString lowerCaseName;
|
||||
ToLowerCase(newsgroupName, lowerCaseName);
|
||||
NS_UnescapeURL(lowerCaseName);
|
||||
|
||||
if (PL_strstr(lowerCaseName.get(), mSearchValue.get())) {
|
||||
NS_ConvertUTF8toUTF16 groupName(newsgroupName);
|
||||
nsAString::const_iterator start, end;
|
||||
groupName.BeginReading(start);
|
||||
groupName.EndReading(end);
|
||||
if (FindInReadable(mSearchValue, start, end,
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
mSubscribeSearchResult.AppendCString(newsgroupName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::SetSearchValue(const char *searchValue)
|
||||
nsNntpIncomingServer::SetSearchValue(const nsAString &searchValue)
|
||||
{
|
||||
mSearchValue = searchValue;
|
||||
// force the search string to be lower case
|
||||
// so that we can do case insensitive searching
|
||||
ToLowerCase(mSearchValue);
|
||||
|
||||
if (mTree) {
|
||||
mTree->BeginUpdateBatch();
|
||||
@ -1730,7 +1773,9 @@ nsNntpIncomingServer::SetSearchValue(const char *searchValue)
|
||||
}
|
||||
|
||||
mSubscribeSearchResult.Clear();
|
||||
mGroupsOnServer.EnumerateForwards((nsCStringArrayEnumFunc)buildSubscribeSearchResult, (void *)this);
|
||||
mGroupsOnServer.
|
||||
EnumerateForwards(nsCStringArrayEnumFunc(buildSubscribeSearchResult),
|
||||
(void *)this);
|
||||
mSubscribeSearchResult.SortIgnoreCase();
|
||||
|
||||
if (mTree) {
|
||||
@ -2119,8 +2164,7 @@ nsNntpIncomingServer::OnUserOrHostNameChanged(const char *oldName, const char *n
|
||||
{
|
||||
// subscribe.
|
||||
groupList.StringAt(i, groupStr);
|
||||
cname.AssignWithConversion(groupStr.get());
|
||||
rv = SubscribeToNewsgroup(cname.get());
|
||||
rv = SubscribeToNewsgroup(NS_ConvertUTF16toUTF8(groupStr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
|
||||
@ -126,14 +126,14 @@ private:
|
||||
nsCOMPtr<nsIAtom> mSubscribedAtom;
|
||||
nsCOMPtr<nsIAtom> mNntpAtom;
|
||||
|
||||
nsCString mSearchValue;
|
||||
nsString mSearchValue;
|
||||
nsCOMPtr<nsITreeBoxObject> mTree;
|
||||
nsCOMPtr<nsITreeSelection> mTreeSelection;
|
||||
|
||||
PRBool mHasSeenBeginGroups;
|
||||
nsresult WriteHostInfoFile();
|
||||
nsresult LoadHostInfoFile();
|
||||
nsresult AddGroupOnServer(const char *name);
|
||||
nsresult AddGroupOnServer(const nsACString &name);
|
||||
|
||||
PRBool mNewsrcHasChanged;
|
||||
nsAdapterEnumerator *mGroupsEnumerator;
|
||||
|
||||
@ -656,7 +656,8 @@ nsNntpService::GetFolderFromUri(const char *aUri, nsIMsgFolder **aFolder)
|
||||
nsUnescape(unescapedPath);
|
||||
|
||||
nsCOMPtr<nsISupports> subFolder;
|
||||
rv = rootFolder->GetChildNamed(NS_ConvertASCIItoUCS2(unescapedPath).get() , getter_AddRefs(subFolder));
|
||||
rv = rootFolder->GetChildNamed(NS_ConvertUTF8toUTF16(unescapedPath).get() ,
|
||||
getter_AddRefs(subFolder));
|
||||
PL_strfree(unescapedPath);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
@ -685,10 +686,10 @@ nsNntpService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
typedef struct _findNewsServerEntry {
|
||||
struct findNewsServerEntry {
|
||||
const char *newsgroup;
|
||||
nsINntpIncomingServer *server;
|
||||
} findNewsServerEntry;
|
||||
};
|
||||
|
||||
|
||||
PRBool
|
||||
@ -703,7 +704,10 @@ nsNntpService::findNewsServerWithGroup(nsISupports *aElement, void *data)
|
||||
|
||||
PRBool containsGroup = PR_FALSE;
|
||||
|
||||
rv = newsserver->ContainsNewsgroup((const char *)(entry->newsgroup), &containsGroup);
|
||||
NS_ASSERTION(IsUTF8(nsDependentCString(entry->newsgroup)),
|
||||
"newsgroup is not in UTF-8");
|
||||
rv = newsserver->ContainsNewsgroup(nsDependentCString(entry->newsgroup),
|
||||
&containsGroup);
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
if (containsGroup)
|
||||
@ -785,9 +789,10 @@ nsNntpService::SetUpNntpUrlForPosting(const char *aAccountKey, char **newsUrlSpe
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsINntpService support
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XXX : may not work with non-ASCII newsgroup names and IDN hostnames
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::GenerateNewsHeaderValsForPosting(const char *newsgroupsList, char **newsgroupsHeaderVal, char **newshostHeaderVal)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user