citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
serv_blog.c
Go to the documentation of this file.
1// Support for blog rooms
2//
3// Copyright (c) 1999-2022 by the citadel.org team
4//
5// This program is open source software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License as published
7// by the Free Software Foundation; either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19#include "../../sysdep.h"
20#include <stdlib.h>
21#include <unistd.h>
22#include <stdio.h>
23#include <fcntl.h>
24#include <signal.h>
25#include <pwd.h>
26#include <errno.h>
27#include <ctype.h>
28#include <sys/types.h>
29#include <time.h>
30#include <sys/wait.h>
31#include <string.h>
32#include <limits.h>
33#include <libcitadel.h>
34#include "../../citadel.h"
35#include "../../server.h"
36#include "../../citserver.h"
37#include "../../support.h"
38#include "../../config.h"
39#include "../../control.h"
40#include "../../user_ops.h"
41#include "../../database.h"
42#include "../../msgbase.h"
43#include "../../internet_addressing.h"
44#include "../../serv_vcard.h"
45#include "../../citadel_ldap.h"
46#include "../../ctdl_module.h"
47
48// Pre-save hook for saving a message in a blog room.
49// (Do we want to only do this for top-level messages?)
50int blog_upload_beforesave(struct CtdlMessage *msg, struct recptypes *recp) {
51
52 // Only run this hook for blog rooms
53 if (CC->room.QRdefaultview != VIEW_BLOG) {
54 return(0);
55 }
56
57 // If the message doesn't have an EUID, give it one.
58 if (CM_IsEmpty(msg, eExclusiveID)) {
59 char uuid[SIZ];
60 generate_uuid(uuid);
61 CM_SetField(msg, eExclusiveID, uuid, strlen(uuid));
62 }
63
64 // We also want to define a maximum length, whether we generated it or not.
65 CM_CutFieldAt(msg, eExclusiveID, BLOG_EUIDBUF_SIZE - 1);
66
67 // Now allow the save to complete.
68 return(0);
69}
70
71
72// Initialization function, called from modules_init.c
74 if (!threading) {
76 }
77
78 // return our module id for the log
79 return "blog";
80}
#define CC
Definition: context.h:140
void CtdlRegisterMessageHook(int(*handler)(struct CtdlMessage *, struct recptypes *), int EventType)
int threading
Definition: modules_init.c:24
int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which)
Definition: msgbase.c:132
void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
Definition: msgbase.c:137
void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
Definition: msgbase.c:159
char * ctdl_module_init_blog(void)
Definition: serv_blog.c:73
int blog_upload_beforesave(struct CtdlMessage *msg, struct recptypes *recp)
Definition: serv_blog.c:50
@ eExclusiveID
Definition: server.h:309
#define EVT_BEFORESAVE
Definition: server.h:231
#define SIZ
Definition: sysconfig.h:33