diff options
-rwxr-xr-x | pttbbs/daemon/postd/postd.py | 5 | ||||
-rw-r--r-- | pttbbs/daemon/postd/rebuild.c | 2 | ||||
-rw-r--r-- | pttbbs/include/daemons.h | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/pttbbs/daemon/postd/postd.py b/pttbbs/daemon/postd/postd.py index 56eedc9f..911ceaa6 100755 --- a/pttbbs/daemon/postd/postd.py +++ b/pttbbs/daemon/postd/postd.py @@ -102,6 +102,11 @@ def SavePost2(content, keypak, data, extra=None): logging.error('%s/%s: save time (%d bytes): %.3fs.', keypak.board, keypak.file, content_length, exec_time) +def GetPostContent(keypak): + logging.debug("GetPostContent: %r", keypak) + key = '%s/%s:content' % (keypak.board, keypak.file) + return g_db.get(key) or '' + def open_database(db_path): global g_db diff --git a/pttbbs/daemon/postd/rebuild.c b/pttbbs/daemon/postd/rebuild.c index f336a78e..cf6c73fd 100644 --- a/pttbbs/daemon/postd/rebuild.c +++ b/pttbbs/daemon/postd/rebuild.c @@ -136,8 +136,8 @@ char *ProcessPost(const char *filename) { fseek(fp, offBegin, SEEK_SET); content = malloc(offEnd - offBegin + 1); assert(content); + fread(content, 1, offEnd - offBegin, fp); content[offEnd - offBegin] = 0; - fread(content, 1, offEnd - offBegin + 1, fp); // Try to parse comments fseek(fp, offEnd, SEEK_SET); diff --git a/pttbbs/include/daemons.h b/pttbbs/include/daemons.h index 1066e602..b7f18b1a 100644 --- a/pttbbs/include/daemons.h +++ b/pttbbs/include/daemons.h @@ -210,6 +210,12 @@ typedef struct { PostKeyReq key; } PACKSTRUCT PostAddRequest; +typedef struct { + short cb; + short operation; + PostKeyReq key; +} PACKSTRUCT PostGetContentRequest; + /////////////////////////////////////////////////////////////////////// // online friend relation daemon // |