Bug 900519 - Make fakeserver into JS modules - nntpd.js part. r=Standard8
This commit is contained in:
Родитель
0ba2f554fd
Коммит
78cf6bd7e9
|
@ -25,6 +25,7 @@ TESTING_JS_MODULES += \
|
|||
$(RESDIR)/mailDirService.js \
|
||||
$(RESDIR)/mailTestUtils.js \
|
||||
$(FAKESERVER)/maild.js \
|
||||
$(FAKESERVER)/nntpd.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ var gProfileDir = ProfileDir.initialize(do_get_profile());
|
|||
|
||||
// Import the servers
|
||||
Components.utils.import("resource://testing-common/mailnews/maild.js");
|
||||
load("../../../fakeserver/nntpd.js");
|
||||
Components.utils.import("resource://testing-common/mailnews/nntpd.js");
|
||||
|
||||
// Generic mailnews resource scripts
|
||||
load("../../../resources/localAccountUtils.js");
|
||||
|
|
|
@ -3,6 +3,18 @@
|
|||
|
||||
Components.utils.import("resource:///modules/mimeParser.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
'nntpDaemon',
|
||||
'newsArticle',
|
||||
'NNTP_POSTABLE',
|
||||
'NNTP_REAL_LENGTH',
|
||||
'NNTP_RFC977_handler',
|
||||
'NNTP_RFC2980_handler',
|
||||
'NNTP_RFC3977_handler',
|
||||
'NNTP_Giganews_handler',
|
||||
'NNTP_RFC4643_extension'
|
||||
];
|
||||
|
||||
function nntpDaemon(flags) {
|
||||
this._groups = {};
|
||||
this._messages = {};
|
||||
|
@ -93,7 +105,7 @@ function newsArticle(text) {
|
|||
/**
|
||||
* This function converts an NNTP wildmat into a regular expression.
|
||||
*
|
||||
* I don't know how accurate it is wrt i18n characters, but it's primary usage
|
||||
* I don't know how accurate it is wrt i18n characters, but its primary usage
|
||||
* right now is just XPAT, where i18n effects are utterly unspecified, so I am
|
||||
* not too concerned.
|
||||
*
|
||||
|
@ -105,8 +117,10 @@ function wildmat2regex(wildmat) {
|
|||
return "\\" + str;
|
||||
});
|
||||
wildmat = wildmat.replace(/(\\*)([*?])/, function (str, p1, p2) {
|
||||
// TODO: This function appears to be wrong on closer inspection.
|
||||
if (p1.length % 2 == 0)
|
||||
return p2 == '*' ? '.*' : '.';
|
||||
return str;
|
||||
});
|
||||
return new RegExp(wildmat);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче