X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fblog%2Fserv_blog.c;h=98bc938d3c6113b53e2e13ff9035daee10e9ce74;hb=882ff5a53c3b4e440520a073cf07dc60b2671876;hp=5459898f759095115fb06af6877b9d322d2efbb9;hpb=2e7a8005192118c2be41965c90b7924e515ed779;p=citadel.git diff --git a/citadel/modules/blog/serv_blog.c b/citadel/modules/blog/serv_blog.c index 5459898f7..98bc938d3 100644 --- a/citadel/modules/blog/serv_blog.c +++ b/citadel/modules/blog/serv_blog.c @@ -28,18 +28,7 @@ #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 @@ -62,7 +51,7 @@ * Pre-save hook for saving a message in a blog room. * (Do we want to only do this for top-level messages?) */ -int blog_upload_beforesave(struct CtdlMessage *msg) { +int blog_upload_beforesave(struct CtdlMessage *msg, struct recptypes *recp) { /* Only run this hook for blog rooms */ if (CC->room.QRdefaultview != VIEW_BLOG) { @@ -72,13 +61,18 @@ int blog_upload_beforesave(struct CtdlMessage *msg) { /* * If the message doesn't have an EUID, give it one. */ - if (msg->cm_fields['E'] == NULL) + if (CM_IsEmpty(msg, eExclusiveID)) { - char uuid[37]; + char uuid[SIZ]; generate_uuid(uuid); - msg->cm_fields['E'] = strdup(uuid); + CM_SetField(msg, eExclusiveID, uuid, strlen(uuid)); } + /* + * We also want to define a maximum length, whether we generated it or not. + */ + CM_CutFieldAt(msg, eExclusiveID, BLOG_EUIDBUF_SIZE - 1); + /* Now allow the save to complete. */ return(0); }