Compare commits
No commits in common. "49c58c94da93d6a253b4f4a1df197bc0a99ce916" and "973f0d97685b478d4b30ad23c0374a94b8c82449" have entirely different histories.
49c58c94da
...
973f0d9768
2 changed files with 14 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from xenu_nntp.config import Config
|
from xenu_nntp.config import Config
|
||||||
|
|
|
@ -16,7 +16,7 @@ from xenu_nntp.response import Response, ResponseCode
|
||||||
from xenu_nntp.newsgroup import Newsgroup
|
from xenu_nntp.newsgroup import Newsgroup
|
||||||
from xenu_nntp.user import User, UserPermission
|
from xenu_nntp.user import User, UserPermission
|
||||||
from xenu_nntp.message import (
|
from xenu_nntp.message import (
|
||||||
Message, MessageRange, MessagePart
|
Message, MessageRange, MessagePart, each_line
|
||||||
)
|
)
|
||||||
|
|
||||||
class SessionMode(enum.Enum):
|
class SessionMode(enum.Enum):
|
||||||
|
@ -339,7 +339,7 @@ class Session(Connection):
|
||||||
|
|
||||||
for newsgroup in self.each_newsgroup():
|
for newsgroup in self.each_newsgroup():
|
||||||
self.print("%s %d %s" % (
|
self.print("%s %d %s" % (
|
||||||
newsgroup.name,
|
name,
|
||||||
newsgroup.created_on.timestamp(),
|
newsgroup.created_on.timestamp(),
|
||||||
newsgroup.created_by
|
newsgroup.created_by
|
||||||
))
|
))
|
||||||
|
@ -439,8 +439,12 @@ class Session(Connection):
|
||||||
return datetime.datetime(yyyy, mm, dd, hh, MM, ss)
|
return datetime.datetime(yyyy, mm, dd, hh, MM, ss)
|
||||||
|
|
||||||
def _cmd_newnews(self, wildmat, datestr, timestr, *args):
|
def _cmd_newnews(self, wildmat, datestr, timestr, *args):
|
||||||
|
gmt = False
|
||||||
|
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
if args[0] != "GMT":
|
if args[0] == "GMT":
|
||||||
|
gmt = True
|
||||||
|
else:
|
||||||
return self.send_response(ResponseCode.NNTP_SYNTAX_ERROR, "Only optional 'GMT' allowed")
|
return self.send_response(ResponseCode.NNTP_SYNTAX_ERROR, "Only optional 'GMT' allowed")
|
||||||
elif len(args) > 1:
|
elif len(args) > 1:
|
||||||
return self.send_response(ResponseCode.NNTP_SYNTAX_ERROR, "Too many arguments")
|
return self.send_response(ResponseCode.NNTP_SYNTAX_ERROR, "Too many arguments")
|
||||||
|
@ -479,8 +483,12 @@ class Session(Connection):
|
||||||
return self.end()
|
return self.end()
|
||||||
|
|
||||||
def _cmd_newgroups(self, datestr, timestr, *args):
|
def _cmd_newgroups(self, datestr, timestr, *args):
|
||||||
|
gmt = False
|
||||||
|
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
if args[0] != "GMT":
|
if args[0] == "GMT":
|
||||||
|
gmt = True
|
||||||
|
else:
|
||||||
return self.respond(ResponseCode.NNTP_SYNTAX_ERROR, "Only optional 'GMT' allowed")
|
return self.respond(ResponseCode.NNTP_SYNTAX_ERROR, "Only optional 'GMT' allowed")
|
||||||
elif len(args) > 1:
|
elif len(args) > 1:
|
||||||
return self.respond(ResponseCode.NNTP_SYNTAX_ERROR, "Too many arguments")
|
return self.respond(ResponseCode.NNTP_SYNTAX_ERROR, "Too many arguments")
|
||||||
|
@ -715,7 +723,7 @@ class Session(Connection):
|
||||||
) values (%s, %s)
|
) values (%s, %s)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.db.execute(sql, (newsgroup.id, message.id))
|
cr = self.db.execute(sql, (newsgroup.id, message.id))
|
||||||
|
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue