зеркало из https://github.com/mozilla/gecko-dev.git
fix for a bunch of subscribe problems.
#39263, imap subscribe only working to the second level deep #40238, subscribed imap folders not showing up as subscribed. #39261, imap folders showing up as full paths, not leaf names. r=mscott
This commit is contained in:
Родитель
317ebfc20f
Коммит
533c46ea39
|
@ -37,15 +37,18 @@ interface nsISubscribableServer : nsISupports {
|
||||||
void setIncomingServer(in nsIMsgIncomingServer server);
|
void setIncomingServer(in nsIMsgIncomingServer server);
|
||||||
void setDelimiter(in char delimiter);
|
void setDelimiter(in char delimiter);
|
||||||
void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer);
|
void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer);
|
||||||
|
void populateSubscribeDatasourceWithName(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string name);
|
||||||
attribute nsISubscribeListener subscribeListener;
|
attribute nsISubscribeListener subscribeListener;
|
||||||
void startPopulatingSubscribeDS();
|
void startPopulatingSubscribeDS();
|
||||||
void stopPopulatingSubscribeDS();
|
void stopPopulatingSubscribeDS();
|
||||||
void findAndAddParentToSubscribeDS(in string uri, in string serverUri, in string aName, in nsIRDFResource aChildResource);
|
void findAndAddParentToSubscribeDS(in string uri, in string serverUri, in string aName, in nsIRDFResource aChildResource);
|
||||||
void setPropertiesInSubscribeDS(in string uri, in wstring aName, in nsIRDFResource aResource);
|
void setPropertiesInSubscribeDS(in string uri, in wstring aName, in nsIRDFResource aResource, in boolean subscribed, in boolean changeIfExists);
|
||||||
void addToSubscribeDS(in string aName);
|
void addToSubscribeDS(in string aName, in boolean addAsSubscribed, in boolean changeIfExists);
|
||||||
void setAsSubscribedInSubscribeDS(in string aURI);
|
void setAsSubscribedInSubscribeDS(in string aURI);
|
||||||
void updateSubscribedInSubscribeDS();
|
void updateSubscribedInSubscribeDS();
|
||||||
void subscribe(in wstring name);
|
void subscribe(in wstring name);
|
||||||
void unsubscribe(in wstring name);
|
void unsubscribe(in wstring name);
|
||||||
|
void setShowFullName(in boolean showFullName);
|
||||||
|
void subscribeCleanup();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ var gSubscribeTree = null;
|
||||||
var okCallback = null;
|
var okCallback = null;
|
||||||
var gChangeTable = {};
|
var gChangeTable = {};
|
||||||
var gServerURI = null;
|
var gServerURI = null;
|
||||||
|
var gSubscribableServer = null;
|
||||||
var RDF = null;
|
var RDF = null;
|
||||||
var gSubscribeDS = null;
|
var gSubscribeDS = null;
|
||||||
var gStatusBar = null;
|
var gStatusBar = null;
|
||||||
|
@ -46,7 +47,7 @@ function SetServerTypeSpecificTextValues()
|
||||||
element = document.getElementById("foldersheaderlabel");
|
element = document.getElementById("foldersheaderlabel");
|
||||||
element.setAttribute('value',stringval);
|
element.setAttribute('value',stringval);
|
||||||
|
|
||||||
// XXX todo, fix this hack
|
// xxx todo, fix this hack
|
||||||
// qi the server to get a nsISubscribable server
|
// qi the server to get a nsISubscribable server
|
||||||
// and ask it for the delimiter
|
// and ask it for the delimiter
|
||||||
if (serverType == "nntp") {
|
if (serverType == "nntp") {
|
||||||
|
@ -90,8 +91,17 @@ function SetUpServerMenu()
|
||||||
|
|
||||||
var MySubscribeListener = {
|
var MySubscribeListener = {
|
||||||
OnStopPopulating: function() {
|
OnStopPopulating: function() {
|
||||||
//dump("root subscribe tree at: "+ gServerURI +"\n");
|
// only re-root the tree, if it is null.
|
||||||
gSubscribeTree.setAttribute('ref',gServerURI);
|
// otherwise, we are in here because we are populating
|
||||||
|
// a part of the tree
|
||||||
|
|
||||||
|
var refValue = gSubscribeTree.getAttribute('ref');
|
||||||
|
//dump("ref = " + refValue + refValue.length + "\n");
|
||||||
|
if (refValue == "null") {
|
||||||
|
dump("root subscribe tree at: "+ gServerURI +"\n");
|
||||||
|
gSubscribeTree.setAttribute('ref',gServerURI);
|
||||||
|
}
|
||||||
|
|
||||||
// Turn progress meter off.
|
// Turn progress meter off.
|
||||||
gStatusBar.setAttribute("mode","normal");
|
gStatusBar.setAttribute("mode","normal");
|
||||||
}
|
}
|
||||||
|
@ -110,14 +120,14 @@ function SetUpTree(forceToServer)
|
||||||
var server = folder.server;
|
var server = folder.server;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
gSubscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
||||||
|
|
||||||
subscribableServer.subscribeListener = MySubscribeListener;
|
gSubscribableServer.subscribeListener = MySubscribeListener;
|
||||||
|
|
||||||
// Turn progress meter on.
|
// Turn progress meter on.
|
||||||
gStatusBar.setAttribute("mode","undetermined");
|
gStatusBar.setAttribute("mode","undetermined");
|
||||||
|
|
||||||
subscribableServer.populateSubscribeDatasource(null /* eventually, a nsIMsgWindow */, forceToServer);
|
gSubscribableServer.populateSubscribeDatasource(null /* eventually, a nsIMsgWindow */, forceToServer);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
dump("failed to populate subscribe ds: " + ex + "\n");
|
dump("failed to populate subscribe ds: " + ex + "\n");
|
||||||
|
@ -128,7 +138,7 @@ function SubscribeOnLoad()
|
||||||
{
|
{
|
||||||
//dump("SubscribeOnLoad()\n");
|
//dump("SubscribeOnLoad()\n");
|
||||||
|
|
||||||
gSubscribeTree = document.getElementById('subscribetree');
|
gSubscribeTree = document.getElementById('subscribetree');
|
||||||
gStatusBar = document.getElementById('statusbar-icon');
|
gStatusBar = document.getElementById('statusbar-icon');
|
||||||
gNameField = document.getElementById('namefield');
|
gNameField = document.getElementById('namefield');
|
||||||
|
|
||||||
|
@ -153,11 +163,12 @@ function SubscribeOnLoad()
|
||||||
//dump("folder="+folder+"\n");
|
//dump("folder="+folder+"\n");
|
||||||
//dump("folder.server="+folder.server+"\n");
|
//dump("folder.server="+folder.server+"\n");
|
||||||
try {
|
try {
|
||||||
subscribableServer = folder.server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
gSubscribableServer = folder.server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
||||||
gServerURI = folder.server.serverURI;
|
gServerURI = folder.server.serverURI;
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
dump("not a subscribable server\n");
|
dump("not a subscribable server\n");
|
||||||
|
gSubscribableServer = null;
|
||||||
gServerURI = null;
|
gServerURI = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,6 +202,9 @@ function subscribeOK()
|
||||||
if (top.okCallback) {
|
if (top.okCallback) {
|
||||||
top.okCallback(top.gServerURI,top.gChangeTable);
|
top.okCallback(top.gServerURI,top.gChangeTable);
|
||||||
}
|
}
|
||||||
|
if (gSubscribableServer) {
|
||||||
|
gSubscribableServer.subscribeCleanup();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +212,9 @@ function subscribeCancel()
|
||||||
{
|
{
|
||||||
//dump("in subscribeCancel()\n");
|
//dump("in subscribeCancel()\n");
|
||||||
Stop();
|
Stop();
|
||||||
|
if (gSubscribableServer) {
|
||||||
|
gSubscribableServer.subscribeCleanup();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +224,7 @@ function SetState(uri,name,state,stateStr)
|
||||||
if (!uri || !stateStr) return;
|
if (!uri || !stateStr) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// xxx should we move this code into nsSubscribableServer.cpp?
|
||||||
var src = RDF.GetResource(uri, true);
|
var src = RDF.GetResource(uri, true);
|
||||||
var prop = RDF.GetResource("http://home.netscape.com/NC-rdf#Subscribed", true);
|
var prop = RDF.GetResource("http://home.netscape.com/NC-rdf#Subscribed", true);
|
||||||
var oldLiteral = gSubscribeDS.GetTarget(src, prop, true);
|
var oldLiteral = gSubscribeDS.GetTarget(src, prop, true);
|
||||||
|
@ -306,7 +324,20 @@ function SubscribeOnClick(event)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var targetclass = event.target.getAttribute('class');
|
var targetclass = event.target.getAttribute('class');
|
||||||
if (targetclass != 'tree-cell-twisty') {
|
if (targetclass == 'tree-cell-twisty') {
|
||||||
|
var treeitem = event.target.parentNode.parentNode.parentNode;
|
||||||
|
var open = treeitem.getAttribute('open');
|
||||||
|
if(open == "true") {
|
||||||
|
var name = treeitem.getAttribute("name");
|
||||||
|
dump("do twisty for " + name +"\n");
|
||||||
|
|
||||||
|
// Turn progress meter on.
|
||||||
|
gStatusBar.setAttribute("mode","undetermined");
|
||||||
|
|
||||||
|
gSubscribableServer.populateSubscribeDatasourceWithName(null /* eventually, a nsIMsgWindow */, true /* force to server */, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
var name = event.target.parentNode.parentNode.getAttribute('name');
|
var name = event.target.parentNode.parentNode.getAttribute('name');
|
||||||
gNameField.setAttribute('value',name);
|
gNameField.setAttribute('value',name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ Rights Reserved.
|
||||||
<treechildren>
|
<treechildren>
|
||||||
<treeitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" Subscribed="rdf:http://home.netscape.com/NC-rdf#Subscribed">
|
<treeitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" Subscribed="rdf:http://home.netscape.com/NC-rdf#Subscribed">
|
||||||
<treerow>
|
<treerow>
|
||||||
<treecell indent="true" class="treecell-indent" value="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
<treecell indent="true" class="treecell-indent" value="rdf:http://home.netscape.com/NC-rdf#LeafName"/>
|
||||||
<treecell class="treecell-image subscribedcol" allowevents="true" onclick="return top.ReverseStateFromNode(event.target.parentNode.parentNode.parentNode)" value="rdf:http://home.netscape.com/NC-rdf#Subscribed"/>
|
<treecell class="treecell-image subscribedcol" allowevents="true" onclick="return top.ReverseStateFromNode(event.target.parentNode.parentNode.parentNode)" value="rdf:http://home.netscape.com/NC-rdf#Subscribed"/>
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
|
||||||
</treerow>
|
</treerow>
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
#define DEBUG_SUBSCRIBE 1
|
#define DEBUG_SUBSCRIBE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TRUE_LITERAL_STR "true"
|
||||||
|
#define FALSE_LITERAL_STR "false"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||||
|
|
||||||
|
@ -47,6 +50,7 @@ nsSubscribableServer::nsSubscribableServer(void)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mDelimiter = '.';
|
mDelimiter = '.';
|
||||||
|
mShowFullName = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSubscribableServer::~nsSubscribableServer(void)
|
nsSubscribableServer::~nsSubscribableServer(void)
|
||||||
|
@ -85,13 +89,23 @@ nsSubscribableServer::SetAsSubscribedInSubscribeDS(const char *aURI)
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
if (!mSubscribeDatasource) return NS_ERROR_FAILURE;
|
if (!mSubscribeDatasource) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFNode> oldLiteral;
|
nsCOMPtr<nsIRDFNode> oldNode;
|
||||||
rv = mSubscribeDatasource->GetTarget(resource, kNC_Subscribed, PR_TRUE, getter_AddRefs(oldLiteral));
|
rv = mSubscribeDatasource->GetTarget(resource, kNC_Subscribed, PR_TRUE, getter_AddRefs(oldNode));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = mSubscribeDatasource->Change(resource, kNC_Subscribed, oldLiteral, kTrueLiteral);
|
//check if literal is already true
|
||||||
|
nsCOMPtr<nsIRDFLiteral> oldLiteral = do_QueryInterface(oldNode);
|
||||||
|
if (!oldLiteral) return NS_ERROR_FAILURE;
|
||||||
|
const PRUnichar *subscribedLiteralStr;
|
||||||
|
rv = oldLiteral->GetValueConst(&subscribedLiteralStr);
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
// if it was already "true", do nothing
|
||||||
|
if (nsCRT::strcmp(subscribedLiteralStr,TRUE_LITERAL_STR)) {
|
||||||
|
rv = mSubscribeDatasource->Change(resource, kNC_Subscribed, oldNode, kTrueLiteral);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +162,7 @@ nsresult CreateUnicodeStringFromUtf7(const char *aSourceString, PRUnichar **aUni
|
||||||
return (convertedString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return (convertedString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubscribableServer::AddToSubscribeDS(const char *aName)
|
nsSubscribableServer::AddToSubscribeDS(const char *aName, PRBool addAsSubscribed, PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
@ -156,7 +170,7 @@ nsSubscribableServer::AddToSubscribeDS(const char *aName)
|
||||||
if (!aName) return NS_ERROR_FAILURE;
|
if (!aName) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
#ifdef DEBUG_SUBSCRIBE
|
#ifdef DEBUG_SUBSCRIBE
|
||||||
printf("AddToSubscribeDS(%s)\n",aName);
|
printf("AddToSubscribeDS(%s,%d,%d)\n",aName,addAsSubscribed,changeIfExists);
|
||||||
#endif
|
#endif
|
||||||
nsXPIDLCString serverUri;
|
nsXPIDLCString serverUri;
|
||||||
|
|
||||||
|
@ -176,7 +190,7 @@ nsSubscribableServer::AddToSubscribeDS(const char *aName)
|
||||||
rv = CreateUnicodeStringFromUtf7(aName, getter_Copies(unicodeName));
|
rv = CreateUnicodeStringFromUtf7(aName, getter_Copies(unicodeName));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = SetPropertiesInSubscribeDS((const char *) uri, (const PRUnichar *)unicodeName, resource);
|
rv = SetPropertiesInSubscribeDS((const char *) uri, (const PRUnichar *)unicodeName, resource, addAsSubscribed, changeIfExists);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = FindAndAddParentToSubscribeDS((const char *) uri, (const char *)serverUri, aName, resource);
|
rv = FindAndAddParentToSubscribeDS((const char *) uri, (const char *)serverUri, aName, resource);
|
||||||
|
@ -186,23 +200,96 @@ nsSubscribableServer::AddToSubscribeDS(const char *aName)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubscribableServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource)
|
nsSubscribableServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource, PRBool subscribed, PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
#ifdef DEBUG_SUBSCRIBE
|
#ifdef DEBUG_SUBSCRIBE
|
||||||
printf("SetPropertiesInSubscribeDS(%s,??,??)\n",uri);
|
printf("SetPropertiesInSubscribeDS(%s,??,??,%d,%d)\n",uri,subscribed,changeIfExists);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
||||||
rv = mRDFService->GetLiteral(aName, getter_AddRefs(nameLiteral));
|
rv = mRDFService->GetLiteral(aName, getter_AddRefs(nameLiteral));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = mSubscribeDatasource->Assert(aResource, kNC_Name, nameLiteral, PR_TRUE);
|
PRBool nameExists = PR_TRUE;
|
||||||
|
nsCOMPtr <nsIRDFNode> nameNode;
|
||||||
|
// should be HasAssertion(), since we don't need to get at the literal
|
||||||
|
rv = mSubscribeDatasource->GetTarget(aResource, kNC_Name, PR_TRUE, getter_AddRefs(nameNode));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
if ((!nameNode) && (rv == NS_RDF_NO_VALUE)) {
|
||||||
|
nameExists = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
rv = mSubscribeDatasource->Assert(aResource, kNC_Subscribed, kFalseLiteral, PR_TRUE);
|
if (!nameExists) {
|
||||||
|
rv = mSubscribeDatasource->Assert(aResource, kNC_Name, nameLiteral, PR_TRUE);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
if (mShowFullName) {
|
||||||
|
rv = mSubscribeDatasource->Assert(aResource, kNC_LeafName, nameLiteral, PR_TRUE);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nsAutoString leafStr(aName);
|
||||||
|
PRInt32 leafPos = leafStr.RFindChar(mDelimiter,PR_TRUE);
|
||||||
|
if (leafPos != -1) {
|
||||||
|
leafStr.Cut(0,leafPos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIRDFLiteral> leafLiteral;
|
||||||
|
rv = mRDFService->GetLiteral(leafStr.GetUnicode(), getter_AddRefs(leafLiteral));
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = mSubscribeDatasource->Assert(aResource, kNC_LeafName, leafLiteral, PR_TRUE);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PRBool subscribedExists = PR_TRUE;
|
||||||
|
nsCOMPtr <nsIRDFNode> subscribedNode;
|
||||||
|
rv = mSubscribeDatasource->GetTarget(aResource, kNC_Subscribed, PR_TRUE, getter_AddRefs(subscribedNode));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
if ((!subscribedNode) && (rv == NS_RDF_NO_VALUE)) {
|
||||||
|
subscribedExists = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subscribed) {
|
||||||
|
if (!subscribedExists) {
|
||||||
|
rv = mSubscribeDatasource->Assert(aResource, kNC_Subscribed, kTrueLiteral, PR_TRUE);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
else if (changeIfExists) {
|
||||||
|
nsCOMPtr<nsIRDFLiteral> subscribedLiteral = do_QueryInterface(subscribedNode);
|
||||||
|
if (!subscribedLiteral) return NS_ERROR_FAILURE;
|
||||||
|
const PRUnichar *subscribedLiteralStr;
|
||||||
|
rv = subscribedLiteral->GetValueConst(&subscribedLiteralStr);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
if (nsCRT::strcmp(subscribedLiteralStr,TRUE_LITERAL_STR)) {
|
||||||
|
rv = mSubscribeDatasource->Change(aResource, kNC_Subscribed, subscribedNode, kTrueLiteral);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!subscribedExists) {
|
||||||
|
rv = mSubscribeDatasource->Assert(aResource, kNC_Subscribed, kFalseLiteral, PR_TRUE);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
else if (changeIfExists) {
|
||||||
|
nsCOMPtr<nsIRDFLiteral> subscribedLiteral = do_QueryInterface(subscribedNode);
|
||||||
|
if (!subscribedLiteral) return NS_ERROR_FAILURE;
|
||||||
|
const PRUnichar *subscribedLiteralStr;
|
||||||
|
rv = subscribedLiteral->GetValueConst(&subscribedLiteralStr);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
if (nsCRT::strcmp(subscribedLiteralStr,FALSE_LITERAL_STR)) {
|
||||||
|
rv = mSubscribeDatasource->Change(aResource, kNC_Subscribed, subscribedNode, kFalseLiteral);
|
||||||
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +345,7 @@ nsSubscribableServer::FindAndAddParentToSubscribeDS(const char *uri, const char
|
||||||
rv = CreateUnicodeStringFromUtf7((const char *)nameCStr, getter_Copies(unicodeName));
|
rv = CreateUnicodeStringFromUtf7((const char *)nameCStr, getter_Copies(unicodeName));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = SetPropertiesInSubscribeDS((const char *)uriCStr, (const PRUnichar *)unicodeName, parentResource);
|
rv = SetPropertiesInSubscribeDS((const char *)uriCStr, (const PRUnichar *)unicodeName, parentResource, PR_FALSE, PR_FALSE /* change if exists */);
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +378,7 @@ nsSubscribableServer::StopPopulatingSubscribeDS()
|
||||||
mRDFService = nsnull;
|
mRDFService = nsnull;
|
||||||
mSubscribeDatasource = nsnull;
|
mSubscribeDatasource = nsnull;
|
||||||
kNC_Name = nsnull;
|
kNC_Name = nsnull;
|
||||||
|
kNC_LeafName = nsnull;
|
||||||
kNC_Child = nsnull;
|
kNC_Child = nsnull;
|
||||||
kNC_Subscribed = nsnull;
|
kNC_Subscribed = nsnull;
|
||||||
|
|
||||||
|
@ -313,6 +401,10 @@ nsSubscribableServer::StartPopulatingSubscribeDS()
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv) && kNC_Name,"no name resource");
|
NS_ASSERTION(NS_SUCCEEDED(rv) && kNC_Name,"no name resource");
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = mRDFService->GetResource("http://home.netscape.com/NC-rdf#LeafName", getter_AddRefs(kNC_LeafName));
|
||||||
|
NS_ASSERTION(NS_SUCCEEDED(rv) && kNC_LeafName,"no leaf name resource");
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(kNC_Child));
|
rv = mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(kNC_Child));
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv) && kNC_Child,"no child resource");
|
NS_ASSERTION(NS_SUCCEEDED(rv) && kNC_Child,"no child resource");
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -322,12 +414,12 @@ nsSubscribableServer::StartPopulatingSubscribeDS()
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsAutoString trueString;
|
nsAutoString trueString;
|
||||||
trueString.AssignWithConversion("true");
|
trueString.AssignWithConversion(TRUE_LITERAL_STR);
|
||||||
rv = mRDFService->GetLiteral(trueString.GetUnicode(), getter_AddRefs(kTrueLiteral));
|
rv = mRDFService->GetLiteral(trueString.GetUnicode(), getter_AddRefs(kTrueLiteral));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsAutoString falseString;
|
nsAutoString falseString;
|
||||||
falseString.AssignWithConversion("false");
|
falseString.AssignWithConversion(FALSE_LITERAL_STR);
|
||||||
rv = mRDFService->GetLiteral(falseString.GetUnicode(), getter_AddRefs(kFalseLiteral));
|
rv = mRDFService->GetLiteral(falseString.GetUnicode(), getter_AddRefs(kFalseLiteral));
|
||||||
if(NS_FAILED(rv)) return rv;
|
if(NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
@ -337,7 +429,6 @@ nsSubscribableServer::StartPopulatingSubscribeDS()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubscribableServer::SetSubscribeListener(nsISubscribeListener *aListener)
|
nsSubscribableServer::SetSubscribeListener(nsISubscribeListener *aListener)
|
||||||
{
|
{
|
||||||
if (!aListener) return NS_ERROR_NULL_POINTER;
|
|
||||||
mSubscribeListener = aListener;
|
mSubscribeListener = aListener;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -353,6 +444,20 @@ nsSubscribableServer::GetSubscribeListener(nsISubscribeListener **aListener)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSubscribableServer::SubscribeCleanup()
|
||||||
|
{
|
||||||
|
NS_ASSERTION(PR_FALSE,"override this.");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSubscribableServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(PR_FALSE,"override this.");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubscribableServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer)
|
nsSubscribableServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer)
|
||||||
{
|
{
|
||||||
|
@ -373,3 +478,10 @@ nsSubscribableServer::Unsubscribe(const PRUnichar *aName)
|
||||||
NS_ASSERTION(PR_FALSE,"override this.");
|
NS_ASSERTION(PR_FALSE,"override this.");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSubscribableServer::SetShowFullName(PRBool showFullName)
|
||||||
|
{
|
||||||
|
mShowFullName = showFullName;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -45,12 +45,14 @@ private:
|
||||||
nsCOMPtr <nsIRDFDataSource> mSubscribeDatasource;
|
nsCOMPtr <nsIRDFDataSource> mSubscribeDatasource;
|
||||||
nsCOMPtr <nsIRDFService> mRDFService;
|
nsCOMPtr <nsIRDFService> mRDFService;
|
||||||
nsCOMPtr <nsIRDFResource> kNC_Name;
|
nsCOMPtr <nsIRDFResource> kNC_Name;
|
||||||
|
nsCOMPtr <nsIRDFResource> kNC_LeafName;
|
||||||
nsCOMPtr <nsIRDFResource> kNC_Child;
|
nsCOMPtr <nsIRDFResource> kNC_Child;
|
||||||
nsCOMPtr <nsIRDFResource> kNC_Subscribed;
|
nsCOMPtr <nsIRDFResource> kNC_Subscribed;
|
||||||
nsCOMPtr <nsIRDFLiteral> kTrueLiteral;
|
nsCOMPtr <nsIRDFLiteral> kTrueLiteral;
|
||||||
nsCOMPtr <nsIRDFLiteral> kFalseLiteral;
|
nsCOMPtr <nsIRDFLiteral> kFalseLiteral;
|
||||||
nsCOMPtr <nsIMsgIncomingServer> mIncomingServer;
|
nsCOMPtr <nsIMsgIncomingServer> mIncomingServer;
|
||||||
char mDelimiter;
|
char mDelimiter;
|
||||||
|
PRBool mShowFullName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsSubscribableServer_h__
|
#endif // nsSubscribableServer_h__
|
||||||
|
|
|
@ -72,4 +72,6 @@ interface nsIImapIncomingServer : nsISupports {
|
||||||
void PseudoInterruptMsgLoad(in nsIImapUrl aImapUrl, out boolean interrupted);
|
void PseudoInterruptMsgLoad(in nsIImapUrl aImapUrl, out boolean interrupted);
|
||||||
void ResetConnection(in string folderName);
|
void ResetConnection(in string folderName);
|
||||||
void CreatePRUnicharStringFromUTF7(in string aSourceString, out wstring aUnicodeStr);
|
void CreatePRUnicharStringFromUTF7(in string aSourceString, out wstring aUnicodeStr);
|
||||||
|
|
||||||
|
attribute boolean doingLsub;
|
||||||
};
|
};
|
||||||
|
|
|
@ -140,11 +140,13 @@ interface nsIImapService : nsISupports
|
||||||
void discoverChildren(in nsIEventQueue aClientEventQueue,
|
void discoverChildren(in nsIEventQueue aClientEventQueue,
|
||||||
in nsIMsgFolder aImapMailFolder,
|
in nsIMsgFolder aImapMailFolder,
|
||||||
in nsIUrlListener aUrlListener,
|
in nsIUrlListener aUrlListener,
|
||||||
|
in string name,
|
||||||
out nsIURI aURL);
|
out nsIURI aURL);
|
||||||
|
|
||||||
void discoverLevelChildren(in nsIEventQueue aClientEventQueue,
|
void discoverLevelChildren(in nsIEventQueue aClientEventQueue,
|
||||||
in nsIMsgFolder aImapMailFolder,
|
in nsIMsgFolder aImapMailFolder,
|
||||||
in nsIUrlListener aUrlListener,
|
in nsIUrlListener aUrlListener,
|
||||||
|
in string name,
|
||||||
in long aLevel,
|
in long aLevel,
|
||||||
out nsIURI aURL);
|
out nsIURI aURL);
|
||||||
|
|
||||||
|
@ -203,4 +205,5 @@ interface nsIImapService : nsISupports
|
||||||
in nsIUrlListener aUrlListener);
|
in nsIUrlListener aUrlListener);
|
||||||
|
|
||||||
void buildSubscribeDatasource(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow);
|
void buildSubscribeDatasource(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow);
|
||||||
|
void buildSubscribeDatasourceWithName(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in string name);
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,6 +91,7 @@ nsImapIncomingServer::nsImapIncomingServer()
|
||||||
m_waitingForConnectionInfo = PR_FALSE;
|
m_waitingForConnectionInfo = PR_FALSE;
|
||||||
m_redirectedLogonRetries = 0;
|
m_redirectedLogonRetries = 0;
|
||||||
mDoingSubscribeDialog = PR_FALSE;
|
mDoingSubscribeDialog = PR_FALSE;
|
||||||
|
mDoingLsub = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsImapIncomingServer::~nsImapIncomingServer()
|
nsImapIncomingServer::~nsImapIncomingServer()
|
||||||
|
@ -630,6 +631,15 @@ NS_IMETHODIMP nsImapIncomingServer::ResetConnection(const char* folderName)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_jefft
|
||||||
|
printf("jefft, implement me\n");
|
||||||
|
#endif
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
|
NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
@ -685,7 +695,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
||||||
if (!folderPath || !*folderPath) return NS_ERROR_NULL_POINTER;
|
if (!folderPath || !*folderPath) return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
if (mDoingSubscribeDialog) {
|
if (mDoingSubscribeDialog) {
|
||||||
rv = AddToSubscribeDS(folderPath);
|
rv = AddToSubscribeDS(folderPath, mDoingLsub /* add as subscribed */, mDoingLsub /* change if exists */);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1828,6 +1838,29 @@ NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionReply(const PRUnichar *pHo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *name)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
#ifdef DEBUG_sspitzer
|
||||||
|
printf("in PopulateSubscribeDatasourceWithName(%s)\n",name);
|
||||||
|
#endif
|
||||||
|
mDoingSubscribeDialog = PR_TRUE;
|
||||||
|
|
||||||
|
// xxx todo can we do: rv = mInner->StartPopulatingSubscribeDS(); ?
|
||||||
|
rv = StartPopulatingSubscribeDS();
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIImapService> imapService = do_GetService(kImapServiceCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!imapService) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
rv = imapService->BuildSubscribeDatasourceWithName(this, aMsgWindow, name);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/)
|
nsImapIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/)
|
||||||
{
|
{
|
||||||
|
@ -1880,6 +1913,14 @@ nsImapIncomingServer::SetIncomingServer(nsIMsgIncomingServer *aServer)
|
||||||
return mInner->SetIncomingServer(aServer);
|
return mInner->SetIncomingServer(aServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::SetShowFullName(PRBool showFullName)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
|
return mInner->SetShowFullName(showFullName);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::SetDelimiter(char aDelimiter)
|
nsImapIncomingServer::SetDelimiter(char aDelimiter)
|
||||||
{
|
{
|
||||||
|
@ -1906,20 +1947,20 @@ nsImapIncomingServer::UpdateSubscribedInSubscribeDS()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::AddToSubscribeDS(const char *aName)
|
nsImapIncomingServer::AddToSubscribeDS(const char *aName, PRBool addAsSubscribed,PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mInner,"not initialized");
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
if (!mInner) return NS_ERROR_FAILURE;
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
return mInner->AddToSubscribeDS(aName);
|
return mInner->AddToSubscribeDS(aName, addAsSubscribed, changeIfExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource)
|
nsImapIncomingServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource, PRBool subscribed, PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mInner,"not initialized");
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
if (!mInner) return NS_ERROR_FAILURE;
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
return mInner->SetPropertiesInSubscribeDS(uri,aName,aResource);
|
return mInner->SetPropertiesInSubscribeDS(uri,aName,aResource,subscribed,changeIfExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -1948,7 +1989,20 @@ nsImapIncomingServer::StopPopulatingSubscribeDS()
|
||||||
rv = mInner->StopPopulatingSubscribeDS();
|
rv = mInner->StopPopulatingSubscribeDS();
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
mInner = nsnull;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::SubscribeCleanup()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
if (mInner) {
|
||||||
|
rv = mInner->SetSubscribeListener(nsnull);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
mInner = nsnull;
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1966,6 +2020,9 @@ nsImapIncomingServer::StartPopulatingSubscribeDS()
|
||||||
rv = SetDelimiter('/'); // is this aways the case? need to talk to jefft
|
rv = SetDelimiter('/'); // is this aways the case? need to talk to jefft
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = SetShowFullName(PR_FALSE);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return mInner->StartPopulatingSubscribeDS();
|
return mInner->StartPopulatingSubscribeDS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2038,3 +2095,19 @@ nsImapIncomingServer::SubscribeToFolder(const PRUnichar *aName, PRBool subscribe
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::SetDoingLsub(PRBool doingLsub)
|
||||||
|
{
|
||||||
|
mDoingLsub = doingLsub;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapIncomingServer::GetDoingLsub(PRBool *doingLsub)
|
||||||
|
{
|
||||||
|
if (!doingLsub) return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
|
*doingLsub = mDoingLsub;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
NS_DECL_NSIURLLISTENER
|
NS_DECL_NSIURLLISTENER
|
||||||
|
|
||||||
NS_IMETHOD PerformBiff();
|
NS_IMETHOD PerformBiff();
|
||||||
|
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
|
||||||
NS_IMETHOD CloseCachedConnections();
|
NS_IMETHOD CloseCachedConnections();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -92,6 +93,7 @@ private:
|
||||||
|
|
||||||
// subscribe dialog stuff
|
// subscribe dialog stuff
|
||||||
PRBool mDoingSubscribeDialog;
|
PRBool mDoingSubscribeDialog;
|
||||||
|
PRBool mDoingLsub;
|
||||||
nsresult AddFolderToSubscribeDialog(const char *parentUri, const char *uri,const char *folderName);
|
nsresult AddFolderToSubscribeDialog(const char *parentUri, const char *uri,const char *folderName);
|
||||||
nsCOMPtr <nsISubscribableServer> mInner;
|
nsCOMPtr <nsISubscribableServer> mInner;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5350,16 +5350,24 @@ void nsImapProtocol::DiscoverAllAndSubscribedBoxes()
|
||||||
secondLevelPattern += delimiter;
|
secondLevelPattern += delimiter;
|
||||||
secondLevelPattern += '%';
|
secondLevelPattern += '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryInterface(m_server, &rv);
|
||||||
|
if (NS_FAILED(rv) || !imapServer) return;
|
||||||
|
|
||||||
if (allPattern.Length())
|
if (allPattern.Length())
|
||||||
{
|
{
|
||||||
|
imapServer->SetDoingLsub(PR_TRUE);
|
||||||
Lsub(allPattern, PR_TRUE); // LSUB all the subscribed
|
Lsub(allPattern, PR_TRUE); // LSUB all the subscribed
|
||||||
}
|
}
|
||||||
if (topLevelPattern.Length())
|
if (topLevelPattern.Length())
|
||||||
{
|
{
|
||||||
|
imapServer->SetDoingLsub(PR_FALSE);
|
||||||
List(topLevelPattern, PR_TRUE); // LIST the top level
|
List(topLevelPattern, PR_TRUE); // LIST the top level
|
||||||
}
|
}
|
||||||
if (secondLevelPattern.Length())
|
if (secondLevelPattern.Length())
|
||||||
{
|
{
|
||||||
|
imapServer->SetDoingLsub(PR_FALSE);
|
||||||
List(secondLevelPattern, PR_TRUE); // LIST the second level
|
List(secondLevelPattern, PR_TRUE); // LIST the second level
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1503,6 +1503,7 @@ NS_IMETHODIMP
|
||||||
nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
|
nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
|
||||||
nsIMsgFolder* aImapMailFolder,
|
nsIMsgFolder* aImapMailFolder,
|
||||||
nsIUrlListener* aUrlListener,
|
nsIUrlListener* aUrlListener,
|
||||||
|
const char *folderName,
|
||||||
nsIURI** aURL)
|
nsIURI** aURL)
|
||||||
{
|
{
|
||||||
NS_ASSERTION (aImapMailFolder && aClientEventQueue,
|
NS_ASSERTION (aImapMailFolder && aClientEventQueue,
|
||||||
|
@ -1523,15 +1524,13 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
if (folderName && (nsCRT::strlen(folderName) > 0))
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
|
||||||
if (nsCRT::strlen(folderName) > 0)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
||||||
|
|
||||||
urlSpec.Append("/discoverchildren>");
|
urlSpec.Append("/discoverchildren>");
|
||||||
urlSpec.AppendWithConversion(hierarchySeparator);
|
urlSpec.AppendWithConversion(hierarchySeparator);
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
||||||
// compiler that is preventing in string parameters from showing up as
|
// compiler that is preventing in string parameters from showing up as
|
||||||
// const char *. hopefully they will fix it soon.
|
// const char *. hopefully they will fix it soon.
|
||||||
|
@ -1554,6 +1553,7 @@ NS_IMETHODIMP
|
||||||
nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
|
nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
|
||||||
nsIMsgFolder* aImapMailFolder,
|
nsIMsgFolder* aImapMailFolder,
|
||||||
nsIUrlListener* aUrlListener,
|
nsIUrlListener* aUrlListener,
|
||||||
|
const char *folderName,
|
||||||
PRInt32 level,
|
PRInt32 level,
|
||||||
nsIURI** aURL)
|
nsIURI** aURL)
|
||||||
{
|
{
|
||||||
|
@ -1574,15 +1574,13 @@ nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
if (folderName && (nsCRT::strlen(folderName) > 0))
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
|
||||||
if (nsCRT::strlen(folderName) > 0)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
||||||
urlSpec.Append("/discoverlevelchildren>");
|
urlSpec.Append("/discoverlevelchildren>");
|
||||||
urlSpec.AppendInt(level);
|
urlSpec.AppendInt(level);
|
||||||
urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/"
|
urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/"
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
|
|
||||||
rv = uri->SetSpec((char *) urlSpec.GetBuffer());
|
rv = uri->SetSpec((char *) urlSpec.GetBuffer());
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -2759,6 +2757,43 @@ nsImapService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsImapService::BuildSubscribeDatasourceWithName(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow, const char *folderName)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
#ifdef DEBUG_sspitzer
|
||||||
|
printf("BuildSubscribeDatasourceWithName(%s)\n",folderName);
|
||||||
|
#endif
|
||||||
|
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aServer);
|
||||||
|
if (!server) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFolder> rootFolder;
|
||||||
|
rv = server->GetRootFolder(getter_AddRefs(rootFolder));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIMsgFolder> rootMsgFolder = do_QueryInterface(rootFolder, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!rootMsgFolder) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIUrlListener> listener = do_QueryInterface(aServer, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!listener) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIEventQueue> queue;
|
||||||
|
// get the Event Queue for this thread...
|
||||||
|
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = DiscoverChildren(queue, rootMsgFolder, listener, folderName, nsnull);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapService::BuildSubscribeDatasource(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow)
|
nsImapService::BuildSubscribeDatasource(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -692,7 +692,7 @@ addGroupFunction(nsCString &aElement, void *aData)
|
||||||
nsNntpIncomingServer *server;
|
nsNntpIncomingServer *server;
|
||||||
server = (nsNntpIncomingServer *)aData;
|
server = (nsNntpIncomingServer *)aData;
|
||||||
|
|
||||||
rv = server->AddToSubscribeDS((const char *)aElement);
|
rv = server->AddToSubscribeDS((const char *)aElement, PR_FALSE, PR_TRUE);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv),"AddToSubscribeDS failed");
|
NS_ASSERTION(NS_SUCCEEDED(rv),"AddToSubscribeDS failed");
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -814,6 +814,34 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo(nsIMsgWindow *aMsg
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNntpIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
#ifdef DEBUG_sspitzer
|
||||||
|
printf("PopulateSubscribeDatasourceWithName(%s)\n",name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
rv = StopPopulatingSubscribeDS();
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNntpIncomingServer::SubscribeCleanup()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
if (mInner) {
|
||||||
|
rv = mInner->SetSubscribeListener(nsnull);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
mInner = nsnull;
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNntpIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer)
|
nsNntpIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBool aForceToServer)
|
||||||
{
|
{
|
||||||
|
@ -859,7 +887,7 @@ nsNntpIncomingServer::AddNewsgroupToSubscribeDS(const char *aName)
|
||||||
// since this comes from the server, append it to the list
|
// since this comes from the server, append it to the list
|
||||||
mGroupsOnServer.AppendCString(aName);
|
mGroupsOnServer.AppendCString(aName);
|
||||||
|
|
||||||
rv = AddToSubscribeDS(aName);
|
rv = AddToSubscribeDS(aName, PR_FALSE, PR_TRUE);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -872,6 +900,14 @@ nsNntpIncomingServer::SetIncomingServer(nsIMsgIncomingServer *aServer)
|
||||||
return mInner->SetIncomingServer(aServer);
|
return mInner->SetIncomingServer(aServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNntpIncomingServer::SetShowFullName(PRBool showFullName)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
|
return mInner->SetShowFullName(showFullName);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNntpIncomingServer::SetDelimiter(char aDelimiter)
|
nsNntpIncomingServer::SetDelimiter(char aDelimiter)
|
||||||
{
|
{
|
||||||
|
@ -927,19 +963,19 @@ nsNntpIncomingServer::UpdateSubscribedInSubscribeDS()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNntpIncomingServer::AddToSubscribeDS(const char *aName)
|
nsNntpIncomingServer::AddToSubscribeDS(const char *aName, PRBool addAsSubscribed, PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mInner,"not initialized");
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
if (!mInner) return NS_ERROR_FAILURE;
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
return mInner->AddToSubscribeDS(aName);
|
return mInner->AddToSubscribeDS(aName,addAsSubscribed,changeIfExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNntpIncomingServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource)
|
nsNntpIncomingServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnichar *aName, nsIRDFResource *aResource, PRBool subscribed, PRBool changeIfExists)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mInner,"not initialized");
|
NS_ASSERTION(mInner,"not initialized");
|
||||||
if (!mInner) return NS_ERROR_FAILURE;
|
if (!mInner) return NS_ERROR_FAILURE;
|
||||||
return mInner->SetPropertiesInSubscribeDS(uri,aName,aResource);
|
return mInner->SetPropertiesInSubscribeDS(uri,aName,aResource,subscribed,changeIfExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -968,7 +1004,8 @@ nsNntpIncomingServer::StopPopulatingSubscribeDS()
|
||||||
rv = mInner->StopPopulatingSubscribeDS();
|
rv = mInner->StopPopulatingSubscribeDS();
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
mInner = nsnull;
|
//xxx todo when do I set this to null?
|
||||||
|
//mInner = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,6 +1023,9 @@ nsNntpIncomingServer::StartPopulatingSubscribeDS()
|
||||||
rv = SetDelimiter('.');
|
rv = SetDelimiter('.');
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = SetShowFullName(PR_TRUE);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
return mInner->StartPopulatingSubscribeDS();
|
return mInner->StartPopulatingSubscribeDS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче