From e104515d9b652ec61168f4dc2abfb3ae782de7b2 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 5 Nov 2010 06:26:49 +0000 Subject: [PATCH] updated mmsbox callback interface usage --- mbuni/mmlib/mms_mm7soap.c | 30 +++++++++++++++++++++++++++++- mbuni/mmlib/mms_queue.c | 3 ++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index c47d267..bf44bff 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -1309,5 +1309,33 @@ Octstr *mm7_soap_header_value(MSoapMsg_t *m, Octstr *header) List *mm7_soap_headers(MSoapMsg_t *m) { - return m ? http_header_duplicate(m->envelope) : NULL; + List *l; + int i; + + if (m == NULL) + return NULL; + + l = http_create_empty_headers(); + for (i = 0; i < gwlist_len(m->envelope); i++) { + Octstr *n = NULL, *v = NULL; + + http_header_get(m->envelope, i, &n, &v); + + if (!n || !v) + goto loop; + if (octstr_str_case_compare(n, "From") == 0 || + octstr_str_case_compare(n, "To") == 0 || + octstr_str_case_compare(n, "Sender") == 0 || + octstr_str_case_compare(n, "Cc") == 0 || + octstr_str_case_compare(n, "Bcc") == 0 || + octstr_str_case_compare(n, "SenderAddress") == 0) { + if (octstr_get_char(v, 0) == '+') + octstr_delete(v, 0, 2); + } + http_header_add(l, octstr_get_cstr(n), octstr_get_cstr(v)); + loop: + octstr_destroy(n); + octstr_destroy(v); + } + return l; } diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 1a39d39..24c6199 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -427,6 +427,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv) mms_error(0, "mms_queue", NULL, "Failed lock temp file %s: error = %s\n", octstr_get_cstr(tfname), strerror(errno)); res = -1; + close(fd); goto done; } } @@ -645,7 +646,7 @@ static int mkqf(char qf[QFNAMEMAX], char subdir[64], char *mms_queuedir) if (fd >= 0) strncpy(qf, octstr_get_cstr(xqf), QFNAMEMAX); - if (xqf) octstr_destroy(xqf); + octstr_destroy(xqf); return fd; }