... | ... |
@@ -53,6 +53,7 @@ |
53 | 53 |
|
54 | 54 |
#include "mbox.h" |
55 | 55 |
#include "clamav.h" |
56 |
+#include "json_api.h" |
|
56 | 57 |
|
57 | 58 |
#ifndef isblank |
58 | 59 |
#define isblank(c) (((c) == ' ') || ((c) == '\t')) |
... | ... |
@@ -199,6 +200,11 @@ messageReset(message *m) |
199 | 199 |
free(m->encodingTypes); |
200 | 200 |
} |
201 | 201 |
|
202 |
+#if HAVE_JSON |
|
203 |
+ if(m->jobj) |
|
204 |
+ cli_json_delobj(m->jobj); |
|
205 |
+#endif |
|
206 |
+ |
|
202 | 207 |
memset(m, '\0', sizeof(message)); |
203 | 208 |
m->mimeType = NOMIME; |
204 | 209 |
} |
... | ... |
@@ -2630,3 +2636,15 @@ isuuencodebegin(const char *line) |
2630 | 2630 |
isdigit(line[6]) && isdigit(line[7]) && |
2631 | 2631 |
isdigit(line[8]) && (line[9] == ' '); |
2632 | 2632 |
} |
2633 |
+ |
|
2634 |
+#if HAVE_JSON |
|
2635 |
+json_object *messageGetJObj(message *m) |
|
2636 |
+{ |
|
2637 |
+ assert(m != NULL); |
|
2638 |
+ |
|
2639 |
+ if(m->jobj == NULL) |
|
2640 |
+ m->jobj = cli_jsonobj(NULL, NULL); |
|
2641 |
+ |
|
2642 |
+ return m->jobj; |
|
2643 |
+} |
|
2644 |
+#endif |
... | ... |
@@ -22,6 +22,8 @@ |
22 | 22 |
#ifndef _MESSAGE_H |
23 | 23 |
#define _MESSAGE_H |
24 | 24 |
|
25 |
+#include "json_api.h" |
|
26 |
+ |
|
25 | 27 |
/* The contents could change, ONLY access in message.c */ |
26 | 28 |
typedef struct message { |
27 | 29 |
encoding_type *encodingTypes; |
... | ... |
@@ -49,6 +51,9 @@ typedef struct message { |
49 | 49 |
unsigned int isInfected : 1; |
50 | 50 |
unsigned int isTruncated : 1; |
51 | 51 |
|
52 |
+#if HAVE_JSON |
|
53 |
+ json_object *jobj; |
|
54 |
+#endif |
|
52 | 55 |
} message; |
53 | 56 |
|
54 | 57 |
message *messageCreate(void); |
... | ... |
@@ -85,5 +90,8 @@ int isuuencodebegin(const char *line); |
85 | 85 |
void messageSetCTX(message *m, cli_ctx *ctx); |
86 | 86 |
int messageContainsVirus(const message *m); |
87 | 87 |
int messageSavePartial(message *m, const char *dir, const char *id, unsigned part); |
88 |
+#if HAVE_JSON |
|
89 |
+json_object *messageGetJObj(message *m); |
|
90 |
+#endif |
|
88 | 91 |
|
89 | 92 |
#endif /*_MESSAGE_H*/ |