From: Art Cancro Date: Tue, 14 Sep 2010 14:33:04 +0000 (-0400) Subject: Added a module for blog rooms. Add EUID for any message without one X-Git-Tag: v8.01~712^2~10 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=27b40a8300ed2bedb2d10765eeea9616a3968345;p=citadel.git Added a module for blog rooms. Add EUID for any message without one --- diff --git a/citadel/modules/blog/serv_blog.c b/citadel/modules/blog/serv_blog.c new file mode 100644 index 000000000..6997a057e --- /dev/null +++ b/citadel/modules/blog/serv_blog.c @@ -0,0 +1,95 @@ +/* + * Support for blog rooms + * + * Copyright (c) 1999-2010 by the citadel.org team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include +#include +#include +#include +#include "citadel.h" +#include "server.h" +#include "citserver.h" +#include "support.h" +#include "config.h" +#include "control.h" +#include "user_ops.h" +#include "database.h" +#include "msgbase.h" +#include "internet_addressing.h" +#include "serv_vcard.h" +#include "citadel_ldap.h" +#include "ctdl_module.h" + +/* + * sd sdhfksdjhkjsdfhk jsdhfkjsdfhkjsd hkfjhsdkjfhsdkjfhksdjfhsd + */ +int blog_upload_beforesave(struct CtdlMessage *msg) { + char buf[SIZ]; + + /* Only run this hook for blog rooms */ + if (CC->room.QRdefaultview != VIEW_BLOG) { + return(0); + } + + /* + * If the message doesn't have an EUID, give it one. + */ + if (msg->cm_fields['E'] != NULL) + { + generate_uuid(buf); + msg->cm_fields['E'] = strdup(buf); + } + + /* Now allow the save to complete. */ + return(0); +} + + +CTDL_MODULE_INIT(blog) +{ + if (!threading) + { + CtdlRegisterMessageHook(blog_upload_beforesave, EVT_BEFORESAVE); + } + + /* return our module id for the Log */ + return "blog"; +}