1
0
Fork 0

mm1 improvements

This commit is contained in:
bagyenda 2009-01-16 05:47:43 +00:00
parent 037183a65a
commit d62e733178
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,5 @@
2009-01-16 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor update to mmsc mm1 notifier: cleanup
2009-01-12 P. A. Bagyenda <bagyenda@dsmagic.com> 2009-01-12 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fixes: Output from admin interfaces always valid XML * Minor fixes: Output from admin interfaces always valid XML
* Minor fixes: admin module * Minor fixes: admin module

View File

@ -19,11 +19,11 @@
#define WAPPUSH_PORT 2948 #define WAPPUSH_PORT 2948
static MmsEnvelope *update_env_success(MmsEnvelope *e, MmsEnvelopeTo *xto) static MmsEnvelope *update_env(MmsEnvelope *e, MmsEnvelopeTo *xto, int success)
{ {
time_t tnow = time(NULL); time_t tnow = time(NULL);
if (xto && !(e->msgtype == MMS_MSGTYPE_SEND_REQ || if (success && xto && !(e->msgtype == MMS_MSGTYPE_SEND_REQ ||
e->msgtype == MMS_MSGTYPE_RETRIEVE_CONF)) e->msgtype == MMS_MSGTYPE_RETRIEVE_CONF))
xto->process = 0; /* No more processing. */ xto->process = 0; /* No more processing. */
else { else {
@ -46,6 +46,7 @@ static MmsEnvelope *update_env_success(MmsEnvelope *e, MmsEnvelopeTo *xto)
return e; return e;
} }
#if 0
static MmsEnvelope *update_env_failed(MmsEnvelope *e) static MmsEnvelope *update_env_failed(MmsEnvelope *e)
{ {
@ -58,6 +59,7 @@ static MmsEnvelope *update_env_failed(MmsEnvelope *e)
e = NULL; e = NULL;
return e; return e;
} }
#endif
static void do_mm1_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg *msg) static void do_mm1_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg *msg)
{ {
@ -110,12 +112,12 @@ static void do_mm1_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg
mms_error(0, "MM1", NULL, " Push[%s] from %s, to %s, failed, HTTP code => %d", e->xqfname, mms_error(0, "MM1", NULL, " Push[%s] from %s, to %s, failed, HTTP code => %d", e->xqfname,
octstr_get_cstr(e->from), octstr_get_cstr(to), status); octstr_get_cstr(e->from), octstr_get_cstr(to), status);
e = update_env_failed(e); e = update_env(e,xto,0);
} else { /* Successful push. */ } else { /* Successful push. */
mms_log2("Notify", octstr_imm("system"), to, mms_log2("Notify", octstr_imm("system"), to,
-1, e ? e->msgId : NULL, NULL, NULL, "MM1", NULL,NULL); -1, e ? e->msgId : NULL, NULL, NULL, "MM1", NULL,NULL);
e = update_env_success(e, xto); e = update_env(e, xto, 1);
} }
http_destroy_headers(pheaders); http_destroy_headers(pheaders);
@ -137,9 +139,9 @@ static void do_mm1_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg
mms_log2("Notify", octstr_imm("system"), to, mms_log2("Notify", octstr_imm("system"), to,
-1, e ? e->msgId : NULL, -1, e ? e->msgId : NULL,
NULL, NULL, "MM1", NULL,NULL); NULL, NULL, "MM1", NULL,NULL);
e = update_env_success(e, xto); e = update_env(e, xto, 1);
} else { } else {
e = update_env_failed(e); e = update_env(e, NULL, 0);
mms_error(0, "MM1", NULL, "push to %s:%d failed: %s", octstr_get_cstr(to), WAPPUSH_PORT, strerror(errno)); mms_error(0, "MM1", NULL, "push to %s:%d failed: %s", octstr_get_cstr(to), WAPPUSH_PORT, strerror(errno));
} }
octstr_destroy(addr); octstr_destroy(addr);