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
1ecc7e7d
Commit
1ecc7e7d
authored
11 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Speed 'er up.
parent
834e04a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/msgutils.js
+49
-67
49 additions, 67 deletions
exec/load/msgutils.js
with
49 additions
and
67 deletions
exec/load/msgutils.js
+
49
−
67
View file @
1ecc7e7d
...
@@ -369,6 +369,10 @@ function getMessageThreads(sub, max) {
...
@@ -369,6 +369,10 @@ function getMessageThreads(sub, max) {
var
tbHeader
;
var
tbHeader
;
var
md5subject
;
var
md5subject
;
var
msgBase
=
new
MsgBase
(
sub
);
var
msgBase
=
new
MsgBase
(
sub
);
var
header_num
=
{};
var
all_headers
=
[];
var
m
;
msgBase
.
open
();
msgBase
.
open
();
if
(
!
msgBase
.
is_open
)
if
(
!
msgBase
.
is_open
)
return
false
;
return
false
;
...
@@ -376,8 +380,14 @@ function getMessageThreads(sub, max) {
...
@@ -376,8 +380,14 @@ function getMessageThreads(sub, max) {
max
=
msgBase
.
first_msg
;
max
=
msgBase
.
first_msg
;
else
else
max
=
msgBase
.
last_msg
-
max
;
max
=
msgBase
.
last_msg
-
max
;
for
(
var
m
=
max
;
m
<=
msgBase
.
last_msg
;
m
++
)
{
if
(
js
.
global
.
get_all_msg_headers
!==
undefined
)
header
=
msgBase
.
get_msg_header
(
m
);
all_headers
=
msgBase
.
get_all_msg_headers
();
else
{
for
(
m
=
max
;
m
<=
msgBase
.
last_msg
;
m
++
)
all_headers
.
push
(
msgBase
.
get_msg_header
(
m
));
}
for
(
m
in
all_headers
)
{
header
=
all_headers
[
m
];
if
(
if
(
header
===
null
header
===
null
||
||
...
@@ -393,81 +403,60 @@ function getMessageThreads(sub, max) {
...
@@ -393,81 +403,60 @@ function getMessageThreads(sub, max) {
)
)
)
)
continue
;
continue
;
header_num
[
header
.
number
]
=
header
;
md5subject
=
md5_calc
(
header
.
subject
.
toUpperCase
().
replace
(
/
\s
*RE:
\s
*/g
,
''
),
hex
=
true
);
md5subject
=
md5_calc
(
header
.
subject
.
toUpperCase
().
replace
(
/
\s
*RE:
\s
*/g
,
''
),
hex
=
true
);
if
(
header
.
thread_id
===
0
&&
threadedMessages
.
indexOf
(
header
.
thread_back
)
>=
0
)
{
if
(
header
.
thread_id
===
0
&&
threadedMessages
.
indexOf
(
header
.
thread_back
)
>=
0
)
{
if
(
threads
.
thread
.
hasOwnProperty
(
header
.
thread_back
))
{
if
(
threads
.
thread
.
hasOwnProperty
(
header
.
thread_back
))
{
// This is a reply to the first message in a thread
// This is a reply to the first message in a thread
header
.
ec_thread
=
threads
.
thread
[
header
.
thread_back
];
threads
.
thread
[
header
.
thread_back
].
newest
=
header
.
when_written_time
;
threads
.
thread
[
header
.
thread_back
].
newest
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
header
.
thread_back
].
dateIndex
]
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
header
.
thread_back
].
dateIndex
]
=
header
.
when_written_time
;
threads
.
thread
[
header
.
thread_back
].
messages
.
push
(
threads
.
thread
[
header
.
thread_back
].
messages
.
push
(
header
);
{
number
:
header
.
number
,
to
:
header
.
to
,
from
:
header
.
from
,
subject
:
header
.
subject
,
thread_id
:
header
.
thread_id
,
thread_back
:
header
.
thread_back
,
when_written_time
:
header
.
when_written_time
}
);
threadedMessages
.
push
(
header
.
number
);
threadedMessages
.
push
(
header
.
number
);
}
else
{
}
else
{
tbHeader
=
msgBase
.
get_msg_header
(
header
.
thread_back
);
tbHeader
=
header_num
[
header
.
thread_back
];
if
(
tbHeader
==
null
)
{
tbHeader
=
msgBase
.
get_msg_header
(
header
.
thread_back
);
if
(
tbHeader
!=
null
)
header_num
[
tbHeader
.
number
]
=
tbHeader
;
}
if
(
tbHeader
!==
null
)
{
if
(
tbHeader
!==
null
)
{
// Heh - yeah, this part still sucks
if
(
tbHeader
.
ec_thread
!==
undefined
)
{
outer
:
tbHeader
.
ec_thread
.
newest
=
header
.
when_written_time
;
for
(
var
t
in
threads
.
thread
)
{
threads
.
dates
[
tbHeader
.
ec_thread
.
dateIndex
]
=
header
.
when_written_time
;
for
(
var
mm
in
threads
.
thread
[
t
]
.
messages
)
{
tbHeader
.
ec_
thread
.
messages
.
push
(
header
);
if
(
thread
s
.
thread
[
t
].
messages
[
mm
].
number
!=
tbH
eader
.
number
)
thread
edMessages
.
push
(
h
eader
.
number
)
;
continue
;
header
.
ec_thread
=
tbHeader
.
ec_thread
;
threads
.
thread
[
t
].
newest
=
header
.
when_written_time
;
}
threads
.
dates
[
threads
.
thread
[
t
].
dateIndex
]
=
header
.
when_written_time
;
else
{
threads
.
thread
[
t
].
messages
.
push
(
// Heh - yeah, this part still sucks
{
outer
:
number
:
header
.
number
,
for
(
var
t
in
threads
.
thread
)
{
to
:
header
.
to
,
for
(
var
mm
in
threads
.
thread
[
t
].
messages
)
{
from
:
header
.
from
,
if
(
threads
.
thread
[
t
].
messages
[
mm
].
number
!=
tbHeader
.
number
)
subject
:
header
.
subject
,
continue
;
thread_id
:
h
ead
er
.
thread
_id
,
header
.
ec_thread
=
thr
ead
s
.
thread
[
t
];
thread
_back
:
header
.
thread_back
,
thread
s
.
thread
[
t
].
newest
=
header
.
when_written_time
;
when_written_time
:
header
.
when_written_time
threads
.
dates
[
threads
.
thread
[
t
].
dateIndex
]
=
header
.
when_written_time
;
}
threads
.
thread
[
t
].
messages
.
push
(
header
);
);
threadedMessages
.
push
(
header
.
number
);
th
rea
dedMessages
.
push
(
header
.
numb
er
)
;
b
rea
k
out
er
;
break
outer
;
}
}
}
}
}
}
}
}
}
}
else
if
(
header
.
thread_id
!==
header
.
number
&&
threads
.
thread
.
hasOwnProperty
(
header
.
thread_id
))
{
}
else
if
(
header
.
thread_id
!==
header
.
number
&&
threads
.
thread
.
hasOwnProperty
(
header
.
thread_id
))
{
header
.
ec_thread
=
threads
.
thread
[
header
.
thread_id
];
threads
.
thread
[
header
.
thread_id
].
newest
=
header
.
when_written_time
;
threads
.
thread
[
header
.
thread_id
].
newest
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
header
.
thread_id
].
dateIndex
]
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
header
.
thread_id
].
dateIndex
]
=
header
.
when_written_time
;
threads
.
thread
[
header
.
thread_id
].
messages
.
push
(
threads
.
thread
[
header
.
thread_id
].
messages
.
push
(
header
);
{
number
:
header
.
number
,
to
:
header
.
to
,
from
:
header
.
from
,
subject
:
header
.
subject
,
thread_id
:
header
.
thread_id
,
thread_back
:
header
.
thread_back
,
when_written_time
:
header
.
when_written_time
}
);
threadedMessages
.
push
(
header
.
number
);
threadedMessages
.
push
(
header
.
number
);
}
else
if
(
subjects
.
hasOwnProperty
(
md5subject
))
{
}
else
if
(
subjects
.
hasOwnProperty
(
md5subject
))
{
header
.
ec_thread
=
threads
.
thread
[
subjects
[
md5subject
]];
threads
.
thread
[
subjects
[
md5subject
]].
newest
=
header
.
when_written_time
;
threads
.
thread
[
subjects
[
md5subject
]].
newest
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
subjects
[
md5subject
]].
dateIndex
]
=
header
.
when_written_time
;
threads
.
dates
[
threads
.
thread
[
subjects
[
md5subject
]].
dateIndex
]
=
header
.
when_written_time
;
threads
.
thread
[
subjects
[
md5subject
]].
messages
.
push
(
threads
.
thread
[
subjects
[
md5subject
]].
messages
.
push
(
header
);
{
number
:
header
.
number
,
to
:
header
.
to
,
from
:
header
.
from
,
subject
:
header
.
subject
,
thread_id
:
header
.
thread_id
,
thread_back
:
header
.
thread_back
,
when_written_time
:
header
.
when_written_time
}
);
threadedMessages
.
push
(
header
.
number
);
threadedMessages
.
push
(
header
.
number
);
}
else
{
}
else
{
threads
.
dates
.
push
(
header
.
when_written_time
);
threads
.
dates
.
push
(
header
.
when_written_time
);
...
@@ -475,17 +464,10 @@ function getMessageThreads(sub, max) {
...
@@ -475,17 +464,10 @@ function getMessageThreads(sub, max) {
newest
:
header
.
when_written_time
,
newest
:
header
.
when_written_time
,
dateIndex
:
threads
.
dates
.
length
-
1
,
dateIndex
:
threads
.
dates
.
length
-
1
,
messages
:
[
messages
:
[
{
header
number
:
header
.
number
,
to
:
header
.
to
,
from
:
header
.
from
,
subject
:
header
.
subject
,
thread_id
:
header
.
thread_id
,
thread_back
:
header
.
thread_back
,
when_written_time
:
header
.
when_written_time
}
]
]
}
}
header
.
ec_thread
=
threads
.
thread
[((
header
.
thread_id
===
0
)?
header
.
number
:
header
.
thread_id
)];
subjects
[
md5subject
]
=
((
header
.
thread_id
===
0
)?
header
.
number
:
header
.
thread_id
);
subjects
[
md5subject
]
=
((
header
.
thread_id
===
0
)?
header
.
number
:
header
.
thread_id
);
threadedMessages
.
push
(
header
.
number
);
threadedMessages
.
push
(
header
.
number
);
}
}
...
@@ -503,4 +485,4 @@ function getMessageThreads(sub, max) {
...
@@ -503,4 +485,4 @@ function getMessageThreads(sub, max) {
}
}
log
(
LOG_INFO
,
"
Messages threaded in
"
+
(
system
.
timer
-
stime
)
+
"
seconds.
"
);
log
(
LOG_INFO
,
"
Messages threaded in
"
+
(
system
.
timer
-
stime
)
+
"
seconds.
"
);
return
threads
;
return
threads
;
}
}
\ No newline at end of file
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