Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
95c98a7a
Commit
95c98a7a
authored
12 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Linting.
parent
4b95f64a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/imapservice.js
+40
-38
40 additions, 38 deletions
exec/imapservice.js
with
40 additions
and
38 deletions
exec/imapservice.js
+
40
−
38
View file @
95c98a7a
...
@@ -17,6 +17,41 @@ var debug=true;
...
@@ -17,6 +17,41 @@ var debug=true;
var
debugRX
=
true
;
var
debugRX
=
true
;
/**********************/
/* Encoding functions */
/**********************/
/*
* These encode at least as is passed (token/string/binary)
*/
function
encode_binary
(
str
)
{
return
'
{
'
+
str
.
length
+
'
}
\r\n
'
+
str
;
}
function
encode_string
(
str
)
{
if
(
str
==
''
)
return
(
'
""
'
);
if
(
str
.
search
(
/
[\r\n\x
80-
\x
ff
]
/
)
==-
1
)
{
str
=
str
.
replace
(
/
[\\\"]
/
,
"
\\
$1
"
);
return
'
"
'
+
str
+
'
"
'
;
}
return
encode_binary
(
str
);
}
function
encode_token
(
str
)
{
if
(
str
==
''
)
return
(
encode_string
(
str
));
if
(
str
.
search
(
/
[\(\)\{
\x
00-
\x
1F
\*\%\"\\\]]
/
)
==-
1
)
return
str
;
return
(
encode_string
(
str
));
}
/*****************************/
/*****************************/
/* Message header extensions */
/* Message header extensions */
/*****************************/
/*****************************/
...
@@ -37,7 +72,7 @@ MsgBase.HeaderPrototype.get_from=function (force)
...
@@ -37,7 +72,7 @@ MsgBase.HeaderPrototype.get_from=function (force)
this
.
from_header
=
this
.
from
+
"
<
"
+
this
.
from
.
replace
(
/ /g
,
"
.
"
).
toLowerCase
()
+
"
@
"
+
this
.
from_net_addr
+
"
>
"
;
this
.
from_header
=
this
.
from
+
"
<
"
+
this
.
from
.
replace
(
/ /g
,
"
.
"
).
toLowerCase
()
+
"
@
"
+
this
.
from_net_addr
+
"
>
"
;
}
}
return
(
this
.
from_header
);
return
(
this
.
from_header
);
}
}
;
MsgBase
.
HeaderPrototype
.
parse_headers
=
function
(
force
)
MsgBase
.
HeaderPrototype
.
parse_headers
=
function
(
force
)
{
{
...
@@ -47,11 +82,13 @@ MsgBase.HeaderPrototype.parse_headers=function(force)
...
@@ -47,11 +82,13 @@ MsgBase.HeaderPrototype.parse_headers=function(force)
if
(
this
.
parsed_headers
==
undefined
)
if
(
this
.
parsed_headers
==
undefined
)
this
.
parsed_headers
=
parse_headers
(
this
.
get_rfc822_header
(
force
))
this
.
parsed_headers
=
parse_headers
(
this
.
get_rfc822_header
(
force
))
return
(
this
.
parsed_headers
);
return
(
this
.
parsed_headers
);
}
}
;
MsgBase
.
HeaderPrototype
.
get_envelope
=
function
(
force
)
MsgBase
.
HeaderPrototype
.
get_envelope
=
function
(
force
)
{
{
function
parse_header
(
header
,
is_addresses
)
{
function
parse_header
(
header
,
is_addresses
)
{
var
m2
;
if
(
header
==
undefined
||
header
.
length
==
0
)
if
(
header
==
undefined
||
header
.
length
==
0
)
return
(
"
NIL
"
);
return
(
"
NIL
"
);
...
@@ -99,7 +136,7 @@ MsgBase.HeaderPrototype.get_envelope=function (force)
...
@@ -99,7 +136,7 @@ MsgBase.HeaderPrototype.get_envelope=function (force)
envelope
.
push
(
parse_header
(
hdrs
[
'
message-id
'
],
false
));
envelope
.
push
(
parse_header
(
hdrs
[
'
message-id
'
],
false
));
}
}
return
(
envelope
);
return
(
envelope
);
}
}
;
/***********************/
/***********************/
...
@@ -144,41 +181,6 @@ function untagged(msg)
...
@@ -144,41 +181,6 @@ function untagged(msg)
}
}
/**********************/
/* Encoding functions */
/**********************/
/*
* These encode at least as is passed (token/string/binary)
*/
function
encode_binary
(
str
)
{
return
'
{
'
+
str
.
length
+
'
}
\r\n
'
+
str
;
}
function
encode_string
(
str
)
{
if
(
str
==
''
)
return
(
'
""
'
);
if
(
str
.
search
(
/
[\r\n\x
80-
\x
ff
]
/
)
==-
1
)
{
str
=
str
.
replace
(
/
[\\\"]
/
,
"
\\
$1
"
);
return
'
"
'
+
str
+
'
"
'
;
}
return
encode_binary
(
str
);
}
function
encode_token
(
str
)
{
if
(
str
==
''
)
return
(
encode_string
(
str
));
if
(
str
.
search
(
/
[\(\)\{
\x
00-
\x
1F
\*\%\"\\\]]
/
)
==-
1
)
return
str
;
return
(
encode_string
(
str
));
}
/*************************************************************/
/*************************************************************/
/* Fetch response generation... this is the tricky bit. :-) */
/* Fetch response generation... this is the tricky bit. :-) */
/*************************************************************/
/*************************************************************/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment