2 * Support for blog rooms
4 * Copyright (c) 1999-2011 by the citadel.org team
6 * This program is open source software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include <sys/types.h>
35 #include <libcitadel.h>
38 #include "citserver.h"
45 #include "internet_addressing.h"
46 #include "serv_vcard.h"
47 #include "citadel_ldap.h"
48 #include "ctdl_module.h"
51 * Pre-save hook for saving a message in a blog room.
52 * (Do we want to only do this for top-level messages?)
54 int blog_upload_beforesave(struct CtdlMessage *msg, struct recptypes *recp) {
56 /* Only run this hook for blog rooms */
57 if (CC->room.QRdefaultview != VIEW_BLOG) {
62 * If the message doesn't have an EUID, give it one.
64 if (CM_IsEmpty(msg, eExclusiveID))
68 CM_SetField(msg, eExclusiveID, uuid, strlen(uuid));
72 * We also want to define a maximum length, whether we generated it or not.
74 CM_CutFieldAt(msg, eExclusiveID, BLOG_EUIDBUF_SIZE - 1);
76 /* Now allow the save to complete. */
81 CTDL_MODULE_INIT(blog)
85 CtdlRegisterMessageHook(blog_upload_beforesave, EVT_BEFORESAVE);
88 /* return our module id for the Log */