diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js index d3ac1bf86b1b..93602b80e7c0 100644 --- a/mailnews/mailnews.js +++ b/mailnews/mailnews.js @@ -353,6 +353,7 @@ pref("mail.server.default.fetch_by_chunks", true); pref("mail.server.default.mime_parts_on_demand", true); pref("mail.server.default.always_authenticate",false); +pref("mail.server.default.singleSignon", true); pref("mail.server.default.max_articles", 500); pref("mail.server.default.notify.on", true); pref("mail.server.default.mark_old_read", false); diff --git a/mailnews/news/public/nsINntpIncomingServer.idl b/mailnews/news/public/nsINntpIncomingServer.idl index c21620a5e3fd..b6ebed35c8d7 100644 --- a/mailnews/news/public/nsINntpIncomingServer.idl +++ b/mailnews/news/public/nsINntpIncomingServer.idl @@ -63,6 +63,9 @@ interface nsINntpIncomingServer : nsISupports { /* 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); diff --git a/mailnews/news/src/nsNewsFolder.cpp b/mailnews/news/src/nsNewsFolder.cpp index 6da050b1bc86..5cefb89ef9a4 100644 --- a/mailnews/news/src/nsNewsFolder.cpp +++ b/mailnews/news/src/nsNewsFolder.cpp @@ -1244,8 +1244,32 @@ nsresult nsMsgNewsFolder::CreateNewsgroupUrlForSignon(const char *inUriStr, cons nsCOMPtr url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv,rv); + nsCOMPtr server; + rv = GetServer(getter_AddRefs(server)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr nntpServer; + rv = GetNntpServer(getter_AddRefs(nntpServer)); + if (NS_FAILED(rv)) return rv; + + PRBool singleSignon = PR_TRUE; + rv = nntpServer->GetSingleSignon(&singleSignon); + + if (singleSignon) + { + + nsXPIDLCString serverURI; + rv = server->GetServerURI(getter_Copies(serverURI)); + if (NS_FAILED(rv)) return rv; + + rv = url->SetSpec(serverURI); + if (NS_FAILED(rv)) return rv; + } + else + { rv = url->SetSpec(nsDependentCString(inUriStr)); if (NS_FAILED(rv)) return rv; + } rv = url->GetPort(&port); if (NS_FAILED(rv)) return rv; diff --git a/mailnews/news/src/nsNntpIncomingServer.cpp b/mailnews/news/src/nsNntpIncomingServer.cpp index 309564ee41c7..e454a3709ae2 100644 --- a/mailnews/news/src/nsNntpIncomingServer.cpp +++ b/mailnews/news/src/nsNntpIncomingServer.cpp @@ -156,6 +156,7 @@ NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, NotifyOn, "notify.on") NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, MarkOldRead, "mark_old_read") NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, Abbreviate, "abbreviate") NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, PushAuth, "always_authenticate") +NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, SingleSignon, "singleSignon") NS_IMPL_SERVERPREF_INT(nsNntpIncomingServer, MaxArticles, "max_articles") NS_IMETHODIMP diff --git a/modules/libpref/src/init/mailnews.js b/modules/libpref/src/init/mailnews.js index d3ac1bf86b1b..93602b80e7c0 100644 --- a/modules/libpref/src/init/mailnews.js +++ b/modules/libpref/src/init/mailnews.js @@ -353,6 +353,7 @@ pref("mail.server.default.fetch_by_chunks", true); pref("mail.server.default.mime_parts_on_demand", true); pref("mail.server.default.always_authenticate",false); +pref("mail.server.default.singleSignon", true); pref("mail.server.default.max_articles", 500); pref("mail.server.default.notify.on", true); pref("mail.server.default.mark_old_read", false);