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
93c17909
Commit
93c17909
authored
20 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added support for "cancel" control messages to delete messages via NNTP.
parent
085d49d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exec/load/newsutil.js
+5
-0
5 additions, 0 deletions
exec/load/newsutil.js
exec/nntpservice.js
+38
-5
38 additions, 5 deletions
exec/nntpservice.js
with
43 additions
and
5 deletions
exec/load/newsutil.js
+
5
−
0
View file @
93c17909
...
@@ -156,6 +156,11 @@ function parse_news_header(hdr, line)
...
@@ -156,6 +156,11 @@ function parse_news_header(hdr, line)
hdr
.
ftn_reply
=
data
;
hdr
.
ftn_reply
=
data
;
break
;
break
;
/* NNTP control messages */
case
"
control
"
:
hdr
.
control
=
data
;
break
;
default
:
default
:
if
(
hdr
.
field_list
==
undefined
)
if
(
hdr
.
field_list
==
undefined
)
hdr
.
field_list
=
new
Array
();
hdr
.
field_list
=
new
Array
();
...
...
This diff is collapsed.
Click to expand it.
exec/nntpservice.js
+
38
−
5
View file @
93c17909
...
@@ -666,6 +666,41 @@ while(client.socket.is_connected && !quit) {
...
@@ -666,6 +666,41 @@ while(client.socket.is_connected && !quit) {
msgbase
.
close
();
msgbase
.
close
();
delete
msgbase
;
delete
msgbase
;
}
}
msgbase
=
new
MsgBase
(
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
code
);
if
(
msgbase
.
open
!=
undefined
&&
msgbase
.
open
()
==
false
)
continue
;
/* NNTP Control Message? */
if
(
hdr
.
control
!=
undefined
)
{
var
ctrl_msg
=
hdr
.
control
.
split
(
/
\s
+/
);
var
target
;
if
(
ctrl_msg
.
length
)
{
switch
(
ctrl_msg
[
0
].
toLowerCase
())
{
case
"
cancel
"
:
target
=
msgbase
.
get_msg_header
(
ctrl_msg
[
1
]);
if
(
target
==
null
)
{
log
(
"
!Invalid Message-ID:
"
+
ctrl_msg
[
1
]);
break
;
}
if
(
logged_in
&&
((
target
.
from_ext
==
user
.
number
&&
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
settings
&
SUB_DEL
)
||
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
is_operator
))
{
if
(
msgbase
.
remove_msg
(
ctrl_msg
[
1
]))
{
posted
=
true
;
log
(
"
Message deleted:
"
+
ctrl_msg
[
1
]);
}
else
log
(
"
!ERROR
"
+
msgbase
.
error
+
"
deleting message:
"
+
ctrl_msg
[
1
]);
continue
;
}
break
;
}
}
log
(
"
!Invalid control message:
"
+
hdr
.
control
);
break
;
}
if
(
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
settings
&
SUB_NAME
if
(
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
settings
&
SUB_NAME
&&
!
(
user
.
security
.
restrictions
&
(
UFLAG_G
|
UFLAG_Q
)))
&&
!
(
user
.
security
.
restrictions
&
(
UFLAG_G
|
UFLAG_Q
)))
hdr
.
from
=
user
.
name
;
// Use real names
hdr
.
from
=
user
.
name
;
// Use real names
...
@@ -674,19 +709,17 @@ while(client.socket.is_connected && !quit) {
...
@@ -674,19 +709,17 @@ while(client.socket.is_connected && !quit) {
else
else
hdr
.
attr
&=~
MSG_MODERATED
;
hdr
.
attr
&=~
MSG_MODERATED
;
msgbase
=
new
MsgBase
(
msg_area
.
grp_list
[
g
].
sub_list
[
s
].
code
);
if
(
msgbase
.
open
!=
undefined
&&
msgbase
.
open
()
==
false
)
continue
;
if
(
msgbase
.
save_msg
(
hdr
,
body
))
{
if
(
msgbase
.
save_msg
(
hdr
,
body
))
{
log
(
format
(
"
%s posted a message (%u chars, %u lines) on %s
"
log
(
format
(
"
%s posted a message (%u chars, %u lines) on %s
"
,
user
.
alias
,
body
.
length
,
lines
,
newsgroups
[
n
]));
,
user
.
alias
,
body
.
length
,
lines
,
newsgroups
[
n
]));
writeln
(
"
240 article posted ok
"
);
posted
=
true
;
posted
=
true
;
msgs_posted
++
;
msgs_posted
++
;
}
else
}
else
log
(
format
(
"
!ERROR saving mesage: %s
"
,
msgbase
.
last_error
));
log
(
format
(
"
!ERROR saving mesage: %s
"
,
msgbase
.
last_error
));
}
}
if
(
!
posted
)
{
if
(
posted
)
writeln
(
"
240 article posted ok
"
);
else
{
log
(
"
!post failure
"
);
log
(
"
!post failure
"
);
writeln
(
"
441 posting failed
"
);
writeln
(
"
441 posting failed
"
);
}
}
...
...
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